【问题标题】:Update User Data in Azure Active Directory Java Springboot在 Azure Active Directory Java Springboot 中更新用户数据
【发布时间】:2022-01-15 07:13:01
【问题描述】:

我正在尝试制作一个 Java 应用程序,用户可以在其中登录到他的 Activer 目录并更新他的帐户信息,如电话号码或显示名称、密码等。

我能够对用户进行身份验证,但我似乎无法找到有关更新数据的任何内容。谁能指导我完成这个?

谢谢。

【问题讨论】:

    标签: java spring-boot azure azure-active-directory


    【解决方案1】:

    您可以使用Microsoft Graph Rest API 来更新用户

    并非所有属性都可以由成员或访客用户在没有管理员角色的情况下使用其默认权限进行更新。 Compare member and guest default permissions to see properties they can manage.

    注意: 您的个人 Microsoft 帐户必须与 AAD 租户相关联,才能使用个人 Microsoft 帐户上的 User.ReadWrite 委派权限更新您的个人资料。

    示例:更新登录用户的属性

    GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
    User user = new User();
    LinkedList<String> businessPhonesList = new LinkedList<String>();
    businessPhonesList.add("+1 425 555 0109");
    user.businessPhones = businessPhonesList;
    user.officeLocation = "18/2111";
    
    graphClient.me()
        .buildRequest()
        .patch(user);
    

    有关更多信息和示例,请参阅document

    【讨论】:

    • 感谢回复,我查一下
    • 当然,如果答案对您有帮助,您可以接受它作为答案(单击答案旁边的复选标记,将其从灰色切换为已填充。)。这对其他社区成员可能是有益的。谢谢
    猜你喜欢
    • 1970-01-01
    • 2023-02-02
    • 2023-03-26
    • 1970-01-01
    • 1970-01-01
    • 2019-04-28
    • 2018-03-17
    • 2013-04-15
    • 2016-08-12
    相关资源
    最近更新 更多