I am using the OAuth client functionality in Spring Boot. Regarding customizing the login page, the documentation here:
.0.x/reference/html/oauth2login-advanced.html#oauth2login-advanced-login-page
says that I have to provide:
[...] a @Controller with a @RequestMapping("/login/oauth2") that is capable of rendering the custom login page.
I very much want to do this, but I cannot find a way to retrieve the registrations configured. I would need this in order to render the choices (or, to redirect to one if there is only one).
There is one "InMemoryClientRegistrationRepository" class, but it seems it might be less than ideal to depend on this, as there is nothing to guarantee that this is actually used.
Alternatively, I imagine the only way to do this would be to hop in here:
class OAuth2ClientRegistrationRepositoryConfiguration {
@Bean
@ConditionalOnMissingBean(ClientRegistrationRepository.class)
InMemoryClientRegistrationRepository clientRegistrationRepository(OAuth2ClientProperties properties) {
List<ClientRegistration> registrations = new ArrayList<>(
new OAuth2ClientPropertiesMapper(properties).asClientRegistrations().values());
return new InMemoryClientRegistrationRepository(registrations);
}
}
and implement my own ClientRegistrationRegistry.
Did I miss any obvious ways to achieve this?
thanks
.rm