Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ public static IServiceCollection AddSharkAuthentication(
.AddAuthentication(Scheme.Bearer)
.AddScheme<BearerTokenAuthenticationOptions, BearerTokenAuthenticationHandler>(
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ private static IServiceCollection AddCustomAuthentication(
services.Configure<AuthorizationServerSecurityConfiguration>(
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).
Expand All @@ -80,7 +71,7 @@ private static IServiceCollection AddCustomAuthentication(
.AddAuthentication(Scheme.Basic)
.AddScheme<BasicAuthenticationOptions, BasicAuthenticationHandler>(
Scheme.Basic,
options => options = basicAuthenticationOptions);
options => { });

services
.AddAuthorizationBuilder()
Expand All @@ -92,7 +83,7 @@ private static IServiceCollection AddCustomAuthentication(
.AddAuthentication(Scheme.ClientToken)
.AddScheme<ClientTokenAuthenticationOptions, ClientTokenAuthenticationHandler>(
Scheme.ClientToken,
options => options = clientTokenAuthenticationOptions);
options => { });

// Bearer token authentication.
services.AddTransient<ISecurityKeyProvider, SecurityKeyLocalProvider>();
Expand Down