認証が成功した後に、別のアプリケーションにGET/POST要求を使って送信できるID Token
を取得したいとします。IDトークンを別のアプリケーションに転送する
シナリオは次のとおりです。
- 異なるURLを使用して、複数のWebアプリケーション(* .domain.com)
- すべてのアプリケーションは、それらのすべてを置くためのAzureのActive Directoryに対して認証
- あまりにも多くのURLのを必要としますredirect_url(すべてのホスト名に1つ必要)
- アイデアは、ログインを処理し、IDトークンを* .domain.comアプリケーションに転送する「login」アプリケーション(login.domain.com)を使用します(状態フィールド)
- * .domain.comはその後、IDトークンを検証し、ユーザーMicrosoft.AspNetCore.Authentication.OpenIdConnectを使用して
を許可、私はそれを正しく転送できるように、私はIDトークンを取得する方法を見つけ出すことはできません。
私は(これは動作します)適切ASP.NETコア1.0 Webアプリケーションと設定されている認証用のVS2015のテンプレートを使用しました
は今、私は何とかトークンを取得する必要がありますが、私はどのように把握することはできません。
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions()
{
ClientId = Configuration["Authentication:AzureAd:ClientId"],
Authority = Configuration["Authentication:AzureAd:AADInstance"] + "Common",
CallbackPath = Configuration["Authentication:AzureAd:CallbackPath"],
TokenValidationParameters = new TokenValidationParameters
{
// Instead of using the default validation (validating against a single issuer value, as we do in line of business apps),
// we inject our own multitenant validation logic
ValidateIssuer = false,
// If the app is meant to be accessed by entire organizations, add your issuer validation logic here.
//IssuerValidator = (issuer, securityToken, validationParameters) => {
// if (myIssuerValidationLogic(issuer)) return issuer;
//}
},
Events = new OpenIdConnectEvents
{
OnTicketReceived = (context) =>
{
// If your authentication logic is based on users then add your logic here
return Task.FromResult(0);
},
OnAuthenticationFailed = (context) =>
{
context.Response.Redirect("/Home/Error");
context.HandleResponse(); // Suppress the exception
return Task.FromResult(0);
},
// If your application needs to do authenticate single users, add your user validation below.
//OnTokenValidated = (context) =>
//{
// return myUserValidationLogic(context.Ticket.Principal);
//}
}
});
私はTicketReceivedContext
を使用してOnTicketReceived
イベントでそれを得ることができる必要がありますね?