Allow AbstractRestClientOAuth2AccessTokenResponseClient to be extended #15953
Labels
in: oauth2
An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)
status: duplicate
A duplicate of another issue
type: enhancement
A general enhancement
I have a legacy OAuth2 API I need to use, and it requires the use of a password grant. Support for password grants was removed in
AbstractRestClientOAuth2AccessTokenResponseClient
so when I tried to migrate my OAuth2 configuration to use the newRestClient
basedOAuth2AccessTokenResponseClient
I could not. At least not for the password grant.I tried to implement my own, but the constructor of
AbstractRestClientOAuth2AccessTokenResponseClient
is package private so it cannot be extended. I did not want to copy all the code, as that is a maintainability nightmare.Consider making
AbstractRestClientOAuth2AccessTokenResponseClient
extensible for this use case, even though password grants are deprecated there are still many out in the wild.As a workaround I've created the package
org.springframework.security.oauth2.client.endpoint
in my own project, which allows me to extend. Obviously that doesn't work with JPMS - and it's also a nasty hack.The text was updated successfully, but these errors were encountered: