Separate TokenRefresh capability from ServerOAuth2AuthorizedClientExchangeFilterFunction #6962
Labels
in: oauth2
An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)
status: duplicate
A duplicate of another issue
Summary
The ability to automatically and transparently refresh an OAuth 2 token in
ServerOAuth2AuthorizedClientExchangeFilterFunction
is useful enough that I'd like to be able to use it in other places. However most of the "meat" of the class is private. My particular case is an attempt to solve and/or work around spring-attic/spring-cloud-security#175 by implementing a refresh using the logic provided inServerOAuth2AuthorizedClientExchangeFilterFunction
. Unfortunately the interface ofServerOAuth2AuthorizedClientExchangeFilterFunction
is specific to ClientRequest / ClientResponse and the interface of Spring Cloud Gateway'sGatewayFilter
is specific to ServerWebExchange.A lot of the internals of
ServerOAuth2AuthorizedClientExchangeFilterFunction
are about retrieving and updating the OAuth2AuthorizedClient, and would be equally applicble to ClientRequest or ServerWebExchange, with only a little bit of glue needed to adapt to the right interface.Actual Behavior
Otherwise reusable behaviors of
ServerOAuth2AuthorizedClientExchangeFilterFunction
are implemented in private methods.Expected Behavior
The more reusable methods such as refreshIfNecessary (and dependencies) should be extracted to utility functions or a more reusable bean.
The text was updated successfully, but these errors were encountered: