コード例 #1
0
        public bool OAuthLogin(OAuthAccount account, bool remember)
        {
            AuthenticationClientData oauthProvider = _authenticationClients[account.Provider];
            HttpContextBase          context       = _applicationEnvironment.AcquireContext();
            var  securityManager = new OpenAuthSecurityManager(context, oauthProvider.AuthenticationClient, this);
            bool success         = securityManager.Login(account.ProviderUserId, remember);

            if (success)
            {
                return(true);
            }

            User user = GetUserByEmailAddress(account.Username);

            if (user == null)
            {
                return(false);
            }

            user.OAuthAccounts.Add(account);
            _userCollection.Save(user);

            return(securityManager.Login(account.ProviderUserId, remember));
        }
コード例 #2
0
 public static void RegisterClient(IAuthenticationClient client, string displayName, IDictionary<string, object> extraData)
 {
     var clientData = new AuthenticationClientData(client, displayName, extraData);
     _authenticationClients.Add(client.ProviderName, clientData);
 }
コード例 #3
0
        public static void RegisterClient(IAuthenticationClient client, string displayName, IDictionary <string, object> extraData)
        {
            var clientData = new AuthenticationClientData(client, displayName, extraData);

            _authenticationClients.Add(client.ProviderName, clientData);
        }
コード例 #4
0
        public void RequestOAuthAuthentication(string provider, string returnUrl)
        {
            AuthenticationClientData client = _authenticationClients[provider];

            _applicationEnvironment.RequestAuthentication(client.AuthenticationClient, this, returnUrl);
        }