|
@@ -535,4 +535,27 @@ public class ClientRegistrationTests {
|
|
.build()
|
|
.build()
|
|
).isInstanceOf(IllegalArgumentException.class);
|
|
).isInstanceOf(IllegalArgumentException.class);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void buildWhenCustomGrantAllAttributesProvidedThenAllAttributesAreSet() {
|
|
|
|
+ AuthorizationGrantType customGrantType = new AuthorizationGrantType("CUSTOM");
|
|
|
|
+ ClientRegistration registration = ClientRegistration.withRegistrationId(REGISTRATION_ID)
|
|
|
|
+ .clientId(CLIENT_ID)
|
|
|
|
+ .clientSecret(CLIENT_SECRET)
|
|
|
|
+ .clientAuthenticationMethod(ClientAuthenticationMethod.BASIC)
|
|
|
|
+ .authorizationGrantType(customGrantType)
|
|
|
|
+ .scope(SCOPES.toArray(new String[0]))
|
|
|
|
+ .tokenUri(TOKEN_URI)
|
|
|
|
+ .clientName(CLIENT_NAME)
|
|
|
|
+ .build();
|
|
|
|
+
|
|
|
|
+ assertThat(registration.getRegistrationId()).isEqualTo(REGISTRATION_ID);
|
|
|
|
+ assertThat(registration.getClientId()).isEqualTo(CLIENT_ID);
|
|
|
|
+ assertThat(registration.getClientSecret()).isEqualTo(CLIENT_SECRET);
|
|
|
|
+ assertThat(registration.getClientAuthenticationMethod()).isEqualTo(ClientAuthenticationMethod.BASIC);
|
|
|
|
+ assertThat(registration.getAuthorizationGrantType()).isEqualTo(customGrantType);
|
|
|
|
+ assertThat(registration.getScopes()).isEqualTo(SCOPES);
|
|
|
|
+ assertThat(registration.getProviderDetails().getTokenUri()).isEqualTo(TOKEN_URI);
|
|
|
|
+ assertThat(registration.getClientName()).isEqualTo(CLIENT_NAME);
|
|
|
|
+ }
|
|
}
|
|
}
|