Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure AD在Spring Boot中没有用户身份验证_Azure_Spring Boot_Azure Active Directory_Bearer Token_Jwt Auth - Fatal编程技术网

Azure AD在Spring Boot中没有用户身份验证

Azure AD在Spring Boot中没有用户身份验证,azure,spring-boot,azure-active-directory,bearer-token,jwt-auth,Azure,Spring Boot,Azure Active Directory,Bearer Token,Jwt Auth,我想使用https://login.microsoftonline.com/{tenant}/oauth2/tokenendpoint。我正在post请求中填充参数(客户机id、客户机机密、资源和授权类型:客户机凭据)并获取访问令牌。当我使用它登录API时,spring boot给了我一个错误: com.microsoft.aad.adal4j.AuthenticationException: {"error_description":"AADSTS50058: A silent sign-in

我想使用
https://login.microsoftonline.com/{tenant}/oauth2/token
endpoint。我正在post请求中填充参数(客户机id、客户机机密、资源和授权类型:客户机凭据)并获取访问令牌。当我使用它登录API时,spring boot给了我一个错误:

com.microsoft.aad.adal4j.AuthenticationException: {"error_description":"AADSTS50058: A silent sign-in request was sent but no user is signed in.

我应该怎么做才能在只有post请求的情况下获得有效的承载令牌?或者我是否缺少任何azure配置?

您所描述的“登录”不是用户登录,而是对访问令牌的应用程序请求。然后,应用程序可以使用此令牌调用其他一些API,例如MS Graph。它适用于完全没有用户参与的应用程序(例如守护程序服务),或者应用程序希望在不参考当前登录用户的情况下调用API。如果您想让用户登录到您的应用程序,则需要使用OpenIDConnect授权代码授权流。使用。

您能为您的问题添加更多细节吗?您使用的是哪个版本的Spring Boot?您是如何配置Spring安全性的?@WimDeblauwe现在我正在使用azure active directory Spring boot starter 2.2.0.M1。AADAuthenticationFilter已添加。它是与微软的弹出窗口,但我需要得到无需任何get请求的持有人。我想通过POST请求来实现,我只想以非交互方式访问我自己的spring boot api。我不想获取和弹出或重定向。你能给我一些关于这方面的更多信息吗?除非你使用OAuth2资源所有者流,否则你不能不重定向,除非在某些边缘情况下,你不应该使用OAuth2资源所有者流。它不安全,不能正确支持MFA或SSO。所有面向用户的现代应用程序都必须使用重定向和单独的弹出式UI来验证用户。