services.AddAuthentication("Bearer")
.AddJwtBearer(x =>
{
x.Authority = ConfigHelper.GetValue("IdentityServer");//公网
x.RequireHttpsMetadata = false;
x.Audience = "Xmg.Iot.ApiResource";
x.MetadataAddress = ConfigHelper.GetValue("IdentityServer") + "/.well-known/openid-configuration";
x.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters
{
ValidateIssuer = true,
ValidIssuer = "http://www.baidu.com"
};
IdentityModelEventSource.ShowPII = true;
});

 

.UseAuthentication()
.UseAuthorization()

 

 

services.AddIdentityServer(option =>
{
option.IssuerUri = "http://www.baidu.com";// needupdate
})

app.Use(async (ctx, next) =>//解决nginx配置问题
{
//ctx.SetIdentityServerOrigin(ConfigHelper.GetValue("IdentityServer"));
ctx.SetIdentityServerOrigin("https://公网访问地址"); //needupdate
await next();
});