File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
common4j/src/main/com/microsoft/identity/common/java/util Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 2222// THE SOFTWARE.
2323package com.microsoft.identity.common.java.util
2424
25+ import com.microsoft.identity.common.java.authorities.Authority
2526import com.microsoft.identity.common.java.authorities.AzureActiveDirectoryAudience
2627import com.microsoft.identity.common.java.authorities.AzureActiveDirectoryAuthority
2728import java.util.Locale
@@ -34,11 +35,16 @@ class MsaUtil {
3435 /* *
3536 * Given an authority, check if this is an MSA request
3637 */
37- fun isMsaRequest (authority : AzureActiveDirectoryAuthority ) : Boolean {
38- val audience = authority.audience.tenantId.lowercase(Locale .ROOT )
38+ fun isMsaRequest (authority : Authority ) : Boolean {
39+ return if (authority !is AzureActiveDirectoryAuthority ) {
40+ false
41+ } else {
42+ // authority has been silently casted to AzureActiveDirectoryAuthority
43+ val audience = authority.audience.tenantId.lowercase(Locale .ROOT )
3944
40- // Check if audience is consumers or the MSA Mega Tenant
41- return audience == AzureActiveDirectoryAudience .MSA_MEGA_TENANT_ID || audience == AzureActiveDirectoryAudience .CONSUMERS
45+ // Check if audience is consumers or the MSA Mega Tenant
46+ audience == AzureActiveDirectoryAudience .MSA_MEGA_TENANT_ID || audience == AzureActiveDirectoryAudience .CONSUMERS
47+ }
4248 }
4349 }
4450}
You can’t perform that action at this time.
0 commit comments