系列:
https://www.cnblogs.com/stulzq/p/8119928.html
自定义认证token
https://www.cnblogs.com/stulzq/p/8726002.html
https://www.cnblogs.com/CreateMyself/p/9399118.html
与API集成
https://www.cnblogs.com/stulzq/p/10346095.html
https://identityserver4.readthedocs.io/en/latest/topics/add_apis.html
scope设置
https://github.com/IdentityServer/IdentityServer4/blob/main/src/IdentityServer4/host/Configuration/Resources.cs
https://www.cnblogs.com/xhznl/p/13223964.html
jwt
https://www.cnblogs.com/bruce1992/p/14065582.html
nginx转发设置
https://github.com/IdentityServer/IdentityServer4/issues/4631
#identityserver使用ForwardedHeaders
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
});
app.UseForwardedHeaders();
#如果identityserver转发至网站的子路径中
app.Use(async (ctx, next) =>
{
string prefix = ctx.Request.Headers["X-Forwarded-Prefix"];
if(!string.IsNullOrWhiteSpace(prefix))
{
string host = ctx.Request.Host.Value;
ctx.Request.Host = new HostString($"{host}/{prefix}");
}
await next();
});
#nginx设置:
location /msg/ {
proxy_pass http://ip:port/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Prefix msg;
}