首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Angular应用和Spring Boot与Azure AD的集成

Angular应用和Spring Boot与Azure AD的集成
EN

Stack Overflow用户
提问于 2019-06-18 14:29:49
回答 1查看 2.3K关注 0票数 1

我正在使用angular和spring boot构建一个应用程序。我需要从前端使用Azure AD进行SSO,然后使用令牌保护spring引导服务。(简而言之,我的angular将连接到office 365登录,然后用户将使用spring security进行身份验证连接,在那里它将验证令牌,如果有效,它将给出响应。)在angular中,我使用adal-angular4,在spring boot中使用azure-active-directory-spring-boot-starter。另外,如何在Azure AD门户中注册应用程序(前端和后端)。

我正在尝试使用一些文章。当我使用令牌点击URL时,我从邮递员那里得到了响应。

代码语言:javascript
复制
{
    "code": 500,
    "status": "failure",
    "path": "/api/echo",
    "message": "com.microsoft.aad.adal4j.AuthenticationException: {\"error_description\":\"AADSTS500131: Assertion audience does not match the Client app presenting the assertion. The audience in the assertion was '48eb1c7f-e02b-43a9-913a-XXXXXXXX' and the expected audience is 'a3edefea-1ff3-43ed-b2d7-=XXXXXXXXXXXXX' or one of the Application Uris of this application with App ID 'a3edefea-1ff3-43ed-b2d7-=XXXXXXXXXX'(PulseBE).\\r\\nTrace ID: 2aced69c-f12d-4b5d-97db-XXXXXXXXXX\\r\\nCorrelation ID: 226816c8-a2ed-488c-86ec-XXXXXXXXXXXXXXXX\\r\\nTimestamp: 2019-06-17 19:10:34Z\",\"error\":\"invalid_grant\",\"error_uri\":\"https:\\/\\/login.microsoftonline.com\\/error?code=500131\"}",
    "timeStamp": "Tue Jun 18 00:40:35 IST 2019",
    "trace": null
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-06-20 03:41:10

iamelix,我也有同样的问题。我的问题是我的auth URL和token URL没有包含resource参数。

Azure身份验证URL和令牌URL的格式如下。

邮递员Azure AD

身份验证URL格式https://login.microsoftonline.com/[tenant_id]/oauth2/authorize?resource=[application_id]

访问令牌URL格式https://login.microsoftonline.com/[tenant_id]/oauth2/token?resource=[application_id]

对我来说,关键是将资源参数添加到auth URL和token URL,现在我请求的token包括有效的受众,因此Azure AD可以毫无错误地接受它。我从这篇非常有用的文章中找到了上面的信息:https://www.bruttin.com/2017/11/21/azure-api-postman.html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56642909

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档