public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IScopeStore scopes, ICustomTokenResponseGenerator customResponseGenerator)
 {
     _tokenService = tokenService;
     _refreshTokenService = refreshTokenService;
     _scopes = scopes;
     _customResponseGenerator = customResponseGenerator;
 }
        internal static async Task<AuthorizationCode> FromDbFormat(StoredAuthorizationCode code, IAsyncDocumentSession s, IScopeStore scopeStore)
        {
            var result = new AuthorizationCode
            {
                CreationTime = code.CreationTime,
                IsOpenId = code.IsOpenId,
                RedirectUri = code.RedirectUri,
                WasConsentShown = code.WasConsentShown,
                Nonce = code.Nonce,
                Client = Data.StoredClient.FromDbFormat(await s.LoadAsync<Data.StoredClient>("clients/" + code.Client)),
                CodeChallenge = code.CodeChallenge,
                CodeChallengeMethod = code.CodeChallengeMethod,
                SessionId = code.SessionId,
                RequestedScopes = await scopeStore.FindScopesAsync(code.RequestedScopes)
            };

            var claimsPrinciple = new ClaimsPrincipal();
            foreach (var id in code.Subject)
            {
                claimsPrinciple.AddIdentity(Data.StoredIdentity.FromDbFormat(id));
            }
            result.Subject = claimsPrinciple;

            return result;
        }
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IScopeStore scopes, ILoggerFactory loggerFactory)
 {
     _tokenService = tokenService;
     _refreshTokenService = refreshTokenService;
     _scopes = scopes;
     _logger = loggerFactory.CreateLogger<TokenResponseGenerator>();
 }
        public static AuthorizeRequestValidator CreateAuthorizeValidator(
            IdentityServerOptions options = null,
            IScopeStore scopes = null,
            IClientStore clients = null,
            IUserService users = null,
            ICustomRequestValidator customValidator = null)
        {
            if (options == null)
            {
                options = Thinktecture.IdentityServer.Tests.TestIdentityServerOptions.Create();
            }

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

            if (clients == null)
            {
                clients = new InMemoryClientStore(TestClients.Get());
            }

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

            return new AuthorizeRequestValidator(options, scopes, clients, customValidator);
        }
示例#5
0
        //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());
        }
        public ScopeValidator(IScopeStore store)
        {
            RequestedScopes = new List<Scope>();
            GrantedScopes = new List<Scope>();

            _store = store;
        }
        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);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CachingScopeStore"/> class.
        /// </summary>
        /// <param name="inner">The inner <see cref="IScopeStore"/>.</param>
        /// <param name="cache">The cache.</param>
        /// <exception cref="System.ArgumentNullException">
        /// inner
        /// or
        /// cache
        /// </exception>
        public CachingScopeStore(IScopeStore inner, ICache<IEnumerable<Scope>> cache)
        {
            if (inner == null) throw new ArgumentNullException("inner");
            if (cache == null) throw new ArgumentNullException("cache");

            this.inner = inner;
            this.cache = cache;
        }
 public ScopeSecretValidator(IScopeStore scopes, SecretParser parsers, SecretValidator validator, IEventService events, ILogger<ScopeSecretValidator> logger)
 {
     _scopes = scopes;
     _parser = parsers;
     _validator = validator;
     _events = events;
     _logger = logger;
 }
 public DiscoveryEndpointController(IdentityServerOptions options, IScopeStore scopes, IOwinContext context, ISigningKeyService keyService, CustomGrantValidator customGrants)
 {
     _options = options;
     _scopes = scopes;
     _context = context;
     _keyService = keyService;
     _customGrants = customGrants;
 }
 public ScopeSecretValidator(IScopeStore scopes, SecretParser parsers, SecretValidator validator, OwinEnvironmentService environment, IEventService events)
 {
     _scopes = scopes;
     _environment = environment;
     _parser = parsers;
     _validator = validator;
     _events = events;
 }
示例#12
0
        public ScopeValidator(IScopeStore store, ILoggerFactory loggerFactory)
        {
            RequestedScopes = new List<Scope>();
            GrantedScopes = new List<Scope>();

            _logger = loggerFactory.CreateLogger<ScopeValidator>();
            _store = store;
        }
 public ScopeSecretValidator(IScopeStore scopes, IEnumerable<ISecretParser> parsers, IEnumerable<ISecretValidator> validators, OwinEnvironmentService environment, IEventService events)
 {
     _scopes = scopes;
     _parsers = parsers;
     _validators = validators;
     _environment = environment;
     _events = events;
 }
        public AuthorizeRequestValidator(IdentityServerOptions options, IScopeStore scopes, IClientStore clients, ICustomRequestValidator customValidator)
        {
            _options = options;
            _scopes = scopes;
            _clients = clients;
            _customValidator = customValidator;

            _validatedRequest = new ValidatedAuthorizeRequest();
            _validatedRequest.IdentityServerOptions = _options;
        }
 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 DiscoveryEndpoint(IdentityServerOptions options, IdentityServerContext context, IScopeStore scopes, ILogger<DiscoveryEndpoint> logger, ISigningKeyService keyService, CustomGrantValidator customGrants, SecretParser parsers)
 {
     _options = options;
     _scopes = scopes;
     _logger = logger;
     _keyService = keyService;
     _context = context;
     _customGrants = customGrants;
     _parsers = parsers;
 }
示例#17
0
 public ConsentController(
     ILogger<ConsentController> logger,
     IIdentityServerInteractionService interaction,
     IClientStore clientStore,
     IScopeStore scopeStore)
 {
     _logger = logger;
     _interaction = interaction;
     _clientStore = clientStore;
     _scopeStore = scopeStore;
 }
 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;
 }
示例#19
0
        public static AuthorizeRequestValidator CreateAuthorizeRequestValidator(
            IdentityServerOptions options = null,
            IScopeStore scopes = null,
            IClientStore clients = null,
            IProfileService profile = null,
            ICustomRequestValidator customValidator = null,
            IRedirectUriValidator uriValidator = null,
            ScopeValidator scopeValidator = null,
            IDictionary<string, object> environment = null)
        {
            if (options == null)
            {
                options = TestIdentityServerOptions.Create();
            }

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

            if (clients == null)
            {
                clients = new InMemoryClientStore(TestClients.Get());
            }

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

            if (uriValidator == null)
            {
                uriValidator = new StrictRedirectUriValidator();
            }

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

            var sessionCookie = new SessionCookie(IdentityServerContextHelper.Create(null, options));

            return new AuthorizeRequestValidator(
                options,
                clients,
                customValidator,
                uriValidator,
                scopeValidator,
                sessionCookie,
                new Logger<AuthorizeRequestValidator>(new LoggerFactory())
            );
        }
 public ConsentController(
     ILogger<ConsentController> logger,
     ConsentInteraction consentInteraction,
     IClientStore clientStore,
     IScopeStore scopeStore,
     ILocalizationService localization)
 {
     _logger = logger;
     _consentInteraction = consentInteraction;
     _clientStore = clientStore;
     _scopeStore = scopeStore;
     _localization = localization;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultClientPermissionsService"/> class.
        /// </summary>
        /// <param name="permissionsStore">The permissions store.</param>
        /// <param name="clientStore">The client store.</param>
        /// <param name="scopeStore">The scope store.</param>
        /// <exception cref="System.ArgumentNullException">
        /// permissionsStore
        /// or
        /// clientStore
        /// or
        /// scopeStore
        /// </exception>
        public DefaultClientPermissionsService(
            IPermissionsStore permissionsStore, 
            IClientStore clientStore, 
            IScopeStore scopeStore)
        {
            if (permissionsStore == null) throw new ArgumentNullException("permissionsStore");
            if (clientStore == null) throw new ArgumentNullException("clientStore");
            if (scopeStore == null) throw new ArgumentNullException("scopeStore");

            this.permissionsStore = permissionsStore;
            this.clientStore = clientStore;
            this.scopeStore = scopeStore;
        }
示例#22
0
 public ConsentController(
     ILogger<ConsentController> logger,
     IIdentityServerInteractionService interaction,
     IClientStore clientStore,
     IScopeStore scopeStore,
     IIdentityServerIntegration identityServerIntegration,
     SiteContext currentSite
     )
 {
     _logger = logger;
     _interaction = interaction;
     _clientStore = clientStore;
     _scopeStore = scopeStore;
     _site = currentSite;
     this.identityServerIntegration = identityServerIntegration;
 }
        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);
        }
示例#24
0
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IScopeStore scopes, ICustomTokenResponseGenerator customResponseGenerator)
 {
     _tokenService        = tokenService;
     _refreshTokenService = refreshTokenService;
     _scopes = scopes;
     _customResponseGenerator = customResponseGenerator;
 }
 public CustomAuthorizationCodeStore(DapperRepo repo, IScopeStore scopeStore, IClientStore clientStore)
     : base(repo, TokenType.AuthorizationCode, scopeStore, clientStore)
 {
 }
 public AuthorizationCodeStore(IOperationalDbContext context, IScopeStore scopeStore, IClientStore clientStore)
     : base(context, TokenType.AuthorizationCode, scopeStore, clientStore)
 {
 }
        private static async Task<AuthorizationCode> Version1(
            BsonDocument doc, 
            IClientStore clientStore,
            IScopeStore scopeStore)
        {
            var code = new AuthorizationCode();
            code.CreationTime = doc.GetValueOrDefault("creationTime", code.CreationTime);
            code.IsOpenId = doc.GetValueOrDefault("isOpenId", code.IsOpenId);
            code.RedirectUri = doc.GetValueOrDefault("redirectUri", code.RedirectUri);
            code.WasConsentShown = doc.GetValueOrDefault("wasConsentShown", code.WasConsentShown);
            code.Nonce = doc.GetValueOrDefault("nonce", code.Nonce);
            var claimsPrincipal = new ClaimsPrincipal();
            IEnumerable<ClaimsIdentity> identities = doc.GetValueOrDefault("subject", sub =>
            {
                string authenticationType = sub.GetValueOrDefault("authenticationType", (string)null);
                var claims = sub.GetNestedValueOrDefault("claimSet", ClaimSetSerializer.Deserialize, new Claim[] { });
                ClaimsIdentity identity = authenticationType == null
                    ? new ClaimsIdentity(claims)
                    : new ClaimsIdentity(claims, authenticationType);
                return identity;
            }, new ClaimsIdentity[] { });
            claimsPrincipal.AddIdentities(identities);
            code.Subject = claimsPrincipal;

            var clientId = doc["_clientId"].AsString;
            code.Client = await clientStore.FindClientByIdAsync(clientId);
            if (code.Client == null)
            {
                throw new InvalidOperationException("Client not found when deserializing authorization code. Client id: " + clientId); 
            }

            var scopes = doc.GetValueOrDefault(
                "requestedScopes",
                (IEnumerable<string>)new string[] { }).ToArray();
            code.RequestedScopes = await scopeStore.FindScopesAsync(scopes);
            if (scopes.Count() > code.RequestedScopes.Count())
            {
                throw new InvalidOperationException("Scopes not found when deserializing authorization code. Scopes: " + string.Join(", ",scopes.Except(code.RequestedScopes.Select(x=>x.Name)))); 
            }
            return code;
        }
 public UserInfoResponseGenerator(IUserService users, IScopeStore scopes)
 {
     _users = users;
     _scopes = scopes;
 }
示例#29
0
 public ScopeValidation()
 {
     _store = new InMemoryScopeStore(_allScopes);
 }
示例#30
0
 /// <summary>Constructor</summary>
 /// <param name="secretStore">Vault Secret Store</param>
 /// <param name="scopeStore">Scope Store</param>
 public ScopeSecretStore(IVaultSecretStore secretStore, IScopeStore scopeStore)
 {
     this.secretStore = secretStore.ThrowIfNull(nameof(secretStore));
     this.scopeStore  = scopeStore.ThrowIfNull(nameof(scopeStore));
 }
 public ScopeConverter(IScopeStore scopeStore)
 {
     _scopeStore = scopeStore;
 }
示例#32
0
 public RefreshTokenStore(OperationalContext context, IScopeStore scopeStore, IClientStore clientStore)
     : base(context, TokenType.RefreshToken, scopeStore, clientStore)
 {
 }
示例#33
0
        internal RedisAuthorizationCodeStore(IClientStore clientStore, IScopeStore scopeStore, string config, int db = 0) : base(clientStore, scopeStore)
        {
            var connectionMultiplexer = RedisConnectionMultiplexerStore.GetConnectionMultiplexer(config);

            _db = connectionMultiplexer.GetDatabase(db);
        }
 public AuthStor(IOperationalDbContext context, IScopeStore scopeStore, IClientStore clientStore) : base(context, scopeStore, clientStore)
 {
 }
 public TokenHandleStore(EntityFrameworkServiceOptions options, IOperationalDbContext context, IScopeStore scopeStore, IClientStore clientStore)
     : base(options, context, Entities.TokenType.TokenHandle, scopeStore, clientStore)
 {
 }
示例#36
0
 public DiscoveryEndpointController(IdentityServerOptions options, IScopeStore scopes)
 {
     _options = options;
     _scopes  = scopes;
 }
 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;
 }
示例#38
0
 public ScopeConverter(IScopeStore scopeStore)
 {
     this.scopeStore = scopeStore ?? throw new ArgumentNullException("scopeStore");
 }
示例#39
0
 public UserInfoResponseGenerator(IProfileService profile, IScopeStore scopes, ILogger <UserInfoResponseGenerator> logger)
 {
     _profile = profile;
     _scopes  = scopes;
     _logger  = logger;
 }
示例#40
0
 public AuthorizationCodeStore(IIdentityServerOperationalDataAccessModel dataModel, IClientStore clientStore, IScopeStore scopeStore) :
     base(dataModel, DbTokenType.AuthorizationCode, clientStore, scopeStore)
 {
 }
 public AuthorizationCodeStore(IDatabase database, IScopeStore scopeStore, IClientStore clientStore, RedisKeyGenerator redisKeyGenerator)
     : base(database, TokenType.AuthorizationCode, scopeStore, clientStore, redisKeyGenerator)
 {
 }
 public CustomTokenHandleStore(DapperRepo repo, IScopeStore scopeStore, IClientStore clientStore)
     : base(repo, TokenType.TokenHandle, scopeStore, clientStore)
 {
 }
示例#43
0
 public ScopeValidation()
 {
     _store = new InMemoryScopeStore(_allScopes);
 }
示例#44
0
 public TokenHandleStore(ISession session, IScopeStore scopeStore, IClientStore clientStore)
     : base(session, TokenType.TokenHandle, scopeStore, clientStore)
 {
 }
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IScopeStore scopes)
 {
     _tokenService = tokenService;
     _refreshTokenService = refreshTokenService;
     _scopes = scopes;
 }
示例#46
0
 public SqlIdnScopeConverter(IScopeStore scopeStore)
 {
     Raise.ArgumentNullException.IfIsNull(scopeStore, nameof(scopeStore));
     _scopeStore = scopeStore;
 }
示例#47
0
        public static AuthorizeRequestValidator CreateAuthorizeRequestValidator(
            IdentityServerOptions options = null,
            IScopeStore scopes = null,
            IClientStore clients = null,
            IUserService users = null,
            ICustomRequestValidator customValidator = null,
            IRedirectUriValidator uriValidator = null,
            ScopeValidator scopeValidator = null,
            IDictionary<string, object> environment = null)
        {
            if (options == null)
            {
                options = TestIdentityServerOptions.Create();
            }

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

            if (clients == null)
            {
                clients = new InMemoryClientStore(TestClients.Get());
            }

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

            if (uriValidator == null)
            {
                uriValidator = new DefaultRedirectUriValidator();
            }

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

            var mockSessionCookie = new Mock<SessionCookie>((IOwinContext)null, (IdentityServerOptions)null);
            mockSessionCookie.CallBase = false;
            mockSessionCookie.Setup(x => x.GetSessionId()).Returns((string)null);

            return new AuthorizeRequestValidator(options, clients, customValidator, uriValidator, scopeValidator, mockSessionCookie.Object);

        }
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IScopeStore scopes)
 {
     _tokenService        = tokenService;
     _refreshTokenService = refreshTokenService;
     _scopes = scopes;
 }
示例#49
0
 public AuthorizationCodeStore(IMongoDatabase db, StoreSettings settings, IClientStore clientStore, IScopeStore scopeStore)
     : base(db, settings.AuthorizationCodeCollection)
 {
     _serializer = new AuthorizationCodeSerializer(clientStore, scopeStore);
 }
        public ScopeConverter(IScopeStore scopeStore)
        {
            if (scopeStore == null) throw new ArgumentNullException(nameof(scopeStore));

            this.scopeStore = scopeStore;
        }
示例#51
0
 public TokenResponseGenerator(ITokenService tokenService, IRefreshTokenService refreshTokenService, IScopeStore scopes, ILoggerFactory loggerFactory)
 {
     _tokenService        = tokenService;
     _refreshTokenService = refreshTokenService;
     _scopes = scopes;
     _logger = loggerFactory.CreateLogger <TokenResponseGenerator>();
 }
示例#52
0
 protected BaseTokenStore(IIdentityServerOperationalDataAccessModel dataModel, DbTokenType tokenType, IClientStore clientStore, IScopeStore scopeStore)
 {
     this.DataModel   = dataModel;
     this.TokenType   = tokenType;
     this.clientStore = clientStore;
     this.scopeStore  = scopeStore;
 }
 public AuthorizationCodeStore(EntityFrameworkServiceOptions options, IOperationalDbContext context, IScopeStore scopeStore, IClientStore clientStore)
     : base(options, context, TokenType.AuthorizationCode, scopeStore, clientStore)
 {
 }
示例#54
0
 public UserInfoResponseGenerator(IUserService users, IScopeStore scopes)
 {
     _users  = users;
     _scopes = scopes;
 }
 public TokenHandleStore(OperationalDbContext context, IScopeStore scopeStore, IClientStore clientStore)
     : base(context, Entities.TokenType.TokenHandle, scopeStore, clientStore)
 {
 }
示例#56
0
        //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()));
        }
示例#57
0
 public RedisAuthorizationCodeStore(IClientStore clientStore, IScopeStore scopeStore, RedisStoreOptions options)
     : this(clientStore, scopeStore, options.Configuration, options.Db)
 {
 }