azureのWebアプリケーションで問題が発生しました。私はうまく機能アクセスを制御するためにActive Directoryを使用しますが、私のユーザーの一人がnull validationparameters.validaudienceまたはvalidationparameters晴れアシブディレクトリ検証エラー
と一致しませんでした失敗した彼らは
idx10214観客の検証にログインしたときにこのエラーメッセージを取得します誰が何この知っています手段 ?回避策はありますか?
heres私はユーザーを認証するためにopenidをどのように設定するのですか?ここでどのようにオーディエンス設定を含めることができますか?聴衆の価値はどうあるべきですか?
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
ClientId = clientId,
Authority = AuthorityCHP,
PostLogoutRedirectUri = postLogoutRedirectUri,
RedirectUri = loURL,
Notifications = new OpenIdConnectAuthenticationNotifications()
{
// If there is a code in the OpenID Connect response, redeem it for an access token and refresh token, and store those away.
AuthorizationCodeReceived = (context) =>
{
var code = context.Code;
Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential credential = new Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential(clientId, appKey);
string signedInUserID = context.AuthenticationTicket.Identity.FindFirst(ClaimTypes.NameIdentifier).Value;
Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext authContext = new Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext(AuthorityCHP, new ADALTokenCache(signedInUserID));
var newuri = new Uri(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path));
Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationResult result = authContext.AcquireTokenByAuthorizationCode(code, newuri, credential, graphResourceId);
return Task.FromResult(0);
}
}
});
アイブ氏はそれがうまくいくかもしれない期待していくつかの追加のコードを追加しましたが、私はそれを展開した後、私は再びログインし、そのまだ同じことをしようとするユーザーaffecetdを得ました。私はwebappiを使用していない、標準的なログインページを持つまさにストレートフォールトのWebアプリケーションです。私は実際に困惑しました。 anynoeは助けることができますか?
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
TokenValidationParameters = new TokenValidationParameters
{
ValidAudience = clientId
},
Tenant = tenantId,
AuthenticationType = "OAuth2Bearer"
});
はOpenIDのコード – proteus
を含めるように私の質問を更新しましたアイブgraphResourceId' 'の値は何ですか?リクエストしたAPIとその保護方法 –
https://graph.windows.net biu – proteus