Skip to content

regional endpoint change to always use login.microsoft.com #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AadInstanceDiscoveryProvider {
private final static String AUTHORIZE_ENDPOINT_TEMPLATE = "https://{host}/{tenant}/oauth2/v2.0/authorize";
private final static String INSTANCE_DISCOVERY_ENDPOINT_TEMPLATE = "https://{host}:{port}/common/discovery/instance";
private final static String INSTANCE_DISCOVERY_REQUEST_PARAMETERS_TEMPLATE = "?api-version=1.1&authorization_endpoint={authorizeEndpoint}";
private final static String HOST_TEMPLATE_WITH_REGION = "{region}.{host}";
private final static String HOST_TEMPLATE_WITH_REGION = "{region}.login.microsoft.com";
private final static String SOVEREIGN_HOST_TEMPLATE_WITH_REGION = "{region}.{host}";
private final static String REGION_NAME = "REGION_NAME";
private final static int PORT_NOT_SET = -1;
Expand All @@ -47,7 +47,9 @@ class AadInstanceDiscoveryProvider {

TRUSTED_HOSTS_SET.addAll(Arrays.asList(
"login.windows.net",
"login.microsoftonline.com"));
"login.microsoftonline.com",
"login.microsoft.com",
"sts.windows.net"));

TRUSTED_HOSTS_SET.addAll(TRUSTED_SOVEREIGN_HOSTS_SET);
}
Expand Down Expand Up @@ -187,8 +189,7 @@ private static String getRegionalizedHost(String host, String region) {
// whereas sovereign cloud endpoints and any non-Microsoft authorities are assumed to follow another template
if (TRUSTED_HOSTS_SET.contains(host) && !TRUSTED_SOVEREIGN_HOSTS_SET.contains(host)){
regionalizedHost = HOST_TEMPLATE_WITH_REGION.
replace("{region}", region).
replace("{host}", host);
replace("{region}", region);

} else {
regionalizedHost = SOVEREIGN_HOST_TEMPLATE_WITH_REGION.
Expand Down