我使用ASP.NET Core成功设置IdentityServer4。如何配置IdentityServerAuthenticationOptions.Authority以使用通配符
作为默认的配置我有这样的:
IdentityServerAuthenticationOptions options = new IdentityServerAuthenticationOptions()
{
Authority = "http://localhost:5000",
ScopeName = "scope",
ScopeSecret = "ScopeSecret",
AutomaticAuthenticate = true,
AutomaticChallenge = true,
RequireHttpsMetadata = false,
};
现在,使用这个guide我配置为从配置文件中读取,所以他们可以在生产的任何数字。
例如,如果我将API设置为在http://*:5000
上运行,则客户端可以通过服务IP地址(如http://192.168.1.100:5000
)连接到它。
一旦客户端获取承载令牌,并尝试使用它,一个Internal Server Error
occures与此异常:
Unable to obtain configuration from:
'http://*:5000/.well-known/openid-configuration'.
---> System.IO.IOException: IDX10804: Unable to retrieve document from: 'http://*:5000/.well-known/openid-configuration'.
---> System.UriFormatException: Invalid URI: The hostname could not be parsed.
什么是配置IdS4拥有动态权限正确的方法是什么?
更新
看来问题是发行人,对此有什么想法?
Microsoft.IdentityModel.Tokens.SecurityTokenInvalidIssuerException:
IDX10205: Issuer validation failed. Issuer: 'http://192.168.1.100:5000'. Did not match: validationParameters.ValidIssuer: 'http://localhost:5000' or validationParameters.ValidIssuers: 'null'.
at Microsoft.IdentityModel.Tokens.Validators.ValidateIssuer(String issuer, SecurityToken securityToken, TokenValidationParameters validationParameters)