Table of Contents

Class IdentityServerBuilderExtensionsCore

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
Fdyay.IdentityServer.Core.dll

Configuration extensions for the identity server builder.

public static class IdentityServerBuilderExtensionsCore
Inheritance
IdentityServerBuilderExtensionsCore
Inherited Members

Fields

DefaultClientStoreCacheDuration

How long AddClientStoreCache<T>(IIdentityServerBuilder) holds a client: Duende's 15 minutes.

public static readonly TimeSpan DefaultClientStoreCacheDuration

Field Value

TimeSpan

DefaultResourceStoreCacheDuration

How long AddResourceStoreCache<T>(IIdentityServerBuilder) holds the resources: Duende's 15 minutes.

public static readonly TimeSpan DefaultResourceStoreCacheDuration

Field Value

TimeSpan

Methods

AddAppAuthRedirectUriValidator(IIdentityServerBuilder)

Accepts http://127.0.0.1 on any port for a native client that registered it. Duende's.

public static IIdentityServerBuilder AddAppAuthRedirectUriValidator(this IIdentityServerBuilder builder)

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

AddClientConfigurationValidator<T>(IIdentityServerBuilder)

Registers a host's own client configuration validator. Duende's.

public static IIdentityServerBuilder AddClientConfigurationValidator<T>(this IIdentityServerBuilder builder) where T : class, IClientConfigurationValidator

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

AddClientStoreCache<T>(IIdentityServerBuilder)

Registers a custom IClientStore, validated and then cached for Duende's 15 minutes.

public static IIdentityServerBuilder AddClientStoreCache<T>(this IIdentityServerBuilder builder) where T : class, IClientStore

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

AddClientStoreCache<T>(IIdentityServerBuilder, TimeSpan)

Registers a custom IClientStore, validated and then cached. Duende's.

public static IIdentityServerBuilder AddClientStoreCache<T>(this IIdentityServerBuilder builder, TimeSpan duration) where T : class, IClientStore

Parameters

builder IIdentityServerBuilder

The builder.

duration TimeSpan

How long a client is held before the store is asked again; an edit to a client reaches this server within it. As with AddCorsPolicyCache, no duration disables the cache: a host that does not want one calls AddClientStore<T>(IIdentityServerBuilder).

Returns

IIdentityServerBuilder

Type Parameters

T

Remarks

Measured from Duende 8.0.1: T registered as itself if it is not already, the validating store in front of it, and CachingClientStore<T> in front of that as IClientStore. The cache is the HybridCache under the key ConfigurationStoreCache; without one a host registered, an in-memory one private to this process.

AddClientStore<T>(IIdentityServerBuilder)

Registers a custom IClientStore implementation, read through ValidatingClientStore<T>.

public static IIdentityServerBuilder AddClientStore<T>(this IIdentityServerBuilder builder) where T : class, IClientStore

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

Remarks

Duende 8.0.1's, measured: T is registered as itself, if it is not already, and the validating store in front of it as IClientStore.

AddCorsPolicyCache(IIdentityServerBuilder)

Caches the allowed origins the registered ICorsPolicyService reports.

public static IIdentityServerBuilder AddCorsPolicyCache(this IIdentityServerBuilder builder)

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Remarks

Opt-in, and with the cost stated on CachingCorsPolicyService: what is being held is a permission, so a client disabled now still reaches the protocol endpoints from the browser until the entry expires. A host that keeps its clients in memory has nothing to gain here and should not call this.

AddCorsPolicyCache(IIdentityServerBuilder, TimeSpan)

Caches the allowed origins the registered ICorsPolicyService reports.

public static IIdentityServerBuilder AddCorsPolicyCache(this IIdentityServerBuilder builder, TimeSpan duration)

Parameters

builder IIdentityServerBuilder

The server's builder.

duration TimeSpan

How long an allowed origin stays allowed without asking again. There is no duration that disables the cache: a registration that reads as a capability and is not one is worse than an absent one, so a host that does not want caching does not call this.

Returns

IIdentityServerBuilder

AddCorsPolicyService<T>(IIdentityServerBuilder)

Registers a custom ICorsPolicyService implementation.

public static IIdentityServerBuilder AddCorsPolicyService<T>(this IIdentityServerBuilder builder) where T : class, ICorsPolicyService

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

AddCustomAuthorizeRequestValidator<T>(IIdentityServerBuilder)

Registers a host's own checks on an authorize request. Duende's.

public static IIdentityServerBuilder AddCustomAuthorizeRequestValidator<T>(this IIdentityServerBuilder builder) where T : class, ICustomAuthorizeRequestValidator

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

AddCustomBackchannelAuthenticationRequestValidator<T>(IIdentityServerBuilder)

Registers a host's own checks on a backchannel authentication request. Duende's.

public static IIdentityServerBuilder AddCustomBackchannelAuthenticationRequestValidator<T>(this IIdentityServerBuilder builder) where T : class, ICustomBackchannelAuthenticationValidator

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

AddCustomTokenRequestValidator<T>(IIdentityServerBuilder)

Registers a host's own checks on a token request. Duende's.

public static IIdentityServerBuilder AddCustomTokenRequestValidator<T>(this IIdentityServerBuilder builder) where T : class, ICustomTokenRequestValidator

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

AddDefaultCorsPolicyService(IIdentityServerBuilder, Action<DefaultCorsPolicyService>)

Registers DefaultCorsPolicyService with the origins the host names here.

public static IIdentityServerBuilder AddDefaultCorsPolicyService(this IIdentityServerBuilder builder, Action<DefaultCorsPolicyService> configure)

Parameters

builder IIdentityServerBuilder
configure Action<DefaultCorsPolicyService>

Returns

IIdentityServerBuilder

Remarks

For a host whose browser clients' origins live in its own configuration rather than on the client registrations. AddCorsPolicyService<T>(IIdentityServerBuilder) cannot do this job: it registers the service by type, and AllowedOrigins is a property on the instance, so a host that registered the type that way got a fresh, empty, transient instance per request — a service that refused every origin whatever the host had configured, because there was nowhere to configure it. This is that missing registration; the instance is a singleton so the origins are set once.

AddInMemoryApiResources(IIdentityServerBuilder, IEnumerable<ApiResource>)

Registers in-memory API resources.

public static IIdentityServerBuilder AddInMemoryApiResources(this IIdentityServerBuilder builder, IEnumerable<ApiResource> apiResources)

Parameters

builder IIdentityServerBuilder
apiResources IEnumerable<ApiResource>

Returns

IIdentityServerBuilder

AddInMemoryApiScopes(IIdentityServerBuilder, IEnumerable<ApiScope>)

Registers in-memory API scopes.

public static IIdentityServerBuilder AddInMemoryApiScopes(this IIdentityServerBuilder builder, IEnumerable<ApiScope> apiScopes)

Parameters

builder IIdentityServerBuilder
apiScopes IEnumerable<ApiScope>

Returns

IIdentityServerBuilder

AddInMemoryClients(IIdentityServerBuilder, IEnumerable<Client>)

Registers an in-memory client store from the given clients.

public static IIdentityServerBuilder AddInMemoryClients(this IIdentityServerBuilder builder, IEnumerable<Client> clients)

Parameters

builder IIdentityServerBuilder
clients IEnumerable<Client>

Returns

IIdentityServerBuilder

AddInMemoryIdentityResources(IIdentityServerBuilder, IEnumerable<IdentityResource>)

Registers in-memory identity resources.

public static IIdentityServerBuilder AddInMemoryIdentityResources(this IIdentityServerBuilder builder, IEnumerable<IdentityResource> identityResources)

Parameters

builder IIdentityServerBuilder
identityResources IEnumerable<IdentityResource>

Returns

IIdentityServerBuilder

AddPersistedGrantStore<T>(IIdentityServerBuilder)

Registers a custom IPersistedGrantStore implementation.

public static IIdentityServerBuilder AddPersistedGrantStore<T>(this IIdentityServerBuilder builder) where T : class, IPersistedGrantStore

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

Remarks

The protection is re-applied because this registers over what AddIdentityServer() left, wrapper included. A host that replaced the store and silently lost grant-data protection with it would be the deployment that needed it most: the reason to replace the in-memory store is to keep grants somewhere they outlive the process.

AddProfileService<T>(IIdentityServerBuilder)

Registers a custom IProfileService implementation.

public static IIdentityServerBuilder AddProfileService<T>(this IIdentityServerBuilder builder) where T : class, IProfileService

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

AddRedirectUriValidator<T>(IIdentityServerBuilder)

Registers a host's own redirect URI validator. Duende's.

public static IIdentityServerBuilder AddRedirectUriValidator<T>(this IIdentityServerBuilder builder) where T : class, IRedirectUriValidator

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

AddResourceStoreCache<T>(IIdentityServerBuilder)

Registers a custom IResourceStore, cached for Duende's 15 minutes.

public static IIdentityServerBuilder AddResourceStoreCache<T>(this IIdentityServerBuilder builder) where T : class, IResourceStore

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

AddResourceStoreCache<T>(IIdentityServerBuilder, TimeSpan)

Registers a custom IResourceStore, cached. Duende's.

public static IIdentityServerBuilder AddResourceStoreCache<T>(this IIdentityServerBuilder builder, TimeSpan duration) where T : class, IResourceStore

Parameters

builder IIdentityServerBuilder

The builder.

duration TimeSpan

How long the store's resources are held before it is asked again; an edit reaches this server within it. No duration disables the cache: a host that does not want one calls AddResourceStore<T>(IIdentityServerBuilder).

Returns

IIdentityServerBuilder

Type Parameters

T

Remarks

Measured from Duende 8.0.1: T registered as itself if it is not already, and CachingResourceStore<T> in front of it as IResourceStore, in the same HybridCache as AddClientStoreCache<T>(IIdentityServerBuilder, TimeSpan).

AddResourceStore<T>(IIdentityServerBuilder)

Registers a custom IResourceStore implementation.

public static IIdentityServerBuilder AddResourceStore<T>(this IIdentityServerBuilder builder) where T : class, IResourceStore

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

AddScopeParser<T>(IIdentityServerBuilder)

Registers a host's own scope parser, for parameterized scopes. Duende's.

public static IIdentityServerBuilder AddScopeParser<T>(this IIdentityServerBuilder builder) where T : class, IScopeParser

Parameters

builder IIdentityServerBuilder

Returns

IIdentityServerBuilder

Type Parameters

T

AddTestUsers(IIdentityServerBuilder, IEnumerable<TestUser>)

Registers in-memory test users, the matching profile service, and a CIBA user validator over them.

public static IIdentityServerBuilder AddTestUsers(this IIdentityServerBuilder builder, IEnumerable<TestUser> users)

Parameters

builder IIdentityServerBuilder
users IEnumerable<TestUser>

Returns

IIdentityServerBuilder

Remarks

The store as ITestUserStore and as itself, so a development page can reach CreateUser(string, string, string?, string?), as Duende registers it. And Duende's TestBackchannelLoginUserValidator since 0.150.0, but with TryAdd where Duende's adds: a host's own validator is kept whichever it registers first.