Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

User management

Jean-Marc Prieur edited this page Feb 13, 2018 · 2 revisions

ADAL.NET does not expose directly the notion of user from an authentication context. It does provide a UserInfo, as we've seen as a property of the AuthenticationResult in ADAL.NET. image

If you don't have an AuthenticationResult, you can derive information about the users from the token cache by using the ReadItems() method, and selecting the properties of the token cache items related to users:

var users = authenticationContext.TokenCache
                                 .ReadItems()
                                 .Select(i => new { i.FamilyName, 
                                                    i.GivenName, 
                                                    i.DisplayableId, 
                                                    i.UniqueId }).Distinct();

To remove a user from the cache you can remove the TokenCacheItems which uniqueId has a given value, but this is not the end of the story as the Web View also keeps sign-in information about the user

Clone this wiki locally