向AzureAd请求令牌时如何使用Adal-Angular4设置受众群体

时间:2018-09-16 19:04:01

标签: angular oauth-2.0 adal

我正在尝试使用.net API对Angular 6客户端进行身份验证,并针对Azure广告进行身份验证,在那里我要验证.net中的受众群体。

app.UseWindowsAzureActiveDirectoryBearerAuthentication(
    new WindowsAzureActiveDirectoryBearerAuthenticationOptions
    {
        Tenant = 'tenant',
        TokenValidationParameters = new TokenValidationParameters
        {
            ValidAudience = 'https://foo/bar'
        },   
    });

我可以使用以下网址通过提琴手成功进行身份验证:

https://login.microsoftonline.com/tenantId/oauth2/authorize?response_type=token&redirect_uri=http://localhost:4200/&realm=realm&client_id=clientid&scope=&state=oauth2&resource=https://foo/bar

我正在使用Adal-Angular4库(https://github.com/benbaran/adal-angular4),可以从Azure广告获得令牌-但它无法通过我的API中的受众验证。

AngularJS + ADAL.JS set Resource ID (Audience)之后,我在提供给Adal-Angular4的配置对象中设置了一些额外的属性,但无济于事。

我的配置对象如下:

adalConfig: {
    tenant: 'tenantId',
    clientId: 'clientId',
    postLogoutRedirectUri: 'http://localhost:4200/logout',
    loginResource: 'https://foo/bar', 
    resource: 'https://foo/bar'
}

非常感谢任何/所有指针。

0 个答案:

没有答案