@@ -2378,92 +2378,6 @@ public class AuthenticationAPIClientTest {
23782378 assertThat(credentials, Matchers .`is `(Matchers .notNullValue()))
23792379 }
23802380
2381- @Test
2382- public fun shouldFailCustomTokenExchangeWithReservedNamespace () {
2383- val callback = MockAuthenticationCallback <Credentials >()
2384- client.customTokenExchange(" https://auth0.com" , " subject-token" )
2385- .start(callback)
2386- ShadowLooper .idleMainLooper()
2387-
2388- assertThat(
2389- callback.error.message,
2390- Matchers .containsString(" Invalid URI" )
2391- )
2392- assertThat(callback.error.cause, Matchers .instanceOf(IllegalArgumentException ::class .java))
2393- assertThat(
2394- callback.error.cause?.message,
2395- Matchers .containsString(" reserved namespace" )
2396- )
2397- }
2398-
2399- @Test
2400- public fun shouldFailCustomTokenExchangeSyncWithReservedNamespace () {
2401- val exception = assertThrows(AuthenticationException ::class .java) {
2402- client.customTokenExchange(" urn:okta" , " subject-token" )
2403- .execute()
2404- }
2405-
2406- assertThat(exception.message, Matchers .containsString(" Invalid URI" ))
2407- assertThat(exception.cause, Matchers .instanceOf(IllegalArgumentException ::class .java))
2408- assertThat(
2409- exception.cause?.message,
2410- Matchers .containsString(" reserved namespace" )
2411- )
2412- }
2413-
2414- @Test
2415- @ExperimentalCoroutinesApi
2416- public fun shouldFailCustomTokenExchangeAwaitWithReservedNamespace () {
2417- val exception = assertThrows(AuthenticationException ::class .java) {
2418- runTest {
2419- client.customTokenExchange(" urn:auth0" , " subject-token" )
2420- .await()
2421- }
2422- }
2423-
2424- assertThat(exception.message, Matchers .containsString(" Invalid URI" ))
2425- assertThat(exception.cause, Matchers .instanceOf(IllegalArgumentException ::class .java))
2426- assertThat(
2427- exception.cause?.message,
2428- Matchers .containsString(" reserved namespace" )
2429- )
2430- }
2431-
2432- @Test
2433- public fun shouldFailCustomTokenExchangeWithInvalidHttpUri () {
2434- val callback = MockAuthenticationCallback <Credentials >()
2435- client.customTokenExchange(" http://invalid uri with spaces" , " subject-token" )
2436- .start(callback)
2437- ShadowLooper .idleMainLooper()
2438-
2439- assertThat(callback, AuthenticationCallbackMatcher .hasError(Credentials ::class .java))
2440- assertThat(
2441- callback.error.message,
2442- Matchers .containsString(" Invalid URI" )
2443- )
2444- assertThat(
2445- callback.error.cause?.message,
2446- Matchers .containsString(" not a valid URI" )
2447- )
2448- }
2449-
2450- @Test
2451- public fun shouldFailCustomTokenExchangeWithMalformedHttpsUri () {
2452- val callback = MockAuthenticationCallback <Credentials >()
2453- client.customTokenExchange(" https://[invalid:uri:format" , " subject-token" )
2454- .start(callback)
2455- ShadowLooper .idleMainLooper()
2456-
2457- assertThat(
2458- callback.error.message,
2459- Matchers .containsString(" Invalid URI" )
2460- )
2461- assertThat(
2462- callback.error.cause?.message,
2463- Matchers .containsString(" not a valid URI" )
2464- )
2465- }
2466-
24672381 @Test
24682382 public fun shouldSsoExchange () {
24692383 mockAPI.willReturnSuccessfulLogin()
0 commit comments