Show / Hide Table of Contents

Class OpenIddictValidationBuilder

Exposes the necessary methods required to configure the OpenIddict validation services.

Inheritance
System.Object
OpenIddictValidationBuilder
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Microsoft.Extensions.DependencyInjection
Assembly: cs.temp.dll.dll
Syntax
public class OpenIddictValidationBuilder

Constructors

OpenIddictValidationBuilder(IServiceCollection)

Initializes a new instance of OpenIddictValidationBuilder.

Declaration
public OpenIddictValidationBuilder(IServiceCollection services)
Parameters
Type Name Description
IServiceCollection services

The services collection.

Properties

Services

Gets the services collection.

Declaration
public IServiceCollection Services { get; }
Property Value
Type Description
IServiceCollection

Methods

AddAudiences(String[])

Registers the specified values as valid audiences. Setting the audiences is recommended when the authorization server issues access tokens for multiple distinct resource servers.

Declaration
public OpenIddictValidationBuilder AddAudiences(params string[] audiences)
Parameters
Type Name Description
System.String[] audiences

The audiences valid for this resource server.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

AddEncryptionCertificate(Assembly, String, String)

Registers an encryption certificate retrieved from an embedded resource.

Declaration
public OpenIddictValidationBuilder AddEncryptionCertificate(Assembly assembly, string resource, string password)
Parameters
Type Name Description
Assembly assembly

The assembly containing the certificate.

System.String resource

The name of the embedded resource.

System.String password

The password used to open the certificate.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

AddEncryptionCertificate(Assembly, String, String, X509KeyStorageFlags)

Registers an encryption certificate retrieved from an embedded resource.

Declaration
public OpenIddictValidationBuilder AddEncryptionCertificate(Assembly assembly, string resource, string password, X509KeyStorageFlags flags)
Parameters
Type Name Description
Assembly assembly

The assembly containing the certificate.

System.String resource

The name of the embedded resource.

System.String password

The password used to open the certificate.

X509KeyStorageFlags flags

An enumeration of flags indicating how and where to store the private key of the certificate.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

AddEncryptionCertificate(Stream, String)

Registers an encryption certificate extracted from a stream.

Declaration
public OpenIddictValidationBuilder AddEncryptionCertificate(Stream stream, string password)
Parameters
Type Name Description
Stream stream

The stream containing the certificate.

System.String password

The password used to open the certificate.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

AddEncryptionCertificate(Stream, String, X509KeyStorageFlags)

Registers an encryption certificate extracted from a stream.

Declaration
public OpenIddictValidationBuilder AddEncryptionCertificate(Stream stream, string password, X509KeyStorageFlags flags)
Parameters
Type Name Description
Stream stream

The stream containing the certificate.

System.String password

The password used to open the certificate.

X509KeyStorageFlags flags

An enumeration of flags indicating how and where to store the private key of the certificate.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

AddEncryptionCertificate(String)

Registers an encryption certificate retrieved from the X.509 user or machine store.

Declaration
public OpenIddictValidationBuilder AddEncryptionCertificate(string thumbprint)
Parameters
Type Name Description
System.String thumbprint

The thumbprint of the certificate used to identify it in the X.509 store.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

AddEncryptionCertificate(String, StoreName, StoreLocation)

Registers an encryption certificate retrieved from the specified X.509 store.

Declaration
public OpenIddictValidationBuilder AddEncryptionCertificate(string thumbprint, StoreName name, StoreLocation location)
Parameters
Type Name Description
System.String thumbprint

The thumbprint of the certificate used to identify it in the X.509 store.

StoreName name

The name of the X.509 store.

StoreLocation location

The location of the X.509 store.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

AddEncryptionCertificate(X509Certificate2)

Registers an encryption certificate.

Declaration
public OpenIddictValidationBuilder AddEncryptionCertificate(X509Certificate2 certificate)
Parameters
Type Name Description
X509Certificate2 certificate

The encryption certificate.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

AddEncryptionCredentials(EncryptingCredentials)

Registers encryption credentials.

Declaration
public OpenIddictValidationBuilder AddEncryptionCredentials(EncryptingCredentials credentials)
Parameters
Type Name Description
EncryptingCredentials credentials

The encrypting credentials.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

AddEncryptionKey(SecurityKey)

Registers an encryption key.

Declaration
public OpenIddictValidationBuilder AddEncryptionKey(SecurityKey key)
Parameters
Type Name Description
SecurityKey key

The security key.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

AddEventHandler(OpenIddictValidationHandlerDescriptor)

Registers an event handler using the specified descriptor.

Declaration
public OpenIddictValidationBuilder AddEventHandler(OpenIddictValidationHandlerDescriptor descriptor)
Parameters
Type Name Description
OpenIddictValidationHandlerDescriptor descriptor

The handler descriptor.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

AddEventHandler<TContext>(Action<OpenIddictValidationHandlerDescriptor.Builder<TContext>>)

Registers an event handler using the specified configuration delegate.

Declaration
public OpenIddictValidationBuilder AddEventHandler<TContext>(Action<OpenIddictValidationHandlerDescriptor.Builder<TContext>> configuration)
    where TContext : OpenIddictValidationEvents.BaseContext
Parameters
Type Name Description
System.Action<OpenIddictValidationHandlerDescriptor.Builder<TContext>> configuration

The configuration delegate.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

Type Parameters
Name Description
TContext

The event context type.

Configure(Action<OpenIddictValidationOptions>)

Amends the default OpenIddict validation configuration.

Declaration
public OpenIddictValidationBuilder Configure(Action<OpenIddictValidationOptions> configuration)
Parameters
Type Name Description
System.Action<OpenIddictValidationOptions> configuration

The delegate used to configure the OpenIddict options.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

Remarks

This extension can be safely called multiple times.

EnableAuthorizationEntryValidation()

Enables authorization validation so that a database call is made for each API request to ensure the authorization associated with the access token is still valid. Note: enabling this option may have an impact on performance and can only be used with an OpenIddict-based authorization server.

Declaration
public OpenIddictValidationBuilder EnableAuthorizationEntryValidation()
Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

EnableTokenEntryValidation()

Enables token validation so that a database call is made for each API request to ensure the token entry associated with the access token is still valid. Note: enabling this option may have an impact on performance but is required when the OpenIddict server is configured to use reference tokens.

Declaration
public OpenIddictValidationBuilder EnableTokenEntryValidation()
Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

RemoveEventHandler(OpenIddictValidationHandlerDescriptor)

Removes the event handler that matches the specified descriptor.

Declaration
public OpenIddictValidationBuilder RemoveEventHandler(OpenIddictValidationHandlerDescriptor descriptor)
Parameters
Type Name Description
OpenIddictValidationHandlerDescriptor descriptor

The descriptor corresponding to the handler to remove.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

SetClientId(String)

Sets the client identifier client_id used when communicating with the remote authorization server (e.g for introspection).

Declaration
public OpenIddictValidationBuilder SetClientId(string identifier)
Parameters
Type Name Description
System.String identifier

The client identifier.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

SetClientSecret(String)

Sets the client identifier client_secret used when communicating with the remote authorization server (e.g for introspection).

Declaration
public OpenIddictValidationBuilder SetClientSecret(string secret)
Parameters
Type Name Description
System.String secret

The client secret.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

SetConfiguration(OpenIdConnectConfiguration)

Sets a static OpenID Connect server configuration, that will be used to resolve the metadata/introspection endpoints and the issuer signing keys.

Declaration
public OpenIddictValidationBuilder SetConfiguration(OpenIdConnectConfiguration configuration)
Parameters
Type Name Description
OpenIdConnectConfiguration configuration

The server configuration.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

SetIssuer(String)

Sets the issuer address, which is used to determine the actual location of the OAuth 2.0/OpenID Connect configuration document when using provider discovery.

Declaration
public OpenIddictValidationBuilder SetIssuer(string address)
Parameters
Type Name Description
System.String address

The issuer address.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

SetIssuer(Uri)

Sets the issuer address, which is used to determine the actual location of the OAuth 2.0/OpenID Connect configuration document when using provider discovery.

Declaration
public OpenIddictValidationBuilder SetIssuer(Uri address)
Parameters
Type Name Description
Uri address

The issuer address.

Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

UseIntrospection()

Configures OpenIddict to use introspection instead of local/direct validation.

Declaration
public OpenIddictValidationBuilder UseIntrospection()
Returns
Type Description
OpenIddictValidationBuilder

The OpenIddictValidationBuilder.

In This Article
Back to top Generated by DocFX