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 static AuthorizeRequestValidator CreateAuthorizeValidator( CoreSettings settings = null, IScopeService scopes = null, IClientService clients = null, IUserService users = null, ICustomRequestValidator customValidator = null) { if (settings == null) { settings = new TestSettings(); } if (scopes == null) { scopes = new InMemoryScopeService(TestScopes.Get()); } if (clients == null) { clients = new InMemoryClientService(TestClients.Get()); } if (customValidator == null) { customValidator = new DefaultCustomRequestValidator(); } if (users == null) { users = new TestUserService(); } return new AuthorizeRequestValidator(settings, scopes, clients, users, customValidator); }
public static IdentityServerServiceFactory Create( string issuerUri, string siteName, string publicHostAddress = "") { var settings = new TestSettings(issuerUri, siteName, publicHostAddress); var scopes = new InMemoryScopeService(TestScopes.Get()); var clients = new InMemoryClientService(TestClients.Get()); var fact = new IdentityServerServiceFactory { CoreSettings = Registration.RegisterFactory<CoreSettings>(() => settings), ScopeService = Registration.RegisterFactory<IScopeService>(() => scopes), ClientService = Registration.RegisterFactory<IClientService>(() => clients) }; return fact; }
public static IdentityServerServiceFactory Create( string issuerUri, string siteName, string publicHostAddress = "") { var settings = new LocalTestCoreSettings(issuerUri, siteName, publicHostAddress); var codeStore = new InMemoryAuthorizationCodeStore(); var tokenStore = new InMemoryTokenHandleStore(); var consent = new InMemoryConsentService(); var scopes = new InMemoryScopeService(LocalTestScopes.Get()); var clients = new InMemoryClientService(LocalTestClients.Get()); var logger = new TraceLogger(); var users = new InMemoryUser[] { new InMemoryUser{Subject = "alice", Username = "******", Password = "******", Claims = new Claim[] { new Claim(Constants.ClaimTypes.GivenName, "Alice"), new Claim(Constants.ClaimTypes.FamilyName, "Smith"), new Claim(Constants.ClaimTypes.Email, "*****@*****.**"), } }, new InMemoryUser{Subject = "bob", Username = "******", Password = "******", Claims = new Claim[] { new Claim(Constants.ClaimTypes.GivenName, "Bob"), new Claim(Constants.ClaimTypes.FamilyName, "Smith"), new Claim(Constants.ClaimTypes.Email, "*****@*****.**"), } }, }; var userSvc = new InMemoryUserService(users); var fact = new IdentityServerServiceFactory { Logger = () => logger, UserService = () => userSvc, AuthorizationCodeStore = () => codeStore, TokenHandleStore = () => tokenStore, CoreSettings = () => settings, ConsentService = () => consent, ScopeService = () => scopes, ClientService = () => clients }; return fact; }
public static IdentityServerServiceFactory Create( string issuerUri, string siteName, string publicHostAddress = "") { var users = new InMemoryUser[] { new InMemoryUser{Subject = "818727", Username = "******", Password = "******", Claims = new Claim[] { new Claim(Constants.ClaimTypes.GivenName, "Alice"), new Claim(Constants.ClaimTypes.FamilyName, "Smith"), new Claim(Constants.ClaimTypes.Email, "*****@*****.**"), } }, new InMemoryUser{Subject = "88421113", Username = "******", Password = "******", Claims = new Claim[] { new Claim(Constants.ClaimTypes.GivenName, "Bob"), new Claim(Constants.ClaimTypes.FamilyName, "Smith"), new Claim(Constants.ClaimTypes.Email, "*****@*****.**"), } }, }; var settings = new Settings(issuerUri, siteName, publicHostAddress); var scopes = new InMemoryScopeService(Scopes.Get()); var clients = new InMemoryClientService(Clients.Get()); var userSvc = new InMemoryUserService(users); var fact = new IdentityServerServiceFactory { UserService = Registration.RegisterFactory<IUserService>(() => userSvc), CoreSettings = Registration.RegisterFactory<CoreSettings>(() => settings), ScopeService = Registration.RegisterFactory<IScopeService>(() => scopes), ClientService = Registration.RegisterFactory<IClientService>(() => clients) }; return fact; }