示例#1
0
 /// <summary>
 ///   Verifies the authentication.
 /// </summary>
 /// <param name="client"> The client. </param>
 /// <param name="provider"> The provider. </param>
 /// <param name="returnUrl"> The return URL. </param>
 /// <returns> </returns>
 public AuthenticationResult VerifyAuthentication(IAuthenticationClient client, IOpenAuthDataProvider provider,
                                                  string returnUrl)
 {
     var context = new HttpContextWrapper(HttpContext.Current);
     var securityManager = new OpenAuthSecurityManager(context, client, provider);
     return securityManager.VerifyAuthentication(returnUrl);
 }
		public static AuthenticationResult VerifyAuthentication()
		{
			var ms = new GoogleOAuth2Client(Configuration.OauthClientId, Configuration.OauthClientSecret);
			var manager = new OpenAuthSecurityManager(new HttpContextWrapper(HttpContext.Current), 
				ms, OAuthDataProvider.Instance);
			GoogleOAuth2Client.RewriteRequest();
			return manager.VerifyAuthentication(Configuration.OauthRedirect);
		}
示例#3
0
 internal static AuthResult VerifyAuthenticationCore(Kooboo.CMS.Membership.Models.Membership membership, HttpContextBase context, string returnUrl)
 {
     IAuthClient client;
     string providerName = OpenAuthSecurityManager.GetProviderName(context);
     if (string.IsNullOrEmpty(providerName))
     {
         return AuthResult.Failed;
     }
     client = GetAuthClient(membership, providerName);
     if (client == null)
     {
         throw new InvalidOperationException("Invalid membership connect.");
     }
     OpenAuthSecurityManager manager = new OpenAuthSecurityManager(context, client.GetOpenAuthClient(), new MembershipOpenAuthDataProvider());
     var result = manager.VerifyAuthentication(returnUrl);
     return new AuthResult(result);
 }
        internal static AuthenticationResult VerifyAuthenticationCore(HttpContextBase context, string returnUrl)
        {
            string providerName = OpenAuthSecurityManager.GetProviderName(context);
            if (String.IsNullOrEmpty(providerName))
            {
                return AuthenticationResult.Failed;
            }

            IAuthenticationClient client;
            if (TryGetOAuthClient(providerName, out client))
            {
                var securityManager = new OpenAuthSecurityManager(context, client, OAuthDataProvider);
                return securityManager.VerifyAuthentication(returnUrl);
            }
            else
            {
                throw new InvalidOperationException(WebResources.InvalidServiceProviderName);
            }
        }
		public static AuthenticationResult VerifyAuthentication()
		{
			var manager = new OpenAuthSecurityManager(new HttpContextWrapper(HttpContext.Current),
				ms, OAuthDataProvider.Instance);
			return manager.VerifyAuthentication(Configuration.GitHubOauthRedirect);
		}