protected OAuthAuthenticationTemplateBase(
     IOAuthAuthorizerUI authorizerUI,
     IOAuthFacade <TCredentials> oauthFacade)
 {
     _authorizerUI = authorizerUI;
     _oauthFacade  = oauthFacade;
 }
 public OAuth2TokenAuthenticationTemplate(
     IOAuthAuthorizerUI authorizerUI,
     IOAuthFacade <OAuth2Credentials> oauthFacade) :
     base(
         authorizerUI,
         oauthFacade)
 {
 }
示例#3
0
 public OAuth2CodeAuthenticationTemplate(
     IOAuthAuthorizerUI authorizerUI,
     IOAuthFacade <OAuth2Credentials> oauthFacade,
     string clientSecret) :
     base(
         authorizerUI,
         oauthFacade)
 {
     _clientSecret = clientSecret;
 }
示例#4
0
        public IOAuthAuthenticationTemplate <OAuth2Credentials> BuildOAuth2Template <TResourceProvider>(
            IOAuthFacade <OAuth2Credentials> authentication,
            AuthenticationInterfaceEnum ui,
            string userId,
            string clientSecret,
            ResponseTypeEnum flow)
            where TResourceProvider : ResourceProvider
        {
            if (flow == ResponseTypeEnum.Code)
            {
                var callbackHandler = new OAuth2QueryCallbackHandler(
                    _strategy,
                    OAuth2ParameterEnum.State.EnumToString(),
                    userId);

                var authenticationUI = _oauthAuthorizerUIFactory
                                       .GetAuthorizer <TResourceProvider>(
                    ui,
                    callbackHandler);

                return(new OAuth2CodeAuthenticationTemplate(
                           authenticationUI,
                           authentication,
                           clientSecret));
            }
            else
            {
                IOAuthCallbackHandler callbackHandler = null;
                if (ui == AuthenticationInterfaceEnum.Dedicated)
                {
                    callbackHandler = new OAuth2QueryCallbackHandler(
                        _strategy,
                        OAuth2ParameterEnum.State.EnumToString(),
                        userId);
                }
                else
                {
                    callbackHandler = new OAuth2FragmentCallbackHandler(
                        _strategy,
                        OAuth2ParameterEnum.State.EnumToString(),
                        userId);
                }

                var authenticationUI = _oauthAuthorizerUIFactory
                                       .GetAuthorizer <TResourceProvider>(
                    ui,
                    callbackHandler);

                return(new OAuth2TokenAuthenticationTemplate(
                           authenticationUI,
                           authentication));
            }
        }
示例#5
0
 public OAuth1AuthenticationTemplate(
     IOAuthAuthorizerUI authorizerUI,
     IOAuthFacade <OAuth1Credentials> oauthFacade,
     IOAuthSecurityStrategy securityStrategy,
     string userId) :
     base(
         authorizerUI,
         oauthFacade)
 {
     _securityStrategy = securityStrategy;
     _userId           = userId;
 }
示例#6
0
        public IOAuthAuthenticationTemplate <OAuth1Credentials> BuildOAuth1Template <TResourceProvider>(
            IOAuthFacade <OAuth1Credentials> authentication,
            AuthenticationInterfaceEnum ui,
            string userId)
            where TResourceProvider : ResourceProvider
        {
            var handler = new OAuth1CallbackHandler(
                _strategy,
                OAuth1ParameterEnum.OAuthToken.EnumToString(),
                userId);

            var authenticationUI = _oauthAuthorizerUIFactory
                                   .GetAuthorizer <TResourceProvider>(ui, handler);

            return(new OAuth1AuthenticationTemplate(
                       authenticationUI,
                       authentication,
                       _strategy,
                       userId));
        }