Description
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 in ServerOAuth2AuthorizedClientExchangeFilterFunction
. Unfortunately the interface of ServerOAuth2AuthorizedClientExchangeFilterFunction
is specific to ClientRequest / ClientResponse and the interface of Spring Cloud Gateway's GatewayFilter
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.