我目前正在关注identityserver doc:
https://identityserver4.readthedocs.io/en/release/quickstarts/3_interactive_login.html
我想在同意页面添加额外的身份范围(电子邮件),问题是为什么客户端OpenIdConnectOptions中的范围是只读的?
services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
})
.AddCookie("Cookies")
.AddOpenIdConnect("oidc", options =>
{
options.SignInScheme = "Cookies";
options.Authority = "http://localhost:5000";
options.RequireHttpsMetadata = false;
options.Resource = "openid profile email";
**options.Scope= // why this readonly ?**
options.ClientId = "mvc";
options.SaveTokens = true;
});
这导致请求的范围仅限配置文件和openid。 http://localhost:5000/account/login?returnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3Dmvc%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A5002%252Fsignin-oidc%26resource%3Dopenid%2520profile%2520email%26response_type%3Did_token%26 范围%3Dopenid%2520profile%26 其余的省略
有什么想法吗?
答案 0 :(得分:1)
在IdentityServer4 v2中,Scope参数是一个集合。添加这样的范围:
options.Scope.Add("myscope");