-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Introduce Reactive OAuth2Authorization success/failure handlers #7756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...ecurity/oauth2/client/endpoint/AbstractWebClientReactiveOAuth2AccessTokenResponseClient.java
Show resolved
Hide resolved
.../client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunction.java
Outdated
Show resolved
Hide resolved
.../client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunction.java
Show resolved
Hide resolved
...t/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunctionITests.java
Show resolved
Hide resolved
...ore/src/main/java/org/springframework/security/oauth2/core/OAuth2AuthorizationException.java
Show resolved
Hide resolved
...ework/security/oauth2/core/web/reactive/function/OAuth2AccessTokenResponseBodyExtractor.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @philsttr ! I left some feedback for you. Also, can you change the copyright header 2019 -> 2020.
...va/org/springframework/security/oauth2/client/ReactiveOAuth2AuthorizationSuccessHandler.java
Outdated
Show resolved
Hide resolved
...va/org/springframework/security/oauth2/client/ReactiveOAuth2AuthorizationFailureHandler.java
Outdated
Show resolved
Hide resolved
...ork/security/oauth2/client/AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager.java
Outdated
Show resolved
Hide resolved
...ork/security/oauth2/client/AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager.java
Outdated
Show resolved
Hide resolved
...ork/security/oauth2/client/AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager.java
Outdated
Show resolved
Hide resolved
...springframework/security/oauth2/client/web/DefaultReactiveOAuth2AuthorizedClientManager.java
Outdated
Show resolved
Hide resolved
...springframework/security/oauth2/client/web/DefaultReactiveOAuth2AuthorizedClientManager.java
Outdated
Show resolved
Hide resolved
.../client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunction.java
Outdated
Show resolved
Hide resolved
.../client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunction.java
Outdated
Show resolved
Hide resolved
.../client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunction.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates @philsttr. I left a couple more minor comments.
...ork/security/oauth2/client/AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager.java
Outdated
Show resolved
Hide resolved
.../security/oauth2/client/RemoveAuthorizedClientReactiveOAuth2AuthorizationFailureHandler.java
Outdated
Show resolved
Hide resolved
...ecurity/oauth2/client/endpoint/AbstractWebClientReactiveOAuth2AccessTokenResponseClient.java
Outdated
Show resolved
Hide resolved
...ecurity/oauth2/client/endpoint/AbstractWebClientReactiveOAuth2AccessTokenResponseClient.java
Outdated
Show resolved
Hide resolved
...springframework/security/oauth2/client/web/DefaultReactiveOAuth2AuthorizedClientManager.java
Outdated
Show resolved
Hide resolved
.../client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunction.java
Show resolved
Hide resolved
.../client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunction.java
Outdated
Show resolved
Hide resolved
.../client/web/reactive/function/client/ServerOAuth2AuthorizedClientExchangeFilterFunction.java
Show resolved
Hide resolved
...ore/src/main/java/org/springframework/security/oauth2/core/OAuth2AuthorizationException.java
Show resolved
Hide resolved
...ore/src/main/java/org/springframework/security/oauth2/core/OAuth2AuthorizationException.java
Show resolved
Hide resolved
All ReactiveOAuth2AuthorizedClientManagers now have authorization success/failure handlers. A success handler is provided to save authorized clients for future requests. A failure handler is provided to remove previously saved authorized clients. ServerOAuth2AuthorizedClientExchangeFilterFunction also makes use of a failure handler in the case of unauthorized or forbidden http status code. The main use cases now handled are - remove authorized client when an authorization server indicates that a refresh token is no longer valid (when authorization server returns invalid_grant) - remove authorized client when a resource server indicates that an access token is no longer valid (when resource server returns invalid_token) Introduced ClientAuthorizationException to capture details needed when removing an authorized client. All ReactiveOAuth2AccessTokenResponseClients now throw a ClientAuthorizationException on failures. Created AbstractWebClientReactiveOAuth2AccessTokenResponseClient to unify common logic between all ReactiveOAuth2AccessTokenResponseClients. Fixes spring-projectsgh-7699
Not sure what is causing that ci failure. Help appreciated. Seems unrelated to my changes.
|
@philsttr The CI failure is not related to your updates. We're working on it. |
@philsttr Thanks again for all your great work on this feature. I applied some minor javadoc edits and also moved FYI, I logged #7840 for the Servlet implementation. |
Thanks Joe! And thanks for all the brainstorming and reviews. Also, I'm unfortunately not going to be able to work on the servlet implementation. I wish I could, but my company doesn't have an immediate need for the servlet impl (unlike the reactive impl), and I have more pressing stuff on my plate in the new year. |
@philsttr No worries Phil. I totally understand. I'll take care of it. Thanks again. |
All
ReactiveOAuth2AuthorizedClientManager
s now have authorization success/failure handlers.Default success handlers will save authorized clients for future requests.
Default failure handlers will remove previously saved authorized clients.
ServerOAuth2AuthorizedClientExchangeFilterFunction
also makes use of afailure handler in the case of unauthorized or forbidden http status code.
The main use cases now handled are
Introduced
ClientAuthorizationException
to capture details needed when removing an authorized client.All
ReactiveOAuth2AccessTokenResponseClient
s now throw aClientAuthorizationException
on failures.Created
AbstractWebClientReactiveOAuth2AccessTokenResponseClient
to unify common logic between allReactiveOAuth2AccessTokenResponseClient
s.Fixes gh-7699