Skip to content

Add ServerOAuth2AuthorizedClientExchangeFilterFunction #5386

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

Closed
rwinch opened this issue May 25, 2018 · 0 comments
Closed

Add ServerOAuth2AuthorizedClientExchangeFilterFunction #5386

rwinch opened this issue May 25, 2018 · 0 comments
Assignees
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement
Milestone

Comments

@rwinch
Copy link
Member

rwinch commented May 25, 2018

Summary

We should make it easy to use an OAuth2AuthorizedClient with WebClient. This can be done by providing an API that looks like this:

@Bean
WebClient webClient() {
	return WebClient.builder()
			.filter(new ServerOAuth2AuthorizedClientExchangeFilterFunction())
			.build();
}
import static org.springframework.security.oauth2.client.web.reactive.function.client.ServerOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient;
// ...
@GetMapping("/oauth/api")
public String oauthApi(@RegisteredOAuth2AuthorizedClient OAuth2AuthorizedClient authorizedClient) {
	String response = this.webClient
		.get()
		.uri(userInfoEndpointUri)
		.attributes(oauth2AuthorizedClient(authorizedClient))
		.retrieve()
		.bodyToMono(String.class)
		.block();
	// ...
}

At the moment the only thing that is done is adding. However, once refresh tokens are supported we will add automatically refreshing the token as well.

@rwinch rwinch added in: web An issue in web modules (web, webmvc) New Feature in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) labels May 25, 2018
@rwinch rwinch added this to the 5.1.0.M2 milestone May 25, 2018
@rwinch rwinch self-assigned this May 25, 2018
@rwinch rwinch closed this as completed in c68cf99 May 25, 2018
rwinch added a commit that referenced this issue Jul 2, 2018
rwinch added a commit that referenced this issue Jul 2, 2018
This allows setting up the mock

Issue: gh-5386
@rwinch rwinch changed the title Add OAuth2AuthorizedClientExchangeFilterFunction Add ServerOAuth2AuthorizedClientExchangeFilterFunction Jul 20, 2018
rwinch added a commit that referenced this issue Jul 20, 2018
Rename OAuth2AuthorizedClientExchangeFilterFunction to
ServerOAuth2AuthorizedClientExchangeFilterFunction->

Issue: gh-5386
@rwinch rwinch added the type: enhancement A general enhancement label May 3, 2019
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) in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant