public AuthenticationPrincipal GetPrincipal(string token, string authenticationType) { var principal = AuthenticationPrincipal.UnAuthenticatedPrincipal; lock (_instanceLocker) { if (IsAuthenticated(token)) { var authenticationSession = _authenticationSessionCache[token]; var authentication = (Authentication)authenticationSession.Authentication; var identity = new AuthenticationIdentity(authentication.Username, authenticationType, true); //var roles = RolesProvider.GetRoles(authentication.AccountOperatorId, authentication.AccountId); principal = new AuthenticationPrincipal(authentication, identity, new List <string>()); } } return(principal); }
static AuthenticationPrincipal() { UnAuthenticatedAuthentication = new Authentication(UnAuthenticatedId, UnAuthenticatedClientAccountId, UnAuthenticatedUsername, UnAuthenticatedToken); UnAuthenticationIdentity = new AuthenticationIdentity(UnAuthenticatedUsername, UnAuthenticatedAuthenticationType, false); UnAuthenticatedPrincipal = new AuthenticationPrincipal(UnAuthenticatedAuthentication, UnAuthenticationIdentity, new List <string>()); }