Skip to content

Instantly share code, notes, and snippets.

@gdyrrahitis
Last active August 18, 2018 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdyrrahitis/2cf89e8d40f72ec522379fdc60282815 to your computer and use it in GitHub Desktop.
Save gdyrrahitis/2cf89e8d40f72ec522379fdc60282815 to your computer and use it in GitHub Desktop.
public void ConfigureServices(IServiceCollection services)
{
services.AddIdentityServer()
.AddDeveloperSigningCredential()
.AddInMemoryApiResources(new List<ApiResource>
{
new ApiResource("resource.server.api",
new [] { ClaimTypes.Name, ClaimTypes.Email})
})
.AddInMemoryClients(new List<Client>
{
new Client
{
ClientId = "angular.client",
ClientName = "Angular Client",
ClientSecrets = new [] { new Secret("secret".Sha256()) },
AllowedScopes = new [] { "resource.server.api" },
AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
AllowedCorsOrigins = new [] { "http://localhost:4200/" }
}
})
.AddTestUsers(new List<TestUser>
{
new TestUser
{
SubjectId = "1",
Username = "user",
Password = "1234",
Claims = new List<Claim>
{
new Claim(ClaimTypes.Name, "Test User"),
new Claim(ClaimTypes.Email, "email@mail.com")
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment