0
我有一個天藍色的web應用程序的問題。我使用Active Directory來控制訪問效果很好,但我的用戶之一變,當他們在azure acive目錄驗證錯誤
idx10214觀衆驗證登錄此錯誤消息失敗不匹配validationparameters.validaudience或validationparameters空
沒有人知道這是什麼意味着?有沒有解決方法?
繼承人如何設置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再次嘗試登錄其仍然是相同的。我不消費webapi它只是一個標準的登錄頁面的直接web應用程序,我真的難住,爲什麼只有一個特定的用戶受此影響? anynoe可以幫助嗎?
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
TokenValidationParameters = new TokenValidationParameters
{
ValidAudience = clientId
},
Tenant = tenantId,
AuthenticationType = "OAuth2Bearer"
});
香港專業教育學院更新了我的問題,包括開放ID碼 – proteus
什麼'graphResourceId'的價值?您請求了哪個API以及它是如何被保護的? –
https://graph.windows.net biu – proteus