简体   繁体   English

无法使用Azure Active Directory验证用户

[英]Not able to authenticate user using Azure Active Directory

我正在尝试在链接上使用Java代码提及: http : //www.nexttutorial.com/faq/azureAD/1/Azure-active-directory-graph-api-user-authentication-in-java-但出现以下错误:

java.util.concurrent.ExecutionException: com.microsoft.aad.adal4j.AuthenticationException: {"error_description":"AADSTS50055: Force Change Password.\r\nTrace ID: 7596cf92-f3d6-4baf-a0c9-d166a92d1500\r\nCorrelation ID: 8cccb074-4ae4-4c9b-932b-1f4ddcb514cb\r\nTimestamp: 2017-05-05 08:20:28Z","error":"user_password_expired"}

I haven't used the Java APIs, but I can tell you two things that are the core of the problem: 我没有使用过Java API,但是我可以告诉您两个问题的核心:

  1. The user's password has expired 用户密码已过期
  2. You are using Resource Owner Password Grant flow 您正在使用“资源所有者密码授予”流程

You need to change the application to instead show a browser window so the user can reset their password. 您需要更改应用程序以显示浏览器窗口,以便用户可以重置密码。 If you just want to test the code as is, you can open a new Incognito/private/InPrivate window and sign in to eg portal.azure.com with the user. 如果您只想按原样测试代码,则可以打开一个新的Incognito / private / InPrivate窗口,然后使用用户登录到例如portal.azure.com。 That will allow you to make sure they have a working password. 这将使您确保他们具有有效的密码。

But I would advise against using that sign in flow because of potential problems like this one. 但是我建议不要使用这种登录流,因为这样的潜在问题。

The reason you get the error is that the user needs to set a new password, but the flow you are using cannot support that scenario. 出现错误的原因是用户需要设置新密码,但是您使用的流程不支持该方案。 It also cannot support the scenario where the user account has MFA enabled/is a Microsoft account etc. 它还不能支持用户帐户已启用MFA /是Microsoft帐户等的情况。

And by the way, if this app is intended not to be used by a user, but just run as is, I would suggest making it a daemon with application permissions on the necessary APIs and then use client credentials flow for authentication. 顺便说一句,如果该应用程序不打算由用户使用,而是按原样运行,我建议将其设为具有必要API上的应用程序权限的守护程序,然后使用客户端凭据流进行身份验证。 No user account needed then, since the app has the needed rights. 由于该应用程序具有所需的权限,因此无需用户帐户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用用户名使用UnboundID对Active Directory用户进行身份验证 - Authenticate an Active Directory user with UnboundID using username 如何使用受信任的域用户向活动目录进行身份验证? - How to authenticate to active directory using trusted domain user? 如何使用Spring Ldap在Active Directory中对用户进行身份验证和搜索 - How authenticate and search user in Active Directory using Spring Ldap 如何在XPages中使用Java对Active Directory进行身份验证 - How to authenticate with Active Directory using java in XPages 如何通过Java从Active Directory验证用户身份? - How to authenticate user against Active Directory from java? 使用LDAP,Java Play Framework通过Active Directory进行身份验证 - Authenticate via Active Directory using LDAP, Java Play Framework 使用 JSON 文件将用户批量上传到 Java 中的 Azure B2C 活动目录 - Bulk upload user using JSON file to Azure B2C active directory in Java 无法从Java中活动目录的OU读取用户属性 - Not able to read user attribute from OU of a active directory in java 无法从OpenDS活动目录在Java中创建和获取用户 - not able to create and fetch user in java from OpenDS active directory 是否有可能在 Java 中通过活动目录对用户进行身份验证,然后执行用户有权执行的任务? - Is it possible, in Java, to authenticate a user over active directory and then perform tasks that user has permissions for?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM