Skip to content

Separate TokenRefresh capability from ServerOAuth2AuthorizedClientExchangeFilterFunction #6962

Closed
@wtatum

Description

@wtatum

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.

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions