-
-
Save chriskuech/b920f84b8f51cd346fdd7363aa68b9a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
var thisServiceUrl = "https://myotherservice.myorg.com"; // Read from appsettings instead. | |
... // configure services for your application | |
// configure services for authentication | |
services | |
.AddAuthentication(options => | |
{ | |
option.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; | |
option.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; | |
}) | |
.AddJwtBearer(options => | |
{ | |
options.Audience = thisServiceUrl; | |
options.Authority = Constants.Issuer; | |
options.TokenValidationParameters = new TokenValidationParameters | |
{ | |
ValidateAudience = true, | |
ValidateIssuer = true, | |
ValidateIssuerSigningKey = true, | |
ValidateLifetime = true, | |
}; | |
}); | |
return services; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment