My IdentityServer and ApiResource in the same project, and develop in sub domain like
I have reference this code, but only can config one IdentityServer address, how can I change the Authority property dynamic, follow current requestContext Uri?
{
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
// base-address of your identityserver
options.Authority = "https://demo.identityserver.io";
// if you are using API resources, you can specify the name here
options.Audience = "resource1";
// IdentityServer emits a typ header by default, recommended extra check
options.TokenValidationParameters.ValidTypes = new[] { "at+jwt" };
});
}
}
These options must have a TokenValidationParameters property of type TokenValidationParameters which has a property named IssuerValidator where you can put your own validation delegate. Also there is ValidIssuers property where you can put a list of all valid issuers. You can check everything here: https://docs.microsoft.com/en-us/dotnet/api/microsoft.identitymodel.tokens.tokenvalidationparameters?view=azure-dotnet .
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
These options must have a
TokenValidationParametersproperty of typeTokenValidationParameterswhich has a property namedIssuerValidatorwhere you can put your own validation delegate. Also there isValidIssuersproperty where you can put a list of all valid issuers. You can check everything here: https://docs.microsoft.com/en-us/dotnet/api/microsoft.identitymodel.tokens.tokenvalidationparameters?view=azure-dotnet .