Skip to content

Commit 2b030e6

Browse files
author
Mohit
committed
update UTs
1 parent 467678b commit 2b030e6

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

common4j/src/test/com/microsoft/identity/common/java/providers/oauth2/OpenIdProviderConfigurationClientTest.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,18 @@ class OpenIdProviderConfigurationClientTest {
8484
val key = AttributeKey.stringKey("openid_issuer_invalid_reason")
8585
Assert.assertEquals("issuer_validation_skipped", result!!.get(key))
8686
}
87+
88+
@Test
89+
fun validateIssuer_aadHostMismatch() {
90+
// request authority: US gov cloud (not public Azure)
91+
val requestAuthority = "https://login.microsoftonline.us/tenant/v2.0"
92+
// issuer from public Azure cloud
93+
val config = configWithIssuer("https://login.microsoftonline.com/tenant/v2.0")
94+
val client = OpenIdProviderConfigurationClient()
95+
val result = client.validateIssuer(config, requestAuthority)
96+
// Depending on cloud discovery this should produce issuer_aad_host_mismatch
97+
Assert.assertNotNull(result)
98+
val key = AttributeKey.stringKey("openid_issuer_invalid_reason")
99+
Assert.assertEquals("issuer_aad_host_mismatch", result!!.get(key))
100+
}
87101
}

0 commit comments

Comments
 (0)