Exemple #1
0
        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);
            }
        }
        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));
        }
Exemple #3
0
        protected virtual AuthenticationResult OAuthVerifyAuthenticationCore(HttpContextBase context, string returnUrl)
        {
            string providerName = OpenAuthSecurityManager.GetProviderName(context);

            if (String.IsNullOrEmpty(providerName))
            {
                return(AuthenticationResult.Failed);
            }

            IAuthenticationClient client;

            if (_oAuthRegisteredClientCollection.TryGetOAuthClient(providerName, out client))
            {
                var securityManager = new OpenAuthSecurityManager(context, client, this);
                return(securityManager.VerifyAuthentication(returnUrl));
            }
            else
            {
                throw new InvalidOperationException("InvalidServiceProviderName");
            }
        }
        public string GetOAuthPoviderName()
        {
            var context = new HttpContextWrapper(HttpContext.Current);

            return(OpenAuthSecurityManager.GetProviderName(context));
        }