keycloak / keycloak-quickstarts

Apache License 2.0
1.98k stars 984 forks source link

Update OAuth2ResourceServer configuration in Spring Security quickstart #622

Closed adropofliquid closed 6 days ago

adropofliquid commented 2 weeks ago

Description

The current Spring Security quickstart uses a deprecated method to configure the OAuth2 resource server. We should update this to use the more modern Lambda DSL approach, which is consistent with other configuration in the quickstart.

Discussion

No response

Motivation

No response

Details

The current configuration uses:

.oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt)

This should be updated to:

.oauth2ResourceServer((oauth2) -> oauth2
    .jwt(withDefaults())
)

This change aligns with the existing style used for authorizeHttpRequests in the same configuration class.