@@ -2298,7 +2298,7 @@ public class AuthenticationAPIClientTest {
22982298 public fun shouldCustomTokenExchange () {
22992299 mockAPI.willReturnSuccessfulLogin()
23002300 val callback = MockAuthenticationCallback <Credentials >()
2301- client.customTokenExchange(" subject-token-type" , " subject-token" )
2301+ client.customTokenExchange(" subject-token-type" , " subject-token" , " org_12345 " )
23022302 .start(callback)
23032303 ShadowLooper .idleMainLooper()
23042304 val request = mockAPI.takeRequest()
@@ -2316,6 +2316,7 @@ public class AuthenticationAPIClientTest {
23162316 )
23172317 assertThat(body, Matchers .hasEntry(" subject_token" , " subject-token" ))
23182318 assertThat(body, Matchers .hasEntry(" subject_token_type" , " subject-token-type" ))
2319+ assertThat(body, Matchers .hasEntry(" organization" , " org_12345" ))
23192320 assertThat(body, Matchers .hasEntry(" scope" , " openid profile email" ))
23202321 assertThat(
23212322 callback, AuthenticationCallbackMatcher .hasPayloadOfType(
@@ -2328,7 +2329,7 @@ public class AuthenticationAPIClientTest {
23282329 public fun shouldCustomTokenExchangeSync () {
23292330 mockAPI.willReturnSuccessfulLogin()
23302331 val credentials = client
2331- .customTokenExchange(" subject-token-type" , " subject-token" )
2332+ .customTokenExchange(" subject-token-type" , " subject-token" , " org_abc " )
23322333 .execute()
23332334 val request = mockAPI.takeRequest()
23342335 assertThat(
@@ -2345,6 +2346,7 @@ public class AuthenticationAPIClientTest {
23452346 )
23462347 assertThat(body, Matchers .hasEntry(" subject_token" , " subject-token" ))
23472348 assertThat(body, Matchers .hasEntry(" subject_token_type" , " subject-token-type" ))
2349+ assertThat(body, Matchers .hasEntry(" organization" , " org_abc" ))
23482350 assertThat(body, Matchers .hasEntry(" scope" , " openid profile email" ))
23492351 assertThat(credentials, Matchers .`is `(Matchers .notNullValue()))
23502352 }
@@ -2371,6 +2373,7 @@ public class AuthenticationAPIClientTest {
23712373 )
23722374 assertThat(body, Matchers .hasEntry(" subject_token" , " subject-token" ))
23732375 assertThat(body, Matchers .hasEntry(" subject_token_type" , " subject-token-type" ))
2376+ assertThat(body, Matchers .not (Matchers .hasKey(" organization" )))
23742377 assertThat(body, Matchers .hasEntry(" scope" , " openid profile email" ))
23752378 assertThat(credentials, Matchers .`is `(Matchers .notNullValue()))
23762379 }
@@ -2871,7 +2874,10 @@ public class AuthenticationAPIClientTest {
28712874 assertThat(request.path, Matchers .equalTo(" /oauth/token" ))
28722875
28732876 val body = bodyFromRequest<String >(request)
2874- assertThat(body, Matchers .hasEntry(" grant_type" , ParameterBuilder .GRANT_TYPE_AUTHORIZATION_CODE ))
2877+ assertThat(
2878+ body,
2879+ Matchers .hasEntry(" grant_type" , ParameterBuilder .GRANT_TYPE_AUTHORIZATION_CODE )
2880+ )
28752881 assertThat(body, Matchers .hasEntry(" code" , " auth-code" ))
28762882
28772883 // Verify that key pair generation was attempted
@@ -2935,7 +2941,10 @@ public class AuthenticationAPIClientTest {
29352941 assertThat(request.path, Matchers .equalTo(" /oauth/token" ))
29362942
29372943 val body = bodyFromRequest<String >(request)
2938- assertThat(body, Matchers .hasEntry(" grant_type" , ParameterBuilder .GRANT_TYPE_TOKEN_EXCHANGE ))
2944+ assertThat(
2945+ body,
2946+ Matchers .hasEntry(" grant_type" , ParameterBuilder .GRANT_TYPE_TOKEN_EXCHANGE )
2947+ )
29392948 assertThat(body, Matchers .hasEntry(" subject_token_type" , " subject-token-type" ))
29402949
29412950 // Verify that key pair generation was attempted
@@ -3114,9 +3123,12 @@ public class AuthenticationAPIClientTest {
31143123 client.useDPoP(mockContext).login(SUPPORT_AUTH0_COM , PASSWORD , MY_CONNECTION )
31153124 .execute()
31163125 }
3117- Assert .assertEquals(" Key pair is not found in the keystore. Please generate a key pair first." , exception.message)
3126+ Assert .assertEquals(
3127+ " Key pair is not found in the keystore. Please generate a key pair first." ,
3128+ exception.message
3129+ )
31183130 assertThat(exception.cause, Matchers .notNullValue())
3119- assertThat(exception.cause, Matchers .instanceOf(DPoPException ::class .java ))
3131+ assertThat(exception.cause, Matchers .instanceOf(DPoPException ::class .java))
31203132 }
31213133
31223134 private fun <T > bodyFromRequest (request : RecordedRequest ): Map <String , T > {
0 commit comments