コード例 #1
0
 public AuthorizeResponseGenerator(ITokenService tokenService, IAuthorizationCodeStore authorizationCodes, IEventService events, OwinEnvironmentService owinEnvironmentService)
 {
     _tokenService       = tokenService;
     _authorizationCodes = authorizationCodes;
     _events             = events;
     _context            = new OwinContext(owinEnvironmentService.Environment);
 }
コード例 #2
0
        public static TokenRequestValidator CreateTokenValidator(
            CoreSettings settings = null,
            IScopeService scopes  = null,
            IAuthorizationCodeStore authorizationCodeStore = null,
            IUserService userService = null,
            IAssertionGrantValidator assertionGrantValidator = null,
            ICustomRequestValidator customRequestValidator   = null)
        {
            if (settings == null)
            {
                settings = new TestSettings();
            }

            if (scopes == null)
            {
                scopes = new InMemoryScopeService(TestScopes.Get());
            }

            if (userService == null)
            {
                userService = new TestUserService();
            }

            if (customRequestValidator == null)
            {
                customRequestValidator = new DefaultCustomRequestValidator();
            }

            if (assertionGrantValidator == null)
            {
                assertionGrantValidator = new TestAssertionValidator();
            }

            return(new TokenRequestValidator(settings, authorizationCodeStore, userService, scopes, assertionGrantValidator, customRequestValidator));
        }
コード例 #3
0
 public GetTokenViaImplicitWorkflowOperation(
     IClientStore clientStore,
     IConsentRepository consentRepository,
     IAuthorizationCodeStore authorizationCodeStore,
     ITokenStore tokenStore,
     IScopeRepository scopeRepository,
     IJwksStore jwksStore,
     IEventPublisher eventPublisher,
     ILogger logger)
 {
     _logger = logger;
     _processAuthorizationRequest = new ProcessAuthorizationRequest(
         clientStore,
         consentRepository,
         jwksStore,
         logger);
     _generateAuthorizationResponse = new GenerateAuthorizationResponse(
         authorizationCodeStore,
         tokenStore,
         scopeRepository,
         clientStore,
         consentRepository,
         jwksStore,
         eventPublisher,
         logger);
 }
コード例 #4
0
 public GetTokenByAuthorizationCodeGrantTypeAction(
     IClientValidator clientValidator,
     IAuthorizationCodeStore authorizationCodeStore,
     IConfigurationService configurationService,
     IGrantedTokenGeneratorHelper grantedTokenGeneratorHelper,
     IAuthenticateClient authenticateClient,
     IClientHelper clientHelper,
     ISimpleIdentityServerEventSource simpleIdentityServerEventSource,
     IAuthenticateInstructionGenerator authenticateInstructionGenerator,
     ITokenStore tokenStore,
     IGrantedTokenHelper grantedTokenHelper,
     IJwtGenerator jwtGenerator)
 {
     _clientValidator             = clientValidator;
     _authorizationCodeStore      = authorizationCodeStore;
     _configurationService        = configurationService;
     _grantedTokenGeneratorHelper = grantedTokenGeneratorHelper;
     _authenticateClient          = authenticateClient;
     _clientHelper = clientHelper;
     _simpleIdentityServerEventSource  = simpleIdentityServerEventSource;
     _authenticateInstructionGenerator = authenticateInstructionGenerator;
     _tokenStore         = tokenStore;
     _grantedTokenHelper = grantedTokenHelper;
     _jwtGenerator       = jwtGenerator;
 }
コード例 #5
0
 public TokenRequestValidator(
     IdentityServerOptions options,
     IIssuerNameService issuerNameService,
     IAuthorizationCodeStore authorizationCodeStore,
     IResourceOwnerPasswordValidator resourceOwnerValidator,
     IProfileService profile,
     IDeviceCodeValidator deviceCodeValidator,
     IBackchannelAuthenticationRequestIdValidator backchannelAuthenticationRequestIdValidator,
     ExtensionGrantValidator extensionGrantValidator,
     ICustomTokenRequestValidator customRequestValidator,
     IResourceValidator resourceValidator,
     IResourceStore resourceStore,
     IRefreshTokenService refreshTokenService,
     IEventService events,
     ISystemClock clock,
     ILogger <TokenRequestValidator> logger)
 {
     _logger                 = logger;
     _options                = options;
     _issuerNameService      = issuerNameService;
     _clock                  = clock;
     _authorizationCodeStore = authorizationCodeStore;
     _resourceOwnerValidator = resourceOwnerValidator;
     _profile                = profile;
     _deviceCodeValidator    = deviceCodeValidator;
     _backchannelAuthenticationRequestIdValidator = backchannelAuthenticationRequestIdValidator;
     _extensionGrantValidator = extensionGrantValidator;
     _customRequestValidator  = customRequestValidator;
     _resourceValidator       = resourceValidator;
     _resourceStore           = resourceStore;
     _refreshTokenService     = refreshTokenService;
     _events = events;
 }
コード例 #6
0
 public AuthorizeResponseGenerator(ILogger<AuthorizeResponseGenerator> logger, ITokenService tokenService, IAuthorizationCodeStore authorizationCodes, IEventService events)
 {
     _logger = logger;
     _tokenService = tokenService;
     _authorizationCodes = authorizationCodes;
     _events = events;
 }
コード例 #7
0
        public static TokenRequestValidator CreateTokenValidator(
            CoreSettings settings = null,
            IScopeService scopes = null,
            IAuthorizationCodeStore authorizationCodeStore = null,
            IUserService userService = null,
            IAssertionGrantValidator assertionGrantValidator = null,
            ICustomRequestValidator customRequestValidator = null)
        {
            if (settings == null)
            {
                settings = new TestSettings();
            }

            if (scopes == null)
            {
                scopes = new InMemoryScopeService(TestScopes.Get());
            }

            if (userService == null)
            {
                userService = new TestUserService();
            }

            if (customRequestValidator == null)
            {
                customRequestValidator = new DefaultCustomRequestValidator();
            }

            if (assertionGrantValidator == null)
            {
                assertionGrantValidator = new TestAssertionValidator();
            }

            return new TokenRequestValidator(settings, authorizationCodeStore, userService, scopes, assertionGrantValidator, customRequestValidator);
        }
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, ITokenHandleStore tokenHandles, CoreSettings settings, IAuthorizationCodeStore codes)
 {
     _settings = settings;
     _tokenService = tokenService;
     _refreshTokenService = refreshTokenService;
     _tokenHandles = tokenHandles;
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TokenRequestValidator" /> class.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="authorizationCodeStore">The authorization code store.</param>
 /// <param name="resourceOwnerValidator">The resource owner validator.</param>
 /// <param name="profile">The profile.</param>
 /// <param name="deviceCodeValidator">The device code validator.</param>
 /// <param name="extensionGrantValidator">The extension grant validator.</param>
 /// <param name="customRequestValidator">The custom request validator.</param>
 /// <param name="resourceValidator">The resource validator.</param>
 /// <param name="resourceStore">The resource store.</param>
 /// <param name="tokenValidator">The token validator.</param>
 /// <param name="events">The events.</param>
 /// <param name="clock">The clock.</param>
 /// <param name="logger">The logger.</param>
 public TokenRequestValidator(IdentityServerOptions options,
                              IAuthorizationCodeStore authorizationCodeStore,
                              IResourceOwnerPasswordValidator resourceOwnerValidator,
                              IProfileService profile,
                              IDeviceCodeValidator deviceCodeValidator,
                              ExtensionGrantValidator extensionGrantValidator,
                              ICustomTokenRequestValidator customRequestValidator,
                              IResourceValidator resourceValidator,
                              IResourceStore resourceStore,
                              ITokenValidator tokenValidator,
                              IEventService events,
                              ISystemClock clock,
                              ILogger <TokenRequestValidator> logger)
 {
     _logger  = logger;
     _options = options;
     _clock   = clock;
     _authorizationCodeStore = authorizationCodeStore;
     _resourceOwnerValidator = resourceOwnerValidator;
     _profile                 = profile;
     _deviceCodeValidator     = deviceCodeValidator;
     _extensionGrantValidator = extensionGrantValidator;
     _customRequestValidator  = customRequestValidator;
     _resourceValidator       = resourceValidator;
     _resourceStore           = resourceStore;
     _tokenValidator          = tokenValidator;
     _events = events;
 }
 public AuthorizeResponseGenerator(ITokenService tokenService, IAuthorizationCodeStore authorizationCodes, ITokenHandleStore tokenHandles, ICoreSettings settings)
 {
     _tokenService = tokenService;
     _authorizationCodes = authorizationCodes;
     _tokenHandles = tokenHandles;
     _settings = settings;
 }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TokenRequestValidator" /> class.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="authorizationCodeStore">The authorization code store.</param>
 /// <param name="resourceOwnerValidator">The resource owner validator.</param>
 /// <param name="profile">The profile.</param>
 /// <param name="deviceCodeValidator">The device code validator.</param>
 /// <param name="extensionGrantValidator">The extension grant validator.</param>
 /// <param name="customRequestValidator">The custom request validator.</param>
 /// <param name="resourceValidator">The resource validator.</param>
 /// <param name="resourceStore">The resource store.</param>
 /// <param name="refreshTokenService"></param>
 /// <param name="events">The events.</param>
 /// <param name="clock">The clock.</param>
 /// <param name="logger">The logger.</param>
 public TokenRequestValidator(IdentityServerOptions options,
                              IAuthorizationCodeStore authorizationCodeStore,
                              IResourceOwnerPasswordValidator resourceOwnerValidator,
                              IProfileService profile,
                              IDeviceCodeValidator deviceCodeValidator,
                              ExtensionGrantValidator extensionGrantValidator,
                              ICustomTokenRequestValidator customRequestValidator,
                              IResourceValidator resourceValidator,
                              IResourceStore resourceStore,
                              IRefreshTokenService refreshTokenService,
                              IEventService events,
                              ISystemClock clock,
                              ILogger <TokenRequestValidator> logger)
 {
     _logger  = logger;
     _options = options;
     _clock   = clock;
     _authorizationCodeStore = authorizationCodeStore;
     _resourceOwnerValidator = resourceOwnerValidator;
     _profile                 = profile ?? throw new ArgumentNullException(nameof(profile));
     _deviceCodeValidator     = deviceCodeValidator;
     _extensionGrantValidator = extensionGrantValidator;
     _customRequestValidator  = customRequestValidator;
     _resourceValidator       = resourceValidator;
     _resourceStore           = resourceStore;
     _events = events ?? throw new ArgumentNullException(nameof(events));
     _refreshTokenService = refreshTokenService ?? throw new ArgumentNullException(nameof(refreshTokenService));
 }
コード例 #12
0
 public GenerateAuthorizationResponse(
     IAuthorizationCodeStore authorizationCodeStore,
     ITokenStore tokenStore,
     IParameterParserHelper parameterParserHelper,
     IJwtGenerator jwtGenerator,
     IGrantedTokenGeneratorHelper grantedTokenGeneratorHelper,
     IConsentHelper consentHelper,
     IOAuthEventSource oauthEventSource,
     IAuthorizationFlowHelper authorizationFlowHelper,
     IClientHelper clientHelper,
     IGrantedTokenHelper grantedTokenHelper,
     IResourceOwnerRepository resourceOwnerRepository)
 {
     _authorizationCodeStore      = authorizationCodeStore;
     _tokenStore                  = tokenStore;
     _parameterParserHelper       = parameterParserHelper;
     _jwtGenerator                = jwtGenerator;
     _grantedTokenGeneratorHelper = grantedTokenGeneratorHelper;
     _consentHelper               = consentHelper;
     _oauthEventSource            = oauthEventSource;
     _authorizationFlowHelper     = authorizationFlowHelper;
     _clientHelper                = clientHelper;
     _grantedTokenHelper          = grantedTokenHelper;
     _resourceOwnerRepository     = resourceOwnerRepository;
 }
コード例 #13
0
 public AuthorizeResponseGenerator(ITokenService tokenService, IAuthorizationCodeStore authorizationCodes, ITokenHandleStore tokenHandles, CoreSettings settings)
 {
     _tokenService       = tokenService;
     _authorizationCodes = authorizationCodes;
     _tokenHandles       = tokenHandles;
     _settings           = settings;
 }
コード例 #14
0
ファイル: Factory.cs プロジェクト: henryng24/IdentityServer3
        //public static ClientValidator CreateClientValidator(
        //    IClientStore clients = null,
        //    IClientSecretValidator secretValidator = null)
        //{
        //    if (clients == null)
        //    {
        //        clients = new InMemoryClientStore(ClientValidationTestClients.Get());
        //    }

        //    if (secretValidator == null)
        //    {
        //        secretValidator = new HashedClientSecretValidator();
        //    }

        //    var owin = new OwinEnvironmentService(new OwinContext());

        //    return new ClientValidator(clients, secretValidator, owin);
        //}

        public static TokenRequestValidator CreateTokenRequestValidator(
            IdentityServerOptions options = null,
            IScopeStore scopes = null,
            IAuthorizationCodeStore authorizationCodeStore = null,
            IRefreshTokenStore refreshTokens = null,
            IUserService userService = null,
            IEnumerable<ICustomGrantValidator> customGrantValidators = null,
            ICustomRequestValidator customRequestValidator = null,
            ScopeValidator scopeValidator = null)
        {
            if (options == null)
            {
                options = TestIdentityServerOptions.Create();
            }

            if (scopes == null)
            {
                scopes = new InMemoryScopeStore(TestScopes.Get());
            }

            if (userService == null)
            {
                userService = new TestUserService();
            }

            if (customRequestValidator == null)
            {
                customRequestValidator = new DefaultCustomRequestValidator();
            }

            CustomGrantValidator aggregateCustomValidator;
            if (customGrantValidators == null)
            {
                aggregateCustomValidator = new CustomGrantValidator(new [] { new TestGrantValidator() });
            }
            else
            {
                aggregateCustomValidator = new CustomGrantValidator(customGrantValidators);
            }
                
            if (refreshTokens == null)
            {
                refreshTokens = new InMemoryRefreshTokenStore();
            }

            if (scopeValidator == null)
            {
                scopeValidator = new ScopeValidator(scopes);
            }

            return new TokenRequestValidator(
                options, 
                authorizationCodeStore, 
                refreshTokens, 
                userService, 
                aggregateCustomValidator, 
                customRequestValidator, 
                scopeValidator, 
                new DefaultEventService());
        }
コード例 #15
0
        public static TokenRequestValidator CreateTokenRequestValidator(
            IdentityServerOptions options = null,
            IScopeStore scopes            = null,
            IAuthorizationCodeStore authorizationCodeStore = null,
            IRefreshTokenStore refreshTokens               = null,
            IUserService userService                       = null,
            ICustomGrantValidator customGrantValidator     = null,
            ICustomRequestValidator customRequestValidator = null,
            ScopeValidator scopeValidator                  = null,
            IDictionary <string, object> environment       = null)
        {
            if (options == null)
            {
                options = TestIdentityServerOptions.Create();
            }

            if (scopes == null)
            {
                scopes = new InMemoryScopeStore(TestScopes.Get());
            }

            if (userService == null)
            {
                userService = new TestUserService();
            }

            if (customRequestValidator == null)
            {
                customRequestValidator = new DefaultCustomRequestValidator();
            }

            if (customGrantValidator == null)
            {
                customGrantValidator = new TestGrantValidator();
            }

            if (refreshTokens == null)
            {
                refreshTokens = new InMemoryRefreshTokenStore();
            }

            if (scopeValidator == null)
            {
                scopeValidator = new ScopeValidator(scopes);
            }

            IOwinContext context;

            if (environment == null)
            {
                context = new OwinContext(new Dictionary <string, object>());
            }
            else
            {
                context = new OwinContext(environment);
            }


            return(new TokenRequestValidator(options, authorizationCodeStore, refreshTokens, userService, scopes, customGrantValidator, customRequestValidator, scopeValidator, context));
        }
 public AuthorizeResponseGenerator(ILogger <AuthorizeResponseGenerator> logger, ITokenService tokenService, IAuthorizationCodeStore authorizationCodeStore, IEventService events)
 {
     _logger                 = logger;
     _tokenService           = tokenService;
     _authorizationCodeStore = authorizationCodeStore;
     _events                 = events;
 }
コード例 #17
0
        public static TokenRequestValidator CreateTokenRequestValidator(
            IdentityServerOptions options = null,
            IScopeStore scopes = null,
            IAuthorizationCodeStore authorizationCodeStore = null,
            IRefreshTokenStore refreshTokens = null,
            IUserService userService = null,
            ICustomGrantValidator customGrantValidator = null,
            ICustomRequestValidator customRequestValidator = null,
            ScopeValidator scopeValidator = null,
            IDictionary<string, object> environment = null)
        {
            if (options == null)
            {
                options = TestIdentityServerOptions.Create();
            }

            if (scopes == null)
            {
                scopes = new InMemoryScopeStore(TestScopes.Get());
            }

            if (userService == null)
            {
                userService = new TestUserService();
            }

            if (customRequestValidator == null)
            {
                customRequestValidator = new DefaultCustomRequestValidator();
            }

            if (customGrantValidator == null)
            {
                customGrantValidator = new TestGrantValidator();
            }

            if (refreshTokens == null)
            {
                refreshTokens = new InMemoryRefreshTokenStore();
            }

            if (scopeValidator == null)
            {
                scopeValidator = new ScopeValidator(scopes);
            }

            IOwinContext context;
            if (environment == null)
            {
                context = new OwinContext(new Dictionary<string, object>());
            }
            else
            {
                context = new OwinContext(environment);
            }


            return new TokenRequestValidator(options, authorizationCodeStore, refreshTokens, userService, scopes, customGrantValidator, customRequestValidator, scopeValidator, context);
        }
コード例 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthorizeResponseGenerator"/> class.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="tokenService">The token service.</param>
 /// <param name="authorizationCodeStore">The authorization code store.</param>
 /// <param name="events">The events.</param>
 public AuthorizeResponseGenerator(IdentityServerOptions options, ITokenService tokenService, IAuthorizationCodeStore authorizationCodeStore, ILogger <AuthorizeResponseGenerator> logger, IEventService events)
 {
     Options                = options;
     TokenService           = tokenService;
     AuthorizationCodeStore = authorizationCodeStore;
     Events = events;
     Logger = logger;
 }
コード例 #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthorizeResponseGenerator"/> class.
 /// </summary>
 /// <param name="clock">The clock.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="tokenService">The token service.</param>
 /// <param name="authorizationCodeStore">The authorization code store.</param>
 /// <param name="events">The events.</param>
 public AuthorizeResponseGenerator(ISystemClock clock, ITokenService tokenService, IAuthorizationCodeStore authorizationCodeStore, ILogger <AuthorizeResponseGenerator> logger, IEventService events)
 {
     Clock                  = clock;
     TokenService           = tokenService;
     AuthorizationCodeStore = authorizationCodeStore;
     Events                 = events;
     Logger                 = logger;
 }
コード例 #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthenticateController"/> class.
        /// </summary>
        /// <param name="dataProtectionProvider">The data protection provider.</param>
        /// <param name="urlHelperFactory">The URL helper factory.</param>
        /// <param name="actionContextAccessor">The action context accessor.</param>
        /// <param name="eventPublisher">The event publisher.</param>
        /// <param name="authenticationService">The authentication service.</param>
        /// <param name="authenticationSchemeProvider">The authentication scheme provider.</param>
        /// <param name="resourceOwnerServices">The resource owner services.</param>
        /// <param name="twoFactorAuthenticationHandler">The two factor authentication handler.</param>
        /// <param name="subjectBuilder">The subject builder.</param>
        /// <param name="authorizationCodeStore">The authorization code store.</param>
        /// <param name="scopeRepository">The scope repository.</param>
        /// <param name="tokenStore">The token store.</param>
        /// <param name="consentRepository">The consent repository.</param>
        /// <param name="confirmationCodeStore">The confirmation code store.</param>
        /// <param name="clientStore">The client store.</param>
        /// <param name="resourceOwnerRepository">The resource owner repository.</param>
        /// <param name="jwksStore"></param>
        /// <param name="accountFilters">The account filters.</param>
        /// <param name="logger">The controller logger.</param>
        /// <param name="runtimeSettings">The runtime settings.</param>
        public AuthenticateController(
            IDataProtectionProvider dataProtectionProvider,
            IUrlHelperFactory urlHelperFactory,
            IActionContextAccessor actionContextAccessor,
            IEventPublisher eventPublisher,
            IAuthenticationService authenticationService,
            IAuthenticationSchemeProvider authenticationSchemeProvider,
            IEnumerable <IAuthenticateResourceOwnerService> resourceOwnerServices,
            ITwoFactorAuthenticationHandler twoFactorAuthenticationHandler,
            ISubjectBuilder subjectBuilder,
            IAuthorizationCodeStore authorizationCodeStore,
            IScopeRepository scopeRepository,
            ITokenStore tokenStore,
            IConsentRepository consentRepository,
            IConfirmationCodeStore confirmationCodeStore,
            IClientStore clientStore,
            IResourceOwnerRepository resourceOwnerRepository,
            IJwksStore jwksStore,
            IEnumerable <AccountFilter> accountFilters,
            ILogger <AuthenticateController> logger,
            RuntimeSettings runtimeSettings)
            : base(
                dataProtectionProvider,
                urlHelperFactory,
                actionContextAccessor,
                eventPublisher,
                authenticationService,
                authenticationSchemeProvider,
                twoFactorAuthenticationHandler,
                authorizationCodeStore,
                consentRepository,
                scopeRepository,
                tokenStore,
                resourceOwnerRepository,
                confirmationCodeStore,
                clientStore,
                jwksStore,
                subjectBuilder,
                accountFilters,
                logger,
                runtimeSettings)
        {
            _eventPublisher = eventPublisher;
            _logger         = logger;
            var services = resourceOwnerServices.ToArray();

            _resourceOwnerServices     = services;
            _localOpenIdAuthentication = new LocalOpenIdUserAuthenticationAction(
                authorizationCodeStore,
                services,
                consentRepository,
                tokenStore,
                scopeRepository,
                clientStore,
                jwksStore,
                eventPublisher,
                logger);
        }
コード例 #21
0
 public TokenRequestValidator(CoreSettings settings, IAuthorizationCodeStore authorizationCodes, IUserService users, IScopeService scopes, IAssertionGrantValidator assertionValidator, ICustomRequestValidator customRequestValidator)
 {
     _settings           = settings;
     _authorizationCodes = authorizationCodes;
     _users                  = users;
     _scopes                 = scopes;
     _assertionValidator     = assertionValidator;
     _customRequestValidator = customRequestValidator;
 }
 public CleanUpAuthorizationCodes(PowershellAdminModuleFixture data)
 {
     _data     = data;
     _ps       = data.PowerShell;
     _script   = data.LoadScript(this);
     _database = data.Database;
     _ps.AddScript(_script).AddParameter("Database", _database);
     _acStore = data.Factory.Resolve <IAuthorizationCodeStore>();
 }
コード例 #23
0
 public TokenRequestValidator(ICoreSettings settings, ILogger logger, IAuthorizationCodeStore authorizationCodes, IUserService users, IAssertionGrantValidator assertionValidator, ICustomRequestValidator customRequestValidator)
 {
     _settings = settings;
     _logger = logger;
     _authorizationCodes = authorizationCodes;
     _users = users;
     _assertionValidator = assertionValidator;
     _customRequestValidator = customRequestValidator;
 }
コード例 #24
0
 public TokenRequestValidator(IdentityServerOptions options, IAuthorizationCodeStore authorizationCodes, IRefreshTokenStore refreshTokens, IUserService users, IScopeStore scopes, IAssertionGrantValidator assertionValidator, ICustomRequestValidator customRequestValidator)
 {
     _options            = options;
     _authorizationCodes = authorizationCodes;
     _refreshTokens      = refreshTokens;
     _users                  = users;
     _scopes                 = scopes;
     _assertionValidator     = assertionValidator;
     _customRequestValidator = customRequestValidator;
 }
コード例 #25
0
 public static TokenRequestValidator CreateTokenValidator(
     ICoreSettings settings,
     ILogger logger,
     IAuthorizationCodeStore authorizationCodeStore = null,
     IUserService userService = null,
     IAssertionGrantValidator assertionGrantValidator = null,
     ICustomRequestValidator customRequestValidator = null)
 {
     return new TokenRequestValidator(settings, logger, authorizationCodeStore, userService, assertionGrantValidator, customRequestValidator);
 }
 public TokenRequestValidator(IdentityServerOptions options, IAuthorizationCodeStore authorizationCodes, IRefreshTokenStore refreshTokens, IUserService users, IScopeStore scopes, IAssertionGrantValidator assertionValidator, ICustomRequestValidator customRequestValidator)
 {
     _options = options;
     _authorizationCodes = authorizationCodes;
     _refreshTokens = refreshTokens;
     _users = users;
     _scopes = scopes;
     _assertionValidator = assertionValidator;
     _customRequestValidator = customRequestValidator;
 }
 public static TokenRequestValidator CreateTokenValidator(
     ICoreSettings settings,
     ILogger logger,
     IAuthorizationCodeStore authorizationCodeStore = null,
     IUserService userService = null,
     IAssertionGrantValidator assertionGrantValidator = null,
     ICustomRequestValidator customRequestValidator   = null)
 {
     return(new TokenRequestValidator(settings, logger, authorizationCodeStore, userService, assertionGrantValidator, customRequestValidator));
 }
 public TokenRequestValidator(CoreSettings settings, IAuthorizationCodeStore authorizationCodes, IRefreshTokenStore refreshTokens, IUserService users, IScopeService scopes, IAssertionGrantValidator assertionValidator, ICustomRequestValidator customRequestValidator)
 {
     _settings = settings;
     _authorizationCodes = authorizationCodes;
     _refreshTokens = refreshTokens;
     _users = users;
     _scopes = scopes;
     _assertionValidator = assertionValidator;
     _customRequestValidator = customRequestValidator;
 }
コード例 #29
0
        public static TokenRequestValidator CreateTokenRequestValidator(
            IdentityServerOptions options = null,
            IScopeStore scopes            = null,
            IAuthorizationCodeStore authorizationCodeStore = null,
            IRefreshTokenStore refreshTokens               = null,
            IUserService userService                       = null,
            ICustomGrantValidator customGrantValidator     = null,
            ICustomRequestValidator customRequestValidator = null,
            ScopeValidator scopeValidator                  = null)
        {
            if (options == null)
            {
                options = TestIdentityServerOptions.Create();
            }

            if (scopes == null)
            {
                scopes = new InMemoryScopeStore(TestScopes.Get());
            }

            if (userService == null)
            {
                userService = new TestUserService();
            }

            if (customRequestValidator == null)
            {
                customRequestValidator = new DefaultCustomRequestValidator();
            }

            if (customGrantValidator == null)
            {
                customGrantValidator = new TestGrantValidator();
            }

            if (refreshTokens == null)
            {
                refreshTokens = new InMemoryRefreshTokenStore();
            }

            if (scopeValidator == null)
            {
                scopeValidator = new ScopeValidator(scopes);
            }

            return(new TokenRequestValidator(
                       options,
                       authorizationCodeStore,
                       refreshTokens,
                       userService,
                       customGrantValidator,
                       customRequestValidator,
                       scopeValidator,
                       new DefaultEventService()));
        }
 public TokenRequestValidator(IdentityServerOptions options, IAuthorizationCodeStore authorizationCodes, IRefreshTokenStore refreshTokens, IUserService users, IScopeStore scopes, ICustomGrantValidator customGrantValidator, ICustomRequestValidator customRequestValidator, IOwinContext context)
 {
     _options            = options;
     _authorizationCodes = authorizationCodes;
     _refreshTokens      = refreshTokens;
     _users  = users;
     _scopes = scopes;
     _customGrantValidator   = customGrantValidator;
     _customRequestValidator = customRequestValidator;
     _environment            = context.Environment;
 }
コード例 #31
0
        public TokenRequestValidator(CoreSettings settings, IAuthorizationCodeStore authorizationCodes, IUserService users, IScopeService scopes, IAssertionGrantValidator assertionValidator, ICustomRequestValidator customRequestValidator)
        {
            _logger = LogProvider.GetCurrentClassLogger();

            _settings           = settings;
            _authorizationCodes = authorizationCodes;
            _users                  = users;
            _scopes                 = scopes;
            _assertionValidator     = assertionValidator;
            _customRequestValidator = customRequestValidator;
        }
コード例 #32
0
 public TokenRequestValidator(IdentityServerOptions options, IAuthorizationCodeStore authorizationCodes, IRefreshTokenStore refreshTokens, IUserService users, ICustomGrantValidator customGrantValidator, ICustomRequestValidator customRequestValidator, ScopeValidator scopeValidator, IEventService events)
 {
     _options            = options;
     _authorizationCodes = authorizationCodes;
     _refreshTokens      = refreshTokens;
     _users = users;
     _customGrantValidator   = customGrantValidator;
     _customRequestValidator = customRequestValidator;
     _scopeValidator         = scopeValidator;
     _events = events;
 }
コード例 #33
0
 public TokenRequestValidator(IdentityServerOptions options, IAuthorizationCodeStore authorizationCodes, IRefreshTokenStore refreshTokens, IUserService users, CustomGrantValidator customGrantValidator, ICustomRequestValidator customRequestValidator, ScopeValidator scopeValidator, IEventService events)
 {
     _options = options;
     _authorizationCodes = authorizationCodes;
     _refreshTokens = refreshTokens;
     _users = users;
     _customGrantValidator = customGrantValidator;
     _customRequestValidator = customRequestValidator;
     _scopeValidator = scopeValidator;
     _events = events;
 }
 public TokenRequestValidator(IdentityServerOptions options, IAuthorizationCodeStore authorizationCodes, IRefreshTokenStore refreshTokens, IUserService users, IScopeStore scopes, ICustomGrantValidator customGrantValidator, ICustomRequestValidator customRequestValidator, ScopeValidator scopeValidator, IOwinContext context)
 {
     _options = options;
     _authorizationCodes = authorizationCodes;
     _refreshTokens = refreshTokens;
     _users = users;
     _scopes = scopes;
     _customGrantValidator = customGrantValidator;
     _customRequestValidator = customRequestValidator;
     _scopeValidator = scopeValidator;
     _environment = context.Environment;
 }
コード例 #35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TokenRequestValidator"/> class.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="authorizationCodeStore">The authorization code store.</param>
 /// <param name="refreshTokenStore">The refresh token store.</param>
 /// <param name="resourceOwnerValidator">The resource owner validator.</param>
 /// <param name="profile">The profile.</param>
 /// <param name="extensionGrantValidator">The extension grant validator.</param>
 /// <param name="customRequestValidator">The custom request validator.</param>
 /// <param name="scopeValidator">The scope validator.</param>
 /// <param name="events">The events.</param>
 /// <param name="logger">The logger.</param>
 public TokenRequestValidator(IdentityServerOptions options, IAuthorizationCodeStore authorizationCodeStore, IRefreshTokenStore refreshTokenStore, IResourceOwnerPasswordValidator resourceOwnerValidator, IProfileService profile, ExtensionGrantValidator extensionGrantValidator, ICustomTokenRequestValidator customRequestValidator, ScopeValidator scopeValidator, IEventService events, ILogger <TokenRequestValidator> logger)
 {
     _logger  = logger;
     _options = options;
     _authorizationCodeStore = authorizationCodeStore;
     _refreshTokenStore      = refreshTokenStore;
     _resourceOwnerValidator = resourceOwnerValidator;
     _profile = profile;
     _extensionGrantValidator = extensionGrantValidator;
     _customRequestValidator  = customRequestValidator;
     _scopeValidator          = scopeValidator;
     _events = events;
 }
コード例 #36
0
        public TokenRequestValidator(IdentityServerOptions options, IAuthorizationCodeStore authorizationCodes, IRefreshTokenStore refreshTokens, IResourceOwnerPasswordValidator resourceOwnerValidator, IProfileService profile, CustomGrantValidator customGrantValidator, ICustomRequestValidator customRequestValidator, ScopeValidator scopeValidator, IEventService events, ILoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger<TokenRequestValidator>();

            _options = options;
            _authorizationCodes = authorizationCodes;
            _refreshTokens = refreshTokens;
            _resourceOwnerValidator = resourceOwnerValidator;
            _profile = profile;
            _customGrantValidator = customGrantValidator;
            _customRequestValidator = customRequestValidator;
            _scopeValidator = scopeValidator;
            _events = events;
        }
コード例 #37
0
        public TokenRequestValidator(IdentityServerOptions options, IAuthorizationCodeStore authorizationCodes, IRefreshTokenStore refreshTokens, IResourceOwnerPasswordValidator resourceOwnerValidator, IProfileService profile, CustomGrantValidator customGrantValidator, ICustomRequestValidator customRequestValidator, ScopeValidator scopeValidator, IEventService events, ILoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger <TokenRequestValidator>();

            _options                = options;
            _authorizationCodes     = authorizationCodes;
            _refreshTokens          = refreshTokens;
            _resourceOwnerValidator = resourceOwnerValidator;
            _profile                = profile;
            _customGrantValidator   = customGrantValidator;
            _customRequestValidator = customRequestValidator;
            _scopeValidator         = scopeValidator;
            _events = events;
        }
コード例 #38
0
 public GetTokenByAuthorizationCodeGrantTypeAction(
     IAuthorizationCodeStore authorizationCodeStore,
     RuntimeSettings configurationService,
     IClientStore clientStore,
     IEventPublisher eventPublisher,
     ITokenStore tokenStore,
     IJwksStore jwksStore)
 {
     _authorizationCodeStore = authorizationCodeStore;
     _configurationService   = configurationService;
     _authenticateClient     = new AuthenticateClient(clientStore, jwksStore);
     _eventPublisher         = eventPublisher;
     _tokenStore             = tokenStore;
     _jwksStore = jwksStore;
 }
コード例 #39
0
 public DefaultPersistedGrantStoreTests()
 {
     _codes = new DefaultAuthorizationCodeStore(_store,
                                                new PersistentGrantSerializer(),
                                                TestLogger.Create <DefaultAuthorizationCodeStore>());
     _refreshTokens = new DefaultRefreshTokenStore(_store,
                                                   new PersistentGrantSerializer(),
                                                   TestLogger.Create <DefaultRefreshTokenStore>());
     _referenceTokens = new DefaultReferenceTokenStore(_store,
                                                       new PersistentGrantSerializer(),
                                                       TestLogger.Create <DefaultReferenceTokenStore>());
     _userConsent = new DefaultUserConsentStore(_store,
                                                new PersistentGrantSerializer(),
                                                TestLogger.Create <DefaultUserConsentStore>());
 }
コード例 #40
0
ファイル: TokenActions.cs プロジェクト: jjrdk/SimpleAuth
 public TokenActions(
     RuntimeSettings simpleAuthOptions,
     IAuthorizationCodeStore authorizationCodeStore,
     IClientStore clientStore,
     IScopeStore scopeRepository,
     IJwksStore jwksStore,
     IResourceOwnerRepository resourceOwnerRepository,
     IEnumerable <IAuthenticateResourceOwnerService> resourceOwnerServices,
     IEventPublisher eventPublisher,
     ITokenStore tokenStore,
     IDeviceAuthorizationStore deviceAuthorizationStore,
     ILogger logger)
 {
     _getTokenByDeviceAuthorizationTypeAction = new GetTokenByDeviceAuthorizationTypeAction(
         deviceAuthorizationStore,
         tokenStore,
         jwksStore,
         clientStore,
         eventPublisher,
         logger);
     _getTokenByResourceOwnerCredentialsGrantType = new GetTokenByResourceOwnerCredentialsGrantTypeAction(
         clientStore,
         scopeRepository,
         tokenStore,
         jwksStore,
         resourceOwnerServices,
         eventPublisher,
         logger);
     _getTokenByAuthorizationCodeGrantTypeAction = new GetTokenByAuthorizationCodeGrantTypeAction(
         authorizationCodeStore,
         simpleAuthOptions,
         clientStore,
         eventPublisher,
         tokenStore,
         jwksStore);
     _getTokenByRefreshTokenGrantTypeAction = new GetTokenByRefreshTokenGrantTypeAction(
         eventPublisher,
         tokenStore,
         jwksStore,
         resourceOwnerRepository,
         clientStore);
     _authenticateClient = new AuthenticateClient(clientStore, jwksStore);
     _revokeTokenAction  = new RevokeTokenAction(clientStore, tokenStore, jwksStore, logger);
     _jwksStore          = jwksStore;
     _eventPublisher     = eventPublisher;
     _tokenStore         = tokenStore;
 }
コード例 #41
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthorizeResponseGenerator"/> class.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="clock">The clock.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="tokenService">The token service.</param>
 /// <param name="keyMaterialService"></param>
 /// <param name="authorizationCodeStore">The authorization code store.</param>
 /// <param name="events">The events.</param>
 public AuthorizeResponseGenerator(
     IdentityServerOptions options,
     ISystemClock clock,
     ITokenService tokenService,
     IKeyMaterialService keyMaterialService,
     IAuthorizationCodeStore authorizationCodeStore,
     ILogger <AuthorizeResponseGenerator> logger,
     IEventService events)
 {
     Options                = options;
     Clock                  = clock;
     TokenService           = tokenService;
     KeyMaterialService     = keyMaterialService;
     AuthorizationCodeStore = authorizationCodeStore;
     Events                 = events;
     Logger                 = logger;
 }
コード例 #42
0
 public AuthorizationActions(
     IAuthorizationCodeStore authorizationCodeStore,
     IClientStore clientStore,
     ITokenStore tokenStore,
     IScopeRepository scopeRepository,
     IConsentRepository consentRepository,
     IJwksStore jwksStore,
     IEventPublisher eventPublisher,
     IEnumerable <IAuthenticateResourceOwnerService> resourceOwnerServices,
     ILogger logger)
 {
     _getAuthorizationCodeOperation = new GetAuthorizationCodeOperation(
         authorizationCodeStore,
         tokenStore,
         scopeRepository,
         clientStore,
         consentRepository,
         jwksStore,
         eventPublisher,
         logger);
     _getTokenViaImplicitWorkflowOperation = new GetTokenViaImplicitWorkflowOperation(
         clientStore,
         consentRepository,
         authorizationCodeStore,
         tokenStore,
         scopeRepository,
         jwksStore,
         eventPublisher,
         logger);
     _getAuthorizationCodeAndTokenViaHybridWorkflowOperation =
         new GetAuthorizationCodeAndTokenViaHybridWorkflowOperation(
             clientStore,
             consentRepository,
             authorizationCodeStore,
             tokenStore,
             scopeRepository,
             jwksStore,
             eventPublisher,
             logger);
     _authorizationCodeGrantTypeParameterValidator =
         new AuthorizationCodeGrantTypeParameterAuthEdpValidator(clientStore, logger);
     _eventPublisher        = eventPublisher;
     _logger                = logger;
     _resourceOwnerServices = resourceOwnerServices.ToArray();
 }
コード例 #43
0
 public GenerateAuthorizationResponse(
     IAuthorizationCodeStore authorizationCodeStore,
     ITokenStore tokenStore,
     IScopeRepository scopeRepository,
     IClientStore clientStore,
     IConsentRepository consentRepository,
     IJwksStore jwksStore,
     IEventPublisher eventPublisher,
     ILogger logger)
 {
     _authorizationCodeStore = authorizationCodeStore;
     _tokenStore             = tokenStore;
     _jwtGenerator           = new JwtGenerator(clientStore, scopeRepository, jwksStore, logger);
     _eventPublisher         = eventPublisher;
     _clientStore            = clientStore;
     _consentRepository      = consentRepository;
     _jwksStore = jwksStore;
 }
コード例 #44
0
        public static TokenRequestValidator CreateTokenValidator(
            IdentityServerOptions options = null,
            IScopeStore scopes = null,
            IAuthorizationCodeStore authorizationCodeStore = null,
            IRefreshTokenStore refreshTokens = null,
            IUserService userService = null,
            IAssertionGrantValidator assertionGrantValidator = null,
            ICustomRequestValidator customRequestValidator = null)
        {
            if (options == null)
            {
                options = Thinktecture.IdentityServer.Tests.TestIdentityServerOptions.Create();
            }

            if (scopes == null)
            {
                scopes = new InMemoryScopeStore(TestScopes.Get());
            }

            if (userService == null)
            {
                userService = new TestUserService();
            }

            if (customRequestValidator == null)
            {
                customRequestValidator = new DefaultCustomRequestValidator();
            }

            if (assertionGrantValidator == null)
            {
                assertionGrantValidator = new TestAssertionValidator();
            }

            if (refreshTokens == null)
            {
                refreshTokens = new InMemoryRefreshTokenStore();
            }

            return new TokenRequestValidator(options, authorizationCodeStore, refreshTokens, userService, scopes, assertionGrantValidator, customRequestValidator);
        }
 public AuthorizeResponseGenerator(ITokenService tokenService, IAuthorizationCodeStore authorizationCodes)
 {
     _tokenService = tokenService;
     _authorizationCodes = authorizationCodes;
 }
コード例 #46
0
 public AuthorizeResponseGenerator(ITokenService tokenService, IAuthorizationCodeStore authorizationCodes, IEventService events)
 {
     _tokenService = tokenService;
     _authorizationCodes = authorizationCodes;
     _events = events;
 }
コード例 #47
0
        public static TokenRequestValidator CreateTokenRequestValidator(
            IdentityServerOptions options = null,
            IScopeStore scopes = null,
            IAuthorizationCodeStore authorizationCodeStore = null,
            IRefreshTokenStore refreshTokens = null,
            IResourceOwnerPasswordValidator resourceOwnerValidator = null,
            IProfileService profile = null,
            IEnumerable<ICustomGrantValidator> customGrantValidators = null,
            ICustomRequestValidator customRequestValidator = null,
            ScopeValidator scopeValidator = null)
        {
            if (options == null)
            {
                options = TestIdentityServerOptions.Create();
            }

            if (scopes == null)
            {
                scopes = new InMemoryScopeStore(TestScopes.Get());
            }

            if (resourceOwnerValidator == null)
            {
                resourceOwnerValidator = new TestResourceOwnerPasswordValidator();
            }

            if (profile == null)
            {
                profile = new TestProfileService();
            }

            if (customRequestValidator == null)
            {
                customRequestValidator = new DefaultCustomRequestValidator();
            }

            CustomGrantValidator aggregateCustomValidator;
            if (customGrantValidators == null)
            {
                aggregateCustomValidator = new CustomGrantValidator(new [] { new TestGrantValidator() }, new Logger<CustomGrantValidator>(new LoggerFactory()));
            }
            else
            {
                aggregateCustomValidator = new CustomGrantValidator(customGrantValidators, new Logger<CustomGrantValidator>(new LoggerFactory()));
            }

            if (refreshTokens == null)
            {
                refreshTokens = new InMemoryRefreshTokenStore();
            }

            if (scopeValidator == null)
            {
                scopeValidator = new ScopeValidator(scopes, new LoggerFactory());
            }

            return new TokenRequestValidator(
                options,
                authorizationCodeStore,
                refreshTokens,
                resourceOwnerValidator,
                profile,
                aggregateCustomValidator,
                customRequestValidator,
                scopeValidator,
                new DefaultEventService(new LoggerFactory()),
                new LoggerFactory());
        }