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 ClientValidator CreateClientValidator( IClientService clients = null) { if (clients == null) { clients = new InMemoryClientService(TestClients.Get()); } return(new ClientValidator(clients)); }
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 ClientValidator CreateClientValidator( ILogger logger = null, IClientService clients = null) { if (logger == null) { logger = new DebugLogger(); } if (clients == null) { clients = new InMemoryClientService(TestClients.Get()); } return(new ClientValidator(clients, logger)); }
public static IdentityServerServiceFactory Create( string issuerUri, string siteName, string publicHostAddress = "") { var users = new [] { new InMemoryUser { Subject = "818727", Username = "******", Password = "******", Claims = new [] { 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 [] { new Claim(Constants.ClaimTypes.GivenName, "Bob"), new Claim(Constants.ClaimTypes.FamilyName, "Smith"), new Claim(Constants.ClaimTypes.Email, "*****@*****.**") } } }; var settings = new LocalTestCoreSettings(issuerUri, siteName, publicHostAddress); var scopes = new InMemoryScopeService(LocalTestScopes.Get()); var clients = new InMemoryClientService(LocalTestClients.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); }