Skip to content
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

Provide reactive implementation of AuthorizedClientServiceOAuth2AuthorizedClientManager #7569

Closed
jgrandja opened this issue Oct 25, 2019 · 12 comments
Assignees
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Milestone

Comments

@jgrandja
Copy link
Contributor

We should provide a reactive implementation equivalent of AuthorizedClientServiceOAuth2AuthorizedClientManager.

@jgrandja jgrandja added in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement labels Oct 25, 2019
@jgrandja jgrandja added this to the 5.3.x milestone Oct 25, 2019
@jgrandja jgrandja added the status: ideal-for-contribution An issue that we actively are looking for someone to help us with label Oct 25, 2019
@ankurpathak
Copy link
Contributor

@jgrandja I would like to take this one.

@jgrandja
Copy link
Contributor Author

Thank you @ankurpathak. Let me know if you have any questions.

@ankurpathak
Copy link
Contributor

ankurpathak commented Oct 31, 2019

@jgrandja Here is early pull request for this issue, just to understand if I am on right path. Expect your feedback.
#7589

@jgrandja
Copy link
Contributor Author

@ankurpathak I took a look at #7589 and yes this is the implementation I was expecting.

@ghostd
Copy link
Contributor

ghostd commented Nov 1, 2019

HI,

Can we expect a sample (in the repo or in the official documentation or elsewhere) showing how to combine those classes to run a batch (or some code without web context) with OAuth ?

Regards

@ankurpathak
Copy link
Contributor

@jgrandja Here is complete pull request with tests. I have some confusion on name of class and instance variables. So lets agree with some commons on them and if it needs any modification do let me know.

@frzme
Copy link

frzme commented Nov 11, 2019

I think it is rather unfortunate that this feature which supported in spring security 5.1 is being treated as an addition. I think it should be treated as an regression and therefore fixed within the scope of the 5.2 release and not postponed till 5.3. Using the "wrong" (previously working) DefaultClientManager fails transparently - for users it looks like it might be working, it's just re-requesting oauth tokens with every request, which makes it rather hard to spot the error.

I'm fine with a natively supported alternate configuration but hope that it can make it to 5.2.x.

@jgrandja jgrandja removed the status: ideal-for-contribution An issue that we actively are looking for someone to help us with label Nov 11, 2019
@jgrandja
Copy link
Contributor Author

@frzme Please see comment

ankurpathak added a commit to ankurpathak/spring-security that referenced this issue Nov 27, 2019
…entManager

ReactiveOAuth2AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager is reactive
version of AuthorizedClientServiceOAuth2AuthorizedClientManager

Fixes: spring-projectsgh-7569
philsttr added a commit to philsttr/spring-security that referenced this issue Dec 5, 2019
@jgrandja jgrandja modified the milestones: 5.3.x, 5.3.0.M1 Dec 6, 2019
philsttr added a commit to philsttr/spring-security that referenced this issue Dec 10, 2019
Rename OAuth2AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager to AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager.

Handle empty mono returned from contextAttributesMapper.

Handle empty map returned from contextAttributesMapper.

Fix DefaultContextAttributesMapper so that it doesn't access ServerWebExchange.

Fix unit tests so that they pass.

Use StepVerifier in unit tests, rather than .subscribe().

Fixes spring-projectsgh-7569
@jgrandja jgrandja self-assigned this Dec 10, 2019
@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-5.2.x labels Dec 10, 2019
jgrandja pushed a commit that referenced this issue Dec 10, 2019
Rename OAuth2AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager to AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager.

Handle empty mono returned from contextAttributesMapper.

Handle empty map returned from contextAttributesMapper.

Fix DefaultContextAttributesMapper so that it doesn't access ServerWebExchange.

Fix unit tests so that they pass.

Use StepVerifier in unit tests, rather than .subscribe().

Fixes gh-7569
jgrandja pushed a commit that referenced this issue Dec 10, 2019
…entManager

ReactiveOAuth2AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager is reactive
version of AuthorizedClientServiceOAuth2AuthorizedClientManager

Fixes: gh-7569
jgrandja pushed a commit that referenced this issue Dec 10, 2019
Rename OAuth2AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager to AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager.

Handle empty mono returned from contextAttributesMapper.

Handle empty map returned from contextAttributesMapper.

Fix DefaultContextAttributesMapper so that it doesn't access ServerWebExchange.

Fix unit tests so that they pass.

Use StepVerifier in unit tests, rather than .subscribe().

Fixes gh-7569
@justinmusgrove
Copy link

@ghostd - was wondering if sample was documented as I am looking to run this within spring data flow. I was following @rwinch example https://github.com/rwinch/webclientoauth2-cli, then running into "Authorization required for Client Registration Id" as I was trying to programmatically provide a user. Any direction would be appreciated. Thanks!

@jgrandja
Copy link
Contributor Author

@justinmusgrove It was recently documented in the reference. This references the Servlet implementation as the reactive is not documented yet, but it's the same approach just different classes.

@abhi2495
Copy link

abhi2495 commented Jun 21, 2020

Hey @justinmusgrove @jgrandja
You can use the following code : Spring WebFlux Security- Client config - OAuth2.0 Client Credentials Flow

I too hope this gets documented quickly so that it becomes easy for everyone

@seetharam-hub
Copy link

org.springframework.security.oauth2.client.web.DefaultOAuth2AuthorizedClientManager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Projects
None yet
8 participants