IS4 Config 及 調試
VS 2017 Empty Project
install-package IdentityServer4
Edit Properties->launchSettings.json
install-package IdentityServer4
Edit Properties->launchSettings.json
{
"profiles": {
"is4Server": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000/"
}
}
}
Add new class Config.cs in root
using IdentityServer4.Models;
public static class Config
{
public static IEnumerable GetIdentityResources()
{
return new IdentityResource[]
{
new IdentityResources.OpenId()
};
}
public static IEnumerable GetApis()
{
return new ApiResource[] { };
}
public static IEnumerable GetClients()
{
return new Client[] { };
}
}
Modify Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddIdentityServer()
.AddDeveloperSigningCredential()
.AddInMemoryIdentityResources(Config.GetIdentityResources())
.AddInMemoryApiResources(Config.GetApis())
.AddInMemoryClients(Config.GetClients());
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
......
app.UseIdentityServer();
}
http://localhost:5000/.well-known/openid-configuration
留言
張貼留言