Class OAuth2BearerFilter
java.lang.Object
ch.ivyteam.ivy.rest.client.oauth2.OAuth2BearerFilter
- All Implemented Interfaces:
javax.ws.rs.client.ClientRequestFilter
@Provider
public class OAuth2BearerFilter
extends Object
implements javax.ws.rs.client.ClientRequestFilter
Filter to simplify OAUTH2 authorization flows.
It initiates OAUTH2 authentication requests to resolve a 'Bearer' token which is sub-sequently added as 'Authorization' request header.
- Since:
- 9.2
- API:
- This is a public API.
-
Constructor Summary
ConstructorDescriptionOAuth2BearerFilter
(OAuth2TokenRequester getToken, OAuth2UriProvider uriFactory) -
Method Summary
Modifier and TypeMethodDescriptiontokenScopeProperty
(String scopeProperty) Sets a rest-client property, that will be used to isolate your auth-token from other calls to the rest-service, that work with the samesession
.tokenSuffix
(Supplier<String> tokenSuffix)
-
Constructor Details
-
OAuth2BearerFilter
- Parameters:
getToken
- aOAuth2TokenRequester
implementation that actually does the 'accessToken' call to the OAUTH2 authority in case the current session has not already a valid accessToken.uriFactory
- anOAuth2UriProvider
to setup OAUTH2 authority URIs for the various requests that may must be fired (.e.g /auth, /token, /userinfo, ...)- API:
- This public API is available in Java.
-
-
Method Details
-
tokenSuffix
- Parameters:
tokenSuffix
- to uniquely identify and separate this token from other on the same restClient andsession
.- Returns:
- this instance, for fluent building
- Since:
- 10.0.3
- API:
- This public API is available in Java.
-
tokenScopeProperty
Sets a rest-client property, that will be used to isolate your auth-token from other calls to the rest-service, that work with the samesession
.By default we read the rest-client property "AUTH.scope", if it exists and holds a value, it will be used.
You can pass another property name, if you happen to have your own 'scope' property.- Parameters:
scopeProperty
- the property of your rest client feature configuration, that holds the "scope" (permissions) to ask for.- Returns:
- this instance, for fluent building
- Since:
- 10.0.3
- API:
- This public API is available in Java.
-