|
|
|
@ -104,6 +104,29 @@ public sealed class OpenIddictCoreBuilder |
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Replaces the application store by the specified type.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// Note: the specified type MUST be an open generic type definition containing exactly one generic argument.
|
|
|
|
/// </remarks>
|
|
|
|
/// <param name="type">The type of the store.</param>
|
|
|
|
/// <param name="lifetime">The lifetime of the store.</param>
|
|
|
|
/// <returns>The <see cref="OpenIddictCoreBuilder"/> instance.</returns>
|
|
|
|
public OpenIddictCoreBuilder ReplaceApplicationStore( |
|
|
|
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type, |
|
|
|
ServiceLifetime lifetime = ServiceLifetime.Scoped) |
|
|
|
{ |
|
|
|
if (!type.IsGenericTypeDefinition || type.GetGenericArguments() is not { Length: 1 }) |
|
|
|
{ |
|
|
|
throw new ArgumentException(SR.GetResourceString(SR.ID0232), nameof(type)); |
|
|
|
} |
|
|
|
|
|
|
|
Services.Replace(ServiceDescriptor.Describe(typeof(IOpenIddictApplicationStore<>), type, lifetime)); |
|
|
|
|
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Replaces the authorization manager by the specified type.
|
|
|
|
/// </summary>
|
|
|
|
@ -161,6 +184,29 @@ public sealed class OpenIddictCoreBuilder |
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Replaces the authorization store by the specified type.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// Note: the specified type MUST be an open generic type definition containing exactly one generic argument.
|
|
|
|
/// </remarks>
|
|
|
|
/// <param name="type">The type of the store.</param>
|
|
|
|
/// <param name="lifetime">The lifetime of the store.</param>
|
|
|
|
/// <returns>The <see cref="OpenIddictCoreBuilder"/> instance.</returns>
|
|
|
|
public OpenIddictCoreBuilder ReplaceAuthorizationStore( |
|
|
|
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type, |
|
|
|
ServiceLifetime lifetime = ServiceLifetime.Scoped) |
|
|
|
{ |
|
|
|
if (!type.IsGenericTypeDefinition || type.GetGenericArguments() is not { Length: 1 }) |
|
|
|
{ |
|
|
|
throw new ArgumentException(SR.GetResourceString(SR.ID0232), nameof(type)); |
|
|
|
} |
|
|
|
|
|
|
|
Services.Replace(ServiceDescriptor.Describe(typeof(IOpenIddictAuthorizationStore<>), type, lifetime)); |
|
|
|
|
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Replaces the scope manager by the specified type.
|
|
|
|
/// </summary>
|
|
|
|
@ -218,6 +264,29 @@ public sealed class OpenIddictCoreBuilder |
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Replaces the scope store by the specified type.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// Note: the specified type MUST be an open generic type definition containing exactly one generic argument.
|
|
|
|
/// </remarks>
|
|
|
|
/// <param name="type">The type of the store.</param>
|
|
|
|
/// <param name="lifetime">The lifetime of the store.</param>
|
|
|
|
/// <returns>The <see cref="OpenIddictCoreBuilder"/> instance.</returns>
|
|
|
|
public OpenIddictCoreBuilder ReplaceScopeStore( |
|
|
|
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type, |
|
|
|
ServiceLifetime lifetime = ServiceLifetime.Scoped) |
|
|
|
{ |
|
|
|
if (!type.IsGenericTypeDefinition || type.GetGenericArguments() is not { Length: 1 }) |
|
|
|
{ |
|
|
|
throw new ArgumentException(SR.GetResourceString(SR.ID0232), nameof(type)); |
|
|
|
} |
|
|
|
|
|
|
|
Services.Replace(ServiceDescriptor.Describe(typeof(IOpenIddictScopeStore<>), type, lifetime)); |
|
|
|
|
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Replaces the token manager by the specified type.
|
|
|
|
/// </summary>
|
|
|
|
@ -275,6 +344,29 @@ public sealed class OpenIddictCoreBuilder |
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Replaces the token store by the specified type.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// Note: the specified type MUST be an open generic type definition containing exactly one generic argument.
|
|
|
|
/// </remarks>
|
|
|
|
/// <param name="type">The type of the store.</param>
|
|
|
|
/// <param name="lifetime">The lifetime of the store.</param>
|
|
|
|
/// <returns>The <see cref="OpenIddictCoreBuilder"/> instance.</returns>
|
|
|
|
public OpenIddictCoreBuilder ReplaceTokenStore( |
|
|
|
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type, |
|
|
|
ServiceLifetime lifetime = ServiceLifetime.Scoped) |
|
|
|
{ |
|
|
|
if (!type.IsGenericTypeDefinition || type.GetGenericArguments() is not { Length: 1 }) |
|
|
|
{ |
|
|
|
throw new ArgumentException(SR.GetResourceString(SR.ID0232), nameof(type)); |
|
|
|
} |
|
|
|
|
|
|
|
Services.Replace(ServiceDescriptor.Describe(typeof(IOpenIddictTokenStore<>), type, lifetime)); |
|
|
|
|
|
|
|
return this; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Disables additional filtering so that the OpenIddict managers don't execute a second check
|
|
|
|
/// to ensure the results returned by the stores exactly match the specified query filters,
|
|
|
|
|