diff --git a/src/Shark.AuthorizationServer.Sdk/Extensions/ApplicationBuilderExtentions.cs b/src/Shark.AuthorizationServer.Sdk/Extensions/ApplicationBuilderExtentions.cs index 6831871..766c6bc 100644 --- a/src/Shark.AuthorizationServer.Sdk/Extensions/ApplicationBuilderExtentions.cs +++ b/src/Shark.AuthorizationServer.Sdk/Extensions/ApplicationBuilderExtentions.cs @@ -42,7 +42,16 @@ public static IServiceCollection AddSharkAuthentication( .AddAuthentication(Scheme.Bearer) .AddScheme( Scheme.Bearer, - options => options = bearerTokenAuthenticationOptions); + options => + { + options.AuthorizationServerUri = bearerTokenAuthenticationOptions.AuthorizationServerUri; + options.Issuer = bearerTokenAuthenticationOptions.Issuer; + options.ValidateIssuer = bearerTokenAuthenticationOptions.ValidateIssuer; + options.Audience = bearerTokenAuthenticationOptions.Audience; + options.ValidateAudience = bearerTokenAuthenticationOptions.ValidateAudience; + options.TokenIntrospection = bearerTokenAuthenticationOptions.TokenIntrospection; + options.RetryConfiguration = bearerTokenAuthenticationOptions.RetryConfiguration; + }); return services; } diff --git a/src/Shark.AuthorizationServer/Extensions/ApplicationBuilderExtentions.cs b/src/Shark.AuthorizationServer/Extensions/ApplicationBuilderExtentions.cs index 643e785..feb12ba 100644 --- a/src/Shark.AuthorizationServer/Extensions/ApplicationBuilderExtentions.cs +++ b/src/Shark.AuthorizationServer/Extensions/ApplicationBuilderExtentions.cs @@ -48,15 +48,6 @@ private static IServiceCollection AddCustomAuthentication( services.Configure( configuration.GetSection(AuthorizationServerSecurityConfiguration.Name)); - var authorizationServerConfiguration = new AuthorizationServerConfiguration(); - configuration.GetSection(AuthorizationServerConfiguration.Name).Bind(authorizationServerConfiguration); - - var basicAuthenticationOptions = new BasicAuthenticationOptions(); - configuration.GetSection(BasicAuthenticationOptions.Name).Bind(basicAuthenticationOptions); - - var clientTokenAuthenticationOptions = new ClientTokenAuthenticationOptions(); - configuration.GetSection(ClientTokenAuthenticationOptions.Name).Bind(clientTokenAuthenticationOptions); - // Authentication session (cookie). // Cookies scheme is used to extract user identity from authentication cookies. // However, None scheme is used to support non-browser-based flows (without user). @@ -80,7 +71,7 @@ private static IServiceCollection AddCustomAuthentication( .AddAuthentication(Scheme.Basic) .AddScheme( Scheme.Basic, - options => options = basicAuthenticationOptions); + options => { }); services .AddAuthorizationBuilder() @@ -92,7 +83,7 @@ private static IServiceCollection AddCustomAuthentication( .AddAuthentication(Scheme.ClientToken) .AddScheme( Scheme.ClientToken, - options => options = clientTokenAuthenticationOptions); + options => { }); // Bearer token authentication. services.AddTransient();