遇到的问题
资源服务的配置
{
"App": {
"CorsOrigins": "https://*.BlogMgt.com,http://localhost:8848,http://localhost:3000"
},
"AuthServer": {
// 重点 Authority 要指向 授权服务器的地址 部署后要是部署后的地址
"Authority": "https://localhost:44357",
// 指定颁发人
"IssuerUri": "https://xxxx.com:7073",
// 如果关闭https 那么吧这个设置成false
"RequireHttpsMetadata": "true",
"SwaggerClientId": "BlogMgt_Swagger",
"SwaggerClientSecret": "1q2w3e*"
},
"StringEncryption": {
"DefaultPassPhrase": "Ry4RyvH5WNzXMLaV"
}
}
2 代码配置
XXXtHttpApiHostModule.cs 文件下 添加 PostConfigureServices 并在 ConfigureServices 方法中引用
public override void PostConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
// 配置IssuerUri 为指定颁发者
PostConfigure<IdentityServerOptions>(options =>
{
options.IssuerUri = configuration["AuthServer:IssuerUri"];
});
}
授权中心的配置
{
"App": {
// SelfUrl 要对应上你部署的端口
"SelfUrl": "https://localhost:44357",
"ClientUrl": "http://localhost:8848",
"CorsOrigins": "https://*.域名.com,http://localhost:8848,https://localhost:44332,https://localhost:44340",
"RedirectAllowedUrls": "http://localhost:8848,https://localhost:44397,https://localhost:44332,https://localhost:44325"
},
"StringEncryption": {
"DefaultPassPhrase": "Ry4RyvH5WNzXMLaV"
}
}