3
私はAzure Active DirectoryでAdalを使用しており、カスタムOwinMiddleware経由で余分なクレームを追加する必要があります。 このプリンシパルにクレームを追加すると、現在のリクエストでクレームにアクセスすることができます。しかし、ページが更新された後、その申し立ては消えてしまいます。ClaimsPrincipalのクレームを更新する
私はOwinがクレームのシリアル化を処理し、それをクッキー自体に入れると考えましたが、これはそうではないようです。次のように
私は、特許請求の範囲を追加します。
var claimsIdentity = (ClaimsIdentity) ClaimsPrincipal.Current.Identity;
if (!claimsIdentity.IsAuthenticated) return;
var identity = new ClaimsIdentity(claimsIdentity);
var currentTenantClaim = GetTenantClaim();
if (currentTenantClaim != null)
claimsIdentity.RemoveClaim(currentTenantClaim);
claimsIdentity.AddClaim(new Claim(ClaimTypes.CurrentTenantId, id));
context.Authentication.AuthenticationResponseGrant = new AuthenticationResponseGrant
(new ClaimsPrincipal(identity), new AuthenticationProperties {IsPersistent = true});
クッキーに新しいクレームを永続化する方法上の任意のアイデア?