問題描述
使用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
當在複雜的環境中面臨問題,格物之道需:濁而靜之徐清,安以動之徐生。 雲中,恰是如此!