-
Notifications
You must be signed in to change notification settings - Fork 393
Expand file tree
/
Copy pathIdentityServerExtensions.cs
More file actions
38 lines (33 loc) · 1.57 KB
/
IdentityServerExtensions.cs
File metadata and controls
38 lines (33 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.
using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Configuration.RequestProcessing;
using Duende.IdentityServer.Hosts.Shared.Configuration;
using Duende.IdentityServer.Hosts.Shared.Customization;
using Duende.IdentityServer.UI.AspNetIdentity.Models;
namespace IdentityServerHost;
internal static class IdentityServerExtensions
{
internal static WebApplicationBuilder ConfigureIdentityServer(this WebApplicationBuilder builder)
{
builder.Services.AddIdentityServer(opt =>
{
// In load-balanced environments, synchronization delay is important.
// In development, we're never load balanced and can skip it to start up faster.
if (builder.Environment.IsDevelopment())
{
opt.KeyManagement.InitializationSynchronizationDelay = TimeSpan.Zero;
}
}
)
.AddInMemoryIdentityResources(TestResources.IdentityResources)
.AddInMemoryApiResources(TestResources.ApiResources)
.AddInMemoryApiScopes(TestResources.ApiScopes)
.AddInMemoryClients(TestClients.Get())
.AddAspNetIdentity<ApplicationUser>();
builder.Services.AddIdentityServerConfiguration(opt => { })
.AddInMemoryClientConfigurationStore();
builder.Services.AddTransient<IDynamicClientRegistrationRequestProcessor, CustomClientRegistrationProcessor>();
return builder;
}
}