LogtoClientBuilder Methods
ClassMethods3 members
Provides methods to configure and add Logto client services to an application builder.
AddLogtoJwtBearer(AuthenticationBuilder, string, string, string, string?, Action<JwtBearerOptions>) Section titled AddLogtoJwtBearer(AuthenticationBuilder, string, string, string, string?, Action<JwtBearerOptions>)extensionAuthenticationBuilder Configures and adds the Logto JSON Web Token (JWT) Bearer authentication to the specified authentication builder.
public static class LogtoClientBuilder{ public static AuthenticationBuilder AddLogtoJwtBearer( this AuthenticationBuilder builder, string serviceName, string appIdentification, string authenticationScheme = "Bearer", string? configurationSectionName = "Aspire:Logto:Client", Action<JwtBearerOptions>? configureOptions = null) { // ... }}Parameters
builderAuthenticationBuilder The authentication builder used to configure authentication services.serviceName stringThe name of the Logto service instance to be used for authentication.appIdentification stringA collection of application identifiers associated with the Logto service.authenticationScheme stringoptional The authentication scheme identifier for the Logto JWT Bearer authentication. Defaults to "Bearer". configurationSectionName string?optional The name of the configuration section that contains Logto client settings. Defaults to "Aspire:Logto:Client". configureOptions Action<JwtBearerOptions> optional A delegate to configure the options for JWT bearer authentication. Returns
AuthenticationBuilder An updated Authentication.AuthenticationBuilder instance with the configured Logto JWT Bearer authentication. Exceptions
ArgumentNullExceptionThrown when the builder or serviceName is null.AddLogtoJwtBearer(AuthenticationBuilder, string, IEnumerable<string>, string, string?, Action<JwtBearerOptions>) Section titled AddLogtoJwtBearer(AuthenticationBuilder, string, IEnumerable<string>, string, string?, Action<JwtBearerOptions>)extensionAuthenticationBuilder Configures and adds the Logto JSON Web Token (JWT) Bearer authentication for the specified application.
public static class LogtoClientBuilder{ public static AuthenticationBuilder AddLogtoJwtBearer( this AuthenticationBuilder builder, string serviceName, IEnumerable<string> appIdentification, string authenticationScheme = "Bearer", string? configurationSectionName = "Aspire:Logto:Client", Action<JwtBearerOptions>? configureOptions = null) { // ... }}Parameters
builderAuthenticationBuilder The authentication builder used to configure the application's authentication services. serviceName string The name of the service associated with Logto configuration. appIdentification IEnumerable<string> A collection of application identifiers (audiences) used to validate the JWT's audience claim. authenticationScheme stringoptional The authentication scheme identifier for the Logto JWT Bearer authentication. Defaults to "Bearer". configurationSectionName string?optional The name of the configuration section that contains Logto client settings. Defaults to "Aspire:Logto:Client". configureOptions Action<JwtBearerOptions> optional A delegate to configure additional JwtBearerOptions as needed for specific authentication behavior. Returns
AuthenticationBuilder An updated Authentication.AuthenticationBuilder instance with the configured Logto JWT Bearer authentication. Exceptions
ArgumentNullExceptionThrown when the builder is null.InvalidOperationException Thrown when serviceName or appIdentification is missing or invalid. AddLogtoOIDC(IHostApplicationBuilder, string?, string?, string, string, Action<LogtoOptions>, Action<OpenIdConnectOptions>) Section titled AddLogtoOIDC(IHostApplicationBuilder, string?, string?, string, string, Action<LogtoOptions>, Action<OpenIdConnectOptions>)extensionIServiceCollection Configures and adds the Logto OpenID Connect (OIDC) authentication for the specified application's service collection.
public static class LogtoClientBuilder{ public static IServiceCollection AddLogtoOIDC( this IHostApplicationBuilder builder, string? connectionName = null, string? configurationSectionName = "Aspire:Logto:Client", string authenticationScheme = "Logto", string cookieScheme = "Logto.Cookie", Action<LogtoOptions>? logtoOptions = null, Action<OpenIdConnectOptions>? oidcOptions = null) { // ... }}Parameters
builderIHostApplicationBuilder The application builder used to configure the application's services and pipeline.connectionName string?optionalThe name of the connection configuration to be used. If null, a default connection is used.configurationSectionName string?optional The name of the configuration section that contains Logto client settings. Defaults to "Aspire:Logto:Client". authenticationScheme stringoptional The authentication scheme identifier for the Logto OIDC authentication. Defaults to "Logto". cookieScheme stringoptional The cookie scheme name to be used with the Logto OIDC authentication. Defaults to "Logto.Cookie". logtoOptions Action<LogtoOptions> optional A delegate to configure Logto-specific options such as endpoint, application ID, or secret. oidcOptions Action<OpenIdConnectOptions> optional A delegate to configure OpenID Connect options for fine-tuning authentication behavior. Returns
IServiceCollection An updated DependencyInjection.IServiceCollection instance with the configured Logto OIDC authentication. Exceptions
ArgumentNullExceptionThrown when the builder is null.