Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring security 5.1 oauth 2, how to add additional parameters to user authentication uri

I'm trying to integrate external oauth 2 authentication server and resource server. Their configuration requires some additional custom parameters: state - should be uuid, TimeStamp, accessType, also clientSecret should be signed using a combination of all previous params as data.

We are using Spring boot, spring security 5.1, Camunda.

The catch is I can't directly add params to URI calling method setUserAuthorizationUri cause this method is called only once during initialization

like image 589
Unrealman1 Unrealman1 Avatar asked Oct 19 '18 10:10

Unrealman1 Unrealman1


People also ask

What is authorization URI in OAuth2?

The OAuth 2.0 authorization framework is a protocol that allows a user to grant a third-party web site or application access to the user's protected resources, without necessarily revealing their long-term credentials or even their identity.

Is oauth2resttemplate deprecated?

Deprecated. Strategy for extracting an Authorization header from an access token and the request details.

What is token enhancer?

OAuth2AccessToken. enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) Provides an opportunity for customization of an access token (e.g. through its additional information map) during the process of creating a new token for use by a client.


1 Answers

The OAuth2AuthorizationRequestResolver provides the ability to customize the Authorization Request with additional parameters above the standard parameters and/or removing/changing one of the standard parameters. See the reference doc on OAuth2AuthorizationRequestResolver for implementation details.

like image 178
Joe Grandja Avatar answered Oct 29 '22 15:10

Joe Grandja