-
Notifications
You must be signed in to change notification settings - Fork 6.3k
OAuth2 client integration with WebSocketClient #6711
Copy link
Copy link
Closed
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply
Metadata
Metadata
Assignees
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply
Type
Fields
Give feedbackNo fields configured for issues without a type.
In spring-security-oauth2-client 5.1, OAuth2 client is supported fairly well with webflux's
WebClientviaServerOAuth2AuthorizedClientExchangeFilterFunction.However, there is no equivalent support for webflux's
WebSocketClient. For example, I would like to:ClientRegistration/OAuth2AuthorizedClientServerOAuth2AuthorizedClientExchangeFilterFunctionAuthorizationheader of the initial websocket outbound upgrade requestIn my application, I'm currently debating on whether I want to copy/paste
ServerOAuth2AuthorizedClientExchangeFilterFunctionand it's correspondingOAuth2AuthorizedClientResolver(which is package-private) in order to provide similar support for my websocket use cases.It's really a shame that
WebSocketClientdoes not useExchangeFilterFunctions, otherwise we'd get this for free. Instead, it looks like I'll have to use reactor netty'sHttpClient.headersWhenmethod as a hook to provide headers instead.At a minimum, it would be nice if most of the logic for obtaining an access token in
ServerOAuth2AuthorizedClientExchangeFilterFunctionwas extracted out into a class that could be reused inExchangeFilterFunction(for WebClient),Mono<OAuth2AuthorizedClient> OAuth2AuthorizedClientResolver.loadAuthorizedClientis almost what I need. Except it doesn't handle refreshing tokens, and it's not public.