Skip to content

Default value for ClientRegistration redirect-uri #16377

Open
@rwinch

Description

@rwinch

If the Client Registration redirect-uri property is missing from a Spring Boot application, it fails on startup with:

Caused by: java.lang.IllegalArgumentException: redirectUri cannot be empty
	at org.springframework.util.Assert.hasText(Assert.java:253) ~[spring-core-6.2.1.jar:6.2.1]
	at org.springframework.security.oauth2.client.registration.ClientRegistration$Builder.validateAuthorizationCodeGrantType(ClientRegistration.java:659) ~[spring-security-oauth2-client-6.4.2.jar:6.4.2]
	at org.springframework.security.oauth2.client.registration.ClientRegistration$Builder.build(ClientRegistration.java:610) ~[spring-security-oauth2-client-6.4.2.jar:6.4.2]
	at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesMapper.getClientRegistration(OAuth2ClientPropertiesMapper.java:87) ~[spring-boot-autoconfigure-3.4.1.jar:3.4.1]
	...

The redirect URI should be defaulted to {baseUrl}/login/oauth2/code/{registrationId}. I'm not sure if it makes sense for this to default in Spring Security or Boot, but a user should not have to provide the property

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: enhancementA general enhancement

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions