Skip to content

Commit 58d3c2f

Browse files
committed
Address comment
1 parent 71a38e3 commit 58d3c2f

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

common4j/src/main/com/microsoft/identity/common/java/authorities/Authority.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
import com.microsoft.identity.common.java.logging.Logger;
3030
import com.microsoft.identity.common.java.nativeauth.authorities.NativeAuthCIAMAuthority;
3131
import com.microsoft.identity.common.java.providers.microsoft.azureactivedirectory.AzureActiveDirectory;
32+
import com.microsoft.identity.common.java.providers.microsoft.azureactivedirectory.AzureActiveDirectoryEnvironment;
3233
import com.microsoft.identity.common.java.providers.microsoft.azureactivedirectory.AzureActiveDirectorySlice;
3334
import com.microsoft.identity.common.java.providers.oauth2.OAuth2Strategy;
3435
import com.microsoft.identity.common.java.providers.oauth2.OAuth2StrategyParameters;
3536
import com.microsoft.identity.common.java.util.CommonURIBuilder;
3637
import com.microsoft.identity.common.java.util.StringUtil;
3738

38-
import java.io.IOException;
3939
import java.net.MalformedURLException;
4040
import java.net.URI;
4141
import java.net.URISyntaxException;
@@ -107,8 +107,8 @@ public void setDefault(Boolean isDefault) {
107107
}
108108

109109

110-
@SuppressFBWarnings(value="RpC_REPEATED_CONDITIONAL_TEST",
111-
justification="Somehow, spotbugs thinks that BuildConfig.SLICE and BuildConfig.DC are the same values.")
110+
@SuppressFBWarnings(value = "RpC_REPEATED_CONDITIONAL_TEST",
111+
justification = "Somehow, spotbugs thinks that BuildConfig.SLICE and BuildConfig.DC are the same values.")
112112
public Authority() {
113113
// setting slice directly here in constructor if slice provided as command line param
114114
if (!StringUtil.isNullOrEmpty(BuildConfig.SLICE) || !StringUtil.isNullOrEmpty(BuildConfig.DC)) {
@@ -134,7 +134,7 @@ public static Authority getAuthorityFromAuthorityUrl(String authorityUrl) {
134134
* determine the authority type and tenantid associated with it.
135135
*
136136
* @param authorityUrl
137-
* @param clientId This parameter is optional and can be null. It is used to construct NativeAuthCIAMAuthority when authority type is AAD_NA.
137+
* @param clientId This parameter is optional and can be null. It is used to construct NativeAuthCIAMAuthority when authority type is AAD_NA.
138138
* @return
139139
*/
140140
public static Authority getAuthorityFromAuthorityUrl(String authorityUrl, @Nullable String clientId) {
@@ -150,7 +150,7 @@ public static Authority getAuthorityFromAuthorityUrl(String authorityUrl, @Nulla
150150

151151
// Adding check in case we have a trailing "/" at the end of the authority
152152
if (pathSegments.size() == 0 || (pathSegments.size() == 1 && pathSegments.get(0).equals(""))) {
153-
if (authorityUrl.contains(CIAMAuthority.CIAM_LOGIN_URL_SEGMENT)){
153+
if (authorityUrl.contains(CIAMAuthority.CIAM_LOGIN_URL_SEGMENT)) {
154154
// This is a CIAM authority, return CIAMAuthority
155155
return new CIAMAuthority(CIAMAuthority.getTenantNameVariantUrlFromAuthorityWithoutPath(authorityUrl));
156156
}
@@ -351,7 +351,7 @@ public static boolean isKnownAuthority(Authority authority) {
351351
return false;
352352
}
353353

354-
if (BuildConfig.ALLOW_ONEBOX_AUTHORITIES) {
354+
if (BuildConfig.ALLOW_ONEBOX_AUTHORITIES && AzureActiveDirectoryEnvironment.ONEBOX_AUTHORITY.equals(authority.getAuthorityURL().getAuthority())) {
355355
return true; // onebox authorities are always considered to be known.
356356
}
357357

common4j/src/main/com/microsoft/identity/common/java/providers/microsoft/azureactivedirectory/AzureActiveDirectoryEnvironment.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
public class AzureActiveDirectoryEnvironment {
44
public static final String PRODUCTION_CLOUD_URL = "https://login.microsoftonline.com"; //Prod
55
public static final String PREPRODUCTION_CLOUD_URL = "https://login.windows-ppe.net"; //PPE
6-
public static final String ONEBOX_CLOUD_URL = "https://zurich.test.dnsdemo1.test:8478"; // Local ESTS Deployment
6+
7+
public static final String ONEBOX_AUTHORITY = "zurich.test.dnsdemo1.test:8478";
8+
public static final String ONEBOX_CLOUD_URL = "https://" + ONEBOX_AUTHORITY; // Local ESTS Deployment
79
}

0 commit comments

Comments
 (0)