【Azure Developer】在使用中国区 Azure AD B2C时, AUTHORITY的值是什么呢?

问题描述

使用MSAL4J的SDK调用(源码地址:https://github.com/Azure-Samples/ms-identity-msal-java-samples/tree/main/3.%20Java%20Servlet%20Web%20App%20Tutorial/1-Authentication/sign-in-b2c#about-the-code),其中的一段代码中, AUTHORITY 地址在中国区Azure AD B2C中应该是什么呢?

IClientSecret secret = ClientCredentialFactory.createFromSecret(SECRET);
confClientInstance = ConfidentialClientApplication
                    .builder(CLIENT_ID, secret)
                    .b2cAuthority(AUTHORITY + policy)
                    .build();

在Github的实例代码中,AUTHORITY   = https://fabrikamb2c.b2clogin.com/tfp/fabrikamb2c.onmicrosoft.com/

 

问题解答

根据中国区文档的介绍以及示例中参考,在中国区AUTHORITY的值对应为   https://<your-tenant-name>.b2clogin.cn/<your-tenant-name>.partner.onmschina.cn/

 

参考资料

https://github.com/Azure-Samples/ms-identity-msal-java-samples/blob/main/3.%20Java%20Servlet%20Web%20App%20Tutorial/1-Authentication/sign-in-b2c/src/main/resources/authentication.properties 

https://docs.azure.cn/zh-cn/active-directory-b2c/b2clogin#what-endpoints-does-this-apply-to

https://docs.azure.cn/zh-cn/active-directory-b2c/configure-a-sample-node-web-app#step-5-configure-the-sample-web-app 

 

posted @ 2022-06-23 21:32  路边两盏灯  阅读(72)  评论(0编辑  收藏  举报