私は紺碧やトークンなどが新です... 私はMicrosoftのドキュメントとgoogleとstackoverflowを "掘り下げ"ましたが、それでも完全な理解は得られませんでした。Azure OpenIdトークンの検証
私はWebアプリケーション(VS2013 .net 4.5.1)からazureに接続するためにOwinライブラリでopenIdを使用しています。
public void Configuration(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(
CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
MetadataAddress = String.Format(aadInstance, tenant, policy),
AuthenticationType = policy,
ClientId = clientId,
RedirectUri = redirectUri,
PostLogoutRedirectUri = redirectUri,
Notifications = new OpenIdConnectAuthenticationNotifications
{
AuthenticationFailed = AuthenticationFailed
,SecurityTokenValidated = OnSecurityTokenValidated
,AuthorizationCodeReceived = OnAuthorizationCodeReceived
,SecurityTokenReceived = OnSecurityTokenReceived
},
Scope = "openid profile",
ResponseType = "id_token"
};
);
}
private Task OnSecurityTokenValidated(SecurityTokenValidatedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
{
var identity = notification.AuthenticationTicket.Identity;
var claims = notification.OwinContext.Authentication.User.Claims;
ClaimsPrincipal.Current.AddIdentity(identity);
return Task.FromResult(0);
}
そして、それが働いている、しかし、Microsoftのドキュメントには、私は次の命令は、「現在、IDトークンは署名が、暗号化されていない見つけ、あなたのアプリがIDトークンを受信した場合、それは次の条件を満たす必要があります。そして、私はそれを行うには、次のコードを持っていますトークンの真偽を証明するために署名を検証し、トークンのいくつかのクレームを検証してその妥当性を証明してください。
しかし、AuthenticationTicketを持つSecurityTokenValidated-callbackがあります。だから私はまだ何らかの形でトークンを検証する必要がありますか、それとも自動的に処理されるのですか(私は何も自動的に起こっていませんが、