コード例 #1
0
 public void HandleAuthorizationCode(QueryParameters responseCollection)
 {
     if (responseCollection.HasName("code"))
     {
         ConnectionToken.Code = responseCollection["code"];
         logger.Info("User successfully logged in and returned with Authorization code");
     }
     else if (responseCollection.ToList().Exists(x => x.Key.ToLower().Contains("denied") || x.Value.ToLower().Contains("denied")))
     {
         logger.Error(ErrorMessages.UserDeniedAccess(provider.ProviderType, responseCollection));
         throw new UserDeniedPermissionException(provider.ProviderType);
     }
     else
     {
         logger.Error(ErrorMessages.UserLoginResponseError(provider.ProviderType, responseCollection));
         throw new OAuthException(ErrorMessages.UserLoginResponseError(provider.ProviderType, responseCollection));
     }
 }
コード例 #2
0
 public void HandleUserReturnCallback(QueryParameters responseCollection)
 {
     if (responseCollection.HasName("oauth_verifier"))
     {
         ConnectionToken.OauthVerifier      = responseCollection["oauth_verifier"];
         ConnectionToken.AuthorizationToken = responseCollection["oauth_token"];
         logger.Info("User successfully logged in and returned");
     }
     else if (responseCollection.ToList().Exists(x => x.Key.ToLower().Contains("denied") || x.Value.ToLower().Contains("denied")))
     {
         logger.Error(ErrorMessages.UserDeniedAccess(ConnectionToken.Provider, responseCollection));
         throw new OAuthException(ErrorMessages.UserDeniedAccess(ConnectionToken.Provider, responseCollection));
     }
     else
     {
         logger.Error(ErrorMessages.UserLoginResponseError(provider.ProviderType, responseCollection));
         throw new OAuthException(ErrorMessages.UserLoginResponseError(provider.ProviderType, responseCollection));
     }
 }