/// <summary> /// Returns an authentication context using a token cache created from the current identity. Assumes that the identity /// is a <see cref="ClaimsIdentity"/> identity instance. /// </summary> public static AuthenticationContext CreateAuthenticationContext(this IIdentity identity) { var cache = new AdalTokenCache(identity.NameIdentifier()); AuthenticationContext authContext = new AuthenticationContext(identity.Authority(), cache); return(authContext); }