public void ConfigureServices(IServiceCollection services) { services.AddIdentityServer(options => { //默认的登陆页面是/account/login options.UserInteraction.LoginUrl = "/login"; options.UserInteraction.LogoutUrl = "/login/logout"; //授权确认页面 默认/consent //options.UserInteraction.ConsentUrl = ""; }) .AddDeveloperSigningCredential() .AddInMemoryApiResources(IdpConfig.GetApis()) .AddInMemoryClients(IdpConfig.GetClients()) .AddTestUsers(TestUsers.Users) .AddInMemoryIdentityResources(IdpConfig.GetApiResources()); services.Configure <CookiePolicyOptions>(options => { options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddMvc(options => { options.EnableEndpointRouting = false; }).SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddIdentityServer() .AddDeveloperSigningCredential() //添加测试用户 .AddTestUsers(TestUsers.Users) //添加用户认证资源 .AddInMemoryIdentityResources(IdpConfig.GetApiResources()) .AddInMemoryApiResources(IdpConfig.GetApis()) .AddInMemoryClients(IdpConfig.GetClients()); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }