【发布时间】:2018-02-07 11:37:06
【问题描述】:
目前我们的 ASP.NET MVC 系统使用 OpenIdConnect 和 cookie 身份验证来保护。我们使用 azure Active Directory 启用了 oauth 身份验证流程。
public void ConfigureAuthOpenIdConnect(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
var cookieAuthenticationOptions = new CookieAuthenticationOptions()
{
//...
};
app.UseCookieAuthentication(cookieAuthenticationOptions);
var notifications = new OAOpenIdConnectAuthenticationNotifications();
var openIdConnectAuthenticationOptions = new OpenIdConnectAuthenticationOptions()
{
//...
Notifications = notifications
};
app.UseOpenIdConnectAuthentication(openIdConnectAuthenticationOptions);
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
Tenant = ConfigHelper.ClientSettings.TenantName,
TokenValidationParameters = new TokenValidationParameters
{
ValidAudience = ConfigHelper.ClientSettings.ClientId
}
});
}
现在,当我们通过 OpenIdConnect 进行身份验证时,我们使用 OpenIdConnectAuthenticationOptions 选项上的自定义 Notifications 检索授权代码,这使我们能够使用 ADAL 请求和缓存资源令牌。
当尝试使用 azure AD 不记名令牌访问我们的系统时会出现问题,这种获取和缓存资源令牌的工作流程不存在。
所以我的问题是,如何使用不记名令牌启用此功能?如何像使用 OpenIdConnect 一样请求额外的资源令牌?是否可以使用 ADAL 从不记名令牌中获取授权码?
【问题讨论】:
标签: c# asp.net oauth azure-active-directory adal