public static TokenValidator CreateTokenValidator(ITokenHandleStore tokenStore = null, IProfileService profile = null) { if (profile == null) { profile = new TestProfileService(); } if (tokenStore == null) { tokenStore = new InMemoryTokenHandleStore(); } var clients = CreateClientStore(); var idsvrContext = IdentityServerContextHelper.Create(); var logger = TestLogger.Create <TokenValidator>(); var validator = new TokenValidator( clients: clients, tokenHandles: tokenStore, customValidator: new DefaultCustomTokenValidator( profile: profile, clients: clients, logger: TestLogger.Create <DefaultCustomTokenValidator>()), keys: new[] { new InMemoryValidationKeysStore(new[] { TestCert.LoadSigningCredentials().Key }) }, logger: logger, context: idsvrContext); return(validator); }
public static TokenValidator CreateTokenValidator(ITokenHandleStore tokenStore = null, IProfileService profile = null) { if (profile == null) { profile = new TestProfileService(); } var clients = CreateClientStore(); var options = TestIdentityServerOptions.Create(); var accessor = new HttpContextAccessor(); accessor.HttpContext = new DefaultHttpContext(); var idsrvContext = new IdentityServerContext(accessor, options); var logger = new Logger <TokenValidator>(new LoggerFactory()); var validator = new TokenValidator( options: options, clients: clients, tokenHandles: tokenStore, customValidator: new DefaultCustomTokenValidator( profile: profile, clients: clients, logger: new Logger <DefaultCustomTokenValidator>(new LoggerFactory())), keyService: new DefaultSigningKeyService(options), logger: logger, context: idsrvContext); return(validator); }
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() }, TestLogger.Create <CustomGrantValidator>()); } else { aggregateCustomValidator = new CustomGrantValidator(customGrantValidators, TestLogger.Create <CustomGrantValidator>()); } if (refreshTokens == null) { refreshTokens = new InMemoryRefreshTokenStore(); } if (scopeValidator == null) { scopeValidator = new ScopeValidator(scopes, new LoggerFactory().CreateLogger <ScopeValidator>()); } var idsvrContext = IdentityServerContextHelper.Create(); return(new TokenRequestValidator( options, authorizationCodeStore, refreshTokens, resourceOwnerValidator, profile, aggregateCustomValidator, customRequestValidator, scopeValidator, new TestEventService(), TestLogger.Create <TokenRequestValidator>())); }
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()); }
public static TokenValidator CreateTokenValidator(ITokenHandleStore tokenStore = null, IProfileService profile = null) { if (profile == null) { profile = new TestProfileService(); } var clients = CreateClientStore(); var options = TestIdentityServerOptions.Create(); var accessor = new HttpContextAccessor(); accessor.HttpContext = new DefaultHttpContext(); var idsrvContext = new IdentityServerContext(accessor, options); var logger = new Logger<TokenValidator>(new LoggerFactory()); var validator = new TokenValidator( options: options, clients: clients, tokenHandles: tokenStore, customValidator: new DefaultCustomTokenValidator( profile: profile, clients: clients, logger: new Logger<DefaultCustomTokenValidator>(new LoggerFactory())), keyService: new DefaultSigningKeyService(options), logger: logger, context: idsrvContext); return validator; }