Class AuthenticationServiceExtensions
- Namespace
- ProjectTemplate.Web.Authentication.Extensions
- Assembly
- ProjectTemplate.Web.dll
Provides extension methods for registering and applying application authentication services.
public static class AuthenticationServiceExtensions
- Inheritance
-
AuthenticationServiceExtensions
- Inherited Members
Fields
AuthenticationCookieName
The authentication cookie name used when the Development-only insecure HTTP override is active.
public const string AuthenticationCookieName = ".ProjectTemplate.Web.Authentication"
Field Value
HostPrefixedAuthenticationCookieName
The authentication cookie name used when the cookie is always sent with the Secure attribute.
public const string HostPrefixedAuthenticationCookieName = "__Host-ProjectTemplate.Web.Authentication"
Field Value
Methods
AddApplicationAuthentication(IServiceCollection, IConfiguration)
Adds application authentication services based on configuration using the secure cookie policy without an environment-specific plain HTTP override.
public static IServiceCollection AddApplicationAuthentication(this IServiceCollection services, IConfiguration configuration)
Parameters
servicesIServiceCollectionThe service collection to add authentication services to.
configurationIConfigurationThe application configuration source.
Returns
- IServiceCollection
The same IServiceCollection instance for chaining.
AddApplicationAuthentication(IServiceCollection, IConfiguration, IHostEnvironment?)
Adds application authentication services based on configuration and the current hosting environment.
public static IServiceCollection AddApplicationAuthentication(this IServiceCollection services, IConfiguration configuration, IHostEnvironment? environment)
Parameters
servicesIServiceCollectionThe service collection to add authentication services to.
configurationIConfigurationThe application configuration source.
environmentIHostEnvironmentThe current hosting environment.
Returns
- IServiceCollection
The same IServiceCollection instance for chaining.
UseApplicationAuthentication(IApplicationBuilder)
Applies application authentication middleware when authentication is enabled.
public static IApplicationBuilder UseApplicationAuthentication(this IApplicationBuilder app)
Parameters
appIApplicationBuilderThe application builder.
Returns
- IApplicationBuilder
The same IApplicationBuilder instance for chaining.