source/App/source/WebApp.SimpleInjector/ContainerExtensions.cs
/// <summary>
/// Adds registrations of JwtTokenMiddleware and corresponding dependencies.
/// </summary>
/// <param name="container">Simple Injector Container</param>
/// <param name="metadataAddress">OpenID Configuration URL used for acquiring metadata</param>
/// <param name="audience">Audience used for validation of JWT token</param>
Adds registrations of JwtTokenMiddleware and corresponding dependencies.
Adds registrations of JwtTokenMiddleware and corresponding dependencies .
public static void AddJwtTokenSecurity(this Container container, string metadataAddress, string audience)
        {
            container.Register<JwtTokenMiddleware>(Lifestyle.Scoped);
            container.Register<IJwtTokenValidator, JwtTokenValidator>(Lifestyle.Scoped);
            container.Register<IClaimsPrincipalAccessor, ClaimsPrincipalAccessor>(Lifestyle.Scoped);
            container.Register<ClaimsPrincipalContext>(Lifestyle.Scoped);
            container.Register(() => new OpenIdSettings(metadataAddress, audience));
        }
public static void AddJwtTokenSecurity ( this Container container , string metadataAddress , string audience ) { container . Register < JwtTokenMiddleware > ( Lifestyle . Scoped ) ; container . Register < IJwtTokenValidator , JwtTokenValidator > ( Lifestyle . Scoped ) ; container . Register < IClaimsPrincipalAccessor , ClaimsPrincipalAccessor > ( Lifestyle . Scoped ) ; container . Register < ClaimsPrincipalContext > ( Lifestyle . Scoped ) ; container . Register ( ( ) => new OpenIdSettings ( metadataAddress , audience ) ) ; }
Adds registrations of JwtTokenMiddleware and corresponding dependencies.
Adds registrations of JwtTokenMiddleware and corresponding dependencies .
Container
this
metadataAddress
string
OpenID Configuration URL used for acquiring metadata
OpenID Configuration URL used for acquiring metadata
audience
string
Audience used for validation of JWT token
Audience used for validation of JWT token
container
Simple Injector Container
Simple Injector Container