コード例 #1
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;
 }
コード例 #2
0
 public DiscoveryEndpoint(IdentityServerOptions options, IScopeStore scopes, ILogger <DiscoveryEndpoint> logger, IKeyMaterialService keys, ExtensionGrantValidator extensionGrants, SecretParser parsers, IResourceOwnerPasswordValidator resourceOwnerValidator)
 {
     _options                = options;
     _scopes                 = scopes;
     _logger                 = logger;
     _extensionGrants        = extensionGrants;
     _parsers                = parsers;
     _keys                   = keys;
     _resourceOwnerValidator = resourceOwnerValidator;
 }
コード例 #3
0
 public DiscoveryResponseGenerator(
     IdentityServerOptions options,
     IResourceStore resourceStore,
     IKeyMaterialService keys,
     ExtensionGrantValidator extensionGrants,
     ISecretsListParser secretParsers,
     IResourceOwnerPasswordValidator resourceOwnerValidator,
     ILogger <DiscoveryResponseGenerator> logger,
     GlobalSettings globalSettings)
     : base(options, resourceStore, keys, extensionGrants, secretParsers, resourceOwnerValidator, logger)
 {
     _globalSettings = globalSettings;
 }
コード例 #4
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="scopeValidator">The scope validator.</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 MyTokenRequestValidator(IdentityServerOptions options, IAuthorizationCodeStore authorizationCodeStore, IResourceOwnerPasswordValidator resourceOwnerValidator, IProfileService profile, IDeviceCodeValidator deviceCodeValidator, ExtensionGrantValidator extensionGrantValidator, ICustomTokenRequestValidator customRequestValidator, ScopeValidator scopeValidator, ITokenValidator tokenValidator, IEventService events, ISystemClock clock, ILogger <MyTokenRequestValidator> logger)
 {
     _logger  = logger;
     _options = options;
     _clock   = clock;
     _authorizationCodeStore = authorizationCodeStore;
     _resourceOwnerValidator = resourceOwnerValidator;
     _profile                 = profile;
     _deviceCodeValidator     = deviceCodeValidator;
     _extensionGrantValidator = extensionGrantValidator;
     _customRequestValidator  = customRequestValidator;
     _scopeValidator          = scopeValidator;
     _tokenValidator          = tokenValidator;
     _events = events;
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DiscoveryResponseGenerator"/> class.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="resourceStore">The resource store.</param>
 /// <param name="keys">The keys.</param>
 /// <param name="extensionGrants">The extension grants.</param>
 /// <param name="secretParsers">The secret parsers.</param>
 /// <param name="resourceOwnerValidator">The resource owner validator.</param>
 /// <param name="logger">The logger.</param>
 public DiscoveryResponseGenerator(
     IdentityServerOptions options,
     IResourceStore resourceStore,
     IKeyMaterialService keys,
     ExtensionGrantValidator extensionGrants,
     ISecretsListParser secretParsers,
     IResourceOwnerPasswordValidator resourceOwnerValidator,
     ILogger <DiscoveryResponseGenerator> logger)
 {
     Options                = options;
     ResourceStore          = resourceStore;
     Keys                   = keys;
     ExtensionGrants        = extensionGrants;
     SecretParsers          = secretParsers;
     ResourceOwnerValidator = resourceOwnerValidator;
     Logger                 = logger;
 }
コード例 #6
0
 public TokenRequestBaseValidator(IdentityServerOptions options, IAuthorizationCodeStore authorizationCodeStore, ExtensionGrantValidator extensionGrantValidator, ICustomTokenRequestValidator customRequestValidator, IResourceValidator resourceValidator, IResourceStore resourceStore, ITokenValidator tokenValidator, IRefreshTokenService refreshTokenService, IEventService events, IResourceOwnerPasswordValidator resourceOwnerValidator, IProfileService profile, IDeviceCodeValidator deviceCodeValidator, ISystemClock clock, ILogger logger, ValidatedTokenRequest validatedRequest)
 {
     _options = options;
     _authorizationCodeStore  = authorizationCodeStore;
     _extensionGrantValidator = extensionGrantValidator;
     _customRequestValidator  = customRequestValidator;
     _resourceValidator       = resourceValidator;
     _resourceStore           = resourceStore;
     _tokenValidator          = tokenValidator;
     _refreshTokenService     = refreshTokenService;
     _events = events;
     _resourceOwnerValidator = resourceOwnerValidator;
     _profile             = profile;
     _deviceCodeValidator = deviceCodeValidator;
     _clock            = clock;
     _logger           = logger;
     _validatedRequest = validatedRequest;
 }
コード例 #7
0
        public static TokenRequestValidator CreateTokenRequestValidator(
            IdentityServerOptions options                          = null,
            IIssuerNameService issuerNameService                   = null,
            IResourceStore resourceStore                           = null,
            IAuthorizationCodeStore authorizationCodeStore         = null,
            IRefreshTokenStore refreshTokenStore                   = null,
            IResourceOwnerPasswordValidator resourceOwnerValidator = null,
            IProfileService profile = null,
            IDeviceCodeValidator deviceCodeValidator = null,
            IEnumerable <IExtensionGrantValidator> extensionGrantValidators = null,
            ICustomTokenRequestValidator customRequestValidator             = null,
            IRefreshTokenService refreshTokenService = null,
            IResourceValidator resourceValidator     = null)
        {
            if (options == null)
            {
                options = TestIdentityServerOptions.Create();
            }

            if (issuerNameService == null)
            {
                issuerNameService = new TestIssuerNameService(options.IssuerUri);
            }

            if (resourceStore == null)
            {
                resourceStore = new InMemoryResourcesStore(TestScopes.GetIdentity(), TestScopes.GetApis(), TestScopes.GetScopes());
            }

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

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

            if (deviceCodeValidator == null)
            {
                deviceCodeValidator = new TestDeviceCodeValidator();
            }

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

            ExtensionGrantValidator aggregateExtensionGrantValidator;

            if (extensionGrantValidators == null)
            {
                aggregateExtensionGrantValidator = new ExtensionGrantValidator(new[] { new TestGrantValidator() }, TestLogger.Create <ExtensionGrantValidator>());
            }
            else
            {
                aggregateExtensionGrantValidator = new ExtensionGrantValidator(extensionGrantValidators, TestLogger.Create <ExtensionGrantValidator>());
            }

            if (authorizationCodeStore == null)
            {
                authorizationCodeStore = CreateAuthorizationCodeStore();
            }

            if (refreshTokenStore == null)
            {
                refreshTokenStore = CreateRefreshTokenStore();
            }

            if (resourceValidator == null)
            {
                resourceValidator = CreateResourceValidator(resourceStore);
            }

            if (refreshTokenService == null)
            {
                refreshTokenService = CreateRefreshTokenService(
                    refreshTokenStore,
                    profile);
            }

            return(new TokenRequestValidator(
                       options,
                       issuerNameService,
                       authorizationCodeStore,
                       resourceOwnerValidator,
                       profile,
                       deviceCodeValidator,
                       aggregateExtensionGrantValidator,
                       customRequestValidator,
                       resourceValidator,
                       resourceStore,
                       refreshTokenService,
                       new TestEventService(),
                       new StubClock(),
                       TestLogger.Create <TokenRequestValidator>()));
        }
コード例 #8
0
ファイル: Factory.cs プロジェクト: xlgwr/IdentityServer4
        public static TokenRequestValidator CreateTokenRequestValidator(
            IdentityServerOptions options = null,
            IResourceStore resourceStore  = null,
            IAuthorizationCodeStore authorizationCodeStore         = null,
            IRefreshTokenStore refreshTokenStore                   = null,
            IResourceOwnerPasswordValidator resourceOwnerValidator = null,
            IProfileService profile = null,
            IEnumerable <IExtensionGrantValidator> extensionGrantValidators = null,
            ICustomTokenRequestValidator customRequestValidator             = null,
            ScopeValidator scopeValidator = null)
        {
            if (options == null)
            {
                options = TestIdentityServerOptions.Create();
            }

            if (resourceStore == null)
            {
                resourceStore = new InMemoryResourcesStore(TestScopes.GetIdentity(), TestScopes.GetApis());
            }

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

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

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

            ExtensionGrantValidator aggregateExtensionGrantValidator;

            if (extensionGrantValidators == null)
            {
                aggregateExtensionGrantValidator = new ExtensionGrantValidator(new[] { new TestGrantValidator() }, TestLogger.Create <ExtensionGrantValidator>());
            }
            else
            {
                aggregateExtensionGrantValidator = new ExtensionGrantValidator(extensionGrantValidators, TestLogger.Create <ExtensionGrantValidator>());
            }

            if (authorizationCodeStore == null)
            {
                authorizationCodeStore = CreateAuthorizationCodeStore();
            }

            if (refreshTokenStore == null)
            {
                refreshTokenStore = CreateRefreshTokenStore();
            }

            if (scopeValidator == null)
            {
                scopeValidator = new ScopeValidator(resourceStore, new LoggerFactory().CreateLogger <ScopeValidator>());
            }

            return(new TokenRequestValidator(
                       options,
                       authorizationCodeStore,
                       refreshTokenStore,
                       resourceOwnerValidator,
                       profile,
                       aggregateExtensionGrantValidator,
                       customRequestValidator,
                       scopeValidator,
                       new TestEventService(),
                       TestLogger.Create <TokenRequestValidator>()));
        }
コード例 #9
0
ファイル: Factory.cs プロジェクト: FragCoder/IdentityServer4
        public static TokenRequestValidator CreateTokenRequestValidator(
            IdentityServerOptions options = null,
            IScopeStore scopes            = null,
            IPersistedGrantService grants = null,
            IResourceOwnerPasswordValidator resourceOwnerValidator = null,
            IProfileService profile = null,
            IEnumerable <IExtensionGrantValidator> extensionGrantValidators = null,
            ICustomTokenRequestValidator 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 DefaultCustomTokenRequestValidator();
            }

            ExtensionGrantValidator aggregateExtensionGrantValidator;

            if (extensionGrantValidators == null)
            {
                aggregateExtensionGrantValidator = new ExtensionGrantValidator(new[] { new TestGrantValidator() }, TestLogger.Create <ExtensionGrantValidator>());
            }
            else
            {
                aggregateExtensionGrantValidator = new ExtensionGrantValidator(extensionGrantValidators, TestLogger.Create <ExtensionGrantValidator>());
            }

            if (grants == null)
            {
                grants = CreateGrantService();
            }

            if (scopeValidator == null)
            {
                scopeValidator = new ScopeValidator(scopes, new LoggerFactory().CreateLogger <ScopeValidator>());
            }

            return(new TokenRequestValidator(
                       options,
                       grants,
                       resourceOwnerValidator,
                       profile,
                       aggregateExtensionGrantValidator,
                       customRequestValidator,
                       scopeValidator,
                       new TestEventService(),
                       TestLogger.Create <TokenRequestValidator>()));
        }