-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sign-out functionality to MSAL #589
Comments
@DaRosenberg - thanks for the feedback, we are thinking of adding a feature to what you have described. Other ADAL libraries offer such functionality. Note that MSAL does offer a mechanism to remove users from the token cache:
@jennyf19 - do you know if we document anywhere how to delete cookies from the system browser ? Not sure about the OIDC sign out, need a bit more thought around the other Active Directories (@jmprieur ) |
@bgavrilMS Yep, we are already using the We would do the cookie clearing ourselves, but the issue for us is that all the authentication stuff is implemented in a cross-platform library targeting netstandard2.0. To clear the |
Unfortunately clearing cookies is impossible right now. On Android, the use of Chrome Custom Tabs means that we don't have any control over cookies as they are shared with the external Chrome app and thus not accessible. The user would have to manually open the website in Chrome and then log out from any identity providers. Theoretically we could automatically open the logout URL, if one exists, but clearly that would be extremely bad UX. On iOS, the library unfortunately does not use So basically unless this library switches to embedded |
@Livven The library has already switched to using |
@DaRosenberg @Livven |
Also, on the backlog we want to provide a good sign-out (which involves the service removing the cookie), and sign-out from device. |
Should be opt-in to participate in the shared cookie, and be able to log out and remove cookies for a specific tenant. Facilitate multiple directories and managing multiple identities across app. |
Duplicate of #425 |
Closing as dupe of #425 |
This appears to still be open as written in https://github.com/Azure-Samples/ms-identity-mobile-apple-swift-objc. |
Is there any solution to a "full" signout at this point? |
You application does a "full" signout by calling In some very specific circumstances (embedded browser on Windows when using .NET classic), there are "hacks" to clear the cookies from it. You can look them up online, as we don't encourage this. But generally, there is no way to clear cookies from browsers installed by users and this activity should be left to the user. For First Line Worker scenarios, where a device might be passed down from one worker to another at the end of shit, please try to use MSAL for Android / MSAL for iOS directly, as they support these scenarios. Is this your case? |
To be clear, I'm not looking for a hack. I am already clearing the cache using RemoveAccount. When I later invoke "AcquireTokenInteractive" the PublicClientApplication implemenation invokes an activity which redirects to the Azure sign on. Once there, despite the fact that I have cleared the token cache, Azure still "remembers" my password from a previous login. What I would expect is for Azure to force a prompt for a password at this point. I do this to clear the cache (as illustrated in the examples I've seen):
I do this prior to invoking AcquireTokenInteractive: AuthResult = await PCA.AcquireTokenInteractive(Scopes) What am I doing wrong (or NOT doing) that can force Azure to prompt for a password? (Once again: if I manually clear the browser cache, then I get a prompt - but this should NOT be necessary). Thanks for any insight. |
Yeah, as I said, MSAL libraries can't control the browser cache. You do have some level of control over the interactive experience when using prompts - for example to force the user to re-enter their password, you can do: AcquireTokenInteractive(scopes).WithPrompt(Prompt.ForceLogin); A better way to deal with requirement however would be via Conditional Access. You ask the tenant admin to require users to enter their passwords at least once every x hours / days. Details at https://docs.microsoft.com/en-us/azure/active-directory/conditional-access/howto-conditional-access-session-lifetime. From the developer perspective, when you call |
This is probably what I was looking for. Testing it now... Thank-you. |
Yup. I'll tell you... the docs on this stuff are VERY lean. I've been searching for "force login"... "force password prompt" and pouring over the MS docs for the past week (in between other tasks)... and found nothing. Who would search for "conditional access session lifetime"? LOL! At any rate. Thanks for your help! |
Ha ha, yes, there is too much information to put in the docs. Don't hesitate to log a bug / question on MSAL repo, we will try to help. |
Wouldn't it be more appropriate for a sign out request to actually use the browser to tell Azure AD that it intends to sign the current user out (with token), so that Azure AD can also remove any service-side data associated with the issued token (e.g. invalidate the token so that if it has already been compromised it can no longer be used)? The response/handshake that takes place in the browser would be able to remove cookies from whatever system/embedded browser was used to sign the user in too, without any hacky manual cookie manipulation on the client-side. We're migrating a mobile app right now that had sign out functionality built in previously when it was based around a custom identity broker which would delete the refresh token and such but the functionality doesn't appear to have an equivalent that we can map to during this migration to Azure AD without the broker. I know there's existing functionality in the Azure AD portal and Graph API to revoke refresh tokens, but it seems like it would be sensible to allow an application to intentionally request the refresh token that it acquired be revoked if it knows it should no longer be valid. EDIT: oops, didn't see this ticket was closed. Comment reposted at #1593 |
Please do correct me if I am wrong, but I have not been able to find any sign-out functionality in MSAL.
It would be useful to have something like a
PublicClientApplication.SignOut()
method to perform the following tasks:WKWebView
belonging to the tenant hostname, in our case login.microsoftonline.com (see here and of course the equivalent on other platformsIt might make sense to have two overloads:
PublicClientApplication.SignOut(IUser user)
to do this for a given cached IUserPublicClientApplication.SignOut()
to do it for allI'm not sure about the technical feasibility of the former; for our scenario the latter would be perfect because we are only supporting one signed-in user at a time.
The text was updated successfully, but these errors were encountered: