は、私がOAuth 2.0
とOpen Id Connect
を学んだし、今私は問題を抱えていると主張:私は彼のためにInMemoryUser
および特許請求の範囲を作成しているのOAuth 2.0とオープンIdを接続するには、問題
:
return new List<InMemoryUser>()
{
new InMemoryUser()
{
Username = "SomeName",
Password = "SomePassword",
Subject = "b05d3546-6ca8-4d32-b95c-77e94d705ddf",
Claims = new Claim[]
{
new Claim(IdentityServer3.Core.Constants.ClaimTypes.GivenName, "MyGivenName"),
new Claim(IdentityServer3.Core.Constants.ClaimTypes.FamilyName, "MyFamilyName"),
}
}
}
id_token
で提示クレームが存在しません
マイスコープ:
return new List<Scope>()
{
StandardScopes.OpenId,
StandardScopes.Profile,
new Scope()
{
Name = "somename",
DisplayName = "some display name",
Description = "some description",
Type = ScopeType.Resource
}
};
また、私が作成したMVCクライアントとStartup
クラスやでcludedプロフィールscope
:
public void Configuration(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions()
{
ClientId = "TripsHybrid",
Authority = Constants.Constants.TripsSts,
RedirectUri = Constants.Constants.TripsMvc,
SignInAsAuthenticationType = "Cookies",
ResponseType = "code id_token token",
Scope = "openid profile", // "profile" scope inсluded
}
}
しかし、私はid_token
を取得し、それをデコードしたときに、私のInMemoryUser
の作成中に、私が設定したクレームが存在しません。また、クレームがDebug
にそれらを印刷した後User.Identity.Claims
ではありません。
if (this.User.Identity.IsAuthenticated)
{
Debug.WriteLine("Claims:");
var identity = this.User.Identity as ClaimsIdentity;
foreach (var claim in identity.Claims)
{
Debug.WriteLine(claim.Type + " - " + claim.Value);
}
}
してください、その理由を見つけて、id_token
にクレームを追加するために私を助けて。おかげ
それは役に立たなかった。 IDトークンにクレームがありません –