Class OAuth2ClientFeature
- java.lang.Object
-
- org.glassfish.jersey.client.oauth2.OAuth2ClientFeature
-
- All Implemented Interfaces:
javax.ws.rs.core.Feature
class OAuth2ClientFeature extends java.lang.Object implements javax.ws.rs.core.FeatureOAuth2 client filter feature registers the support for performing authenticated requests to the Service Provider. The feature does not perform Authorization Flow (seeOAuth2CodeGrantFlowfor details how to use Authorization Flow and retrieve Access Token). The feature uses access to initialize the internalfilterwhich will addAuthorizationhttp header containing OAuth 2 authorization information including (based onbearertokens).The internal filter can be controlled by properties put into the
Example of using specific access token for one request:client requestusingClientRequestContext.setProperty(String, Object)method. The property key is defined in this class as a static variables (OAuth2ClientSupport.OAUTH2_PROPERTY_ACCESS_TOKEN(see its javadoc for usage). Using the property a specific access token can be defined for each request.final Response response = client.target("foo").request() .property(OAUTH2_PROPERTY_ACCESS_TOKEN, "6ab45ab465e46f54d771a").get();- Since:
- 2.3
-
-
Field Summary
Fields Modifier and Type Field Description private OAuth2ClientFilterfilter
-
Constructor Summary
Constructors Constructor Description OAuth2ClientFeature()Create a new filter feature with no default access token.OAuth2ClientFeature(java.lang.String accessToken)Create a new feature initialized for the access token.OAuth2ClientFeature(OAuth2ClientFilter filter)Create a new feature with the givenfilter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanconfigure(javax.ws.rs.core.FeatureContext context)
-
-
-
Field Detail
-
filter
private final OAuth2ClientFilter filter
-
-
Constructor Detail
-
OAuth2ClientFeature
public OAuth2ClientFeature(java.lang.String accessToken)
Create a new feature initialized for the access token.- Parameters:
accessToken- Access token.
-
OAuth2ClientFeature
public OAuth2ClientFeature()
Create a new filter feature with no default access token. The token will have to be specified byOAuth2ClientSupport.OAUTH2_PROPERTY_ACCESS_TOKENfor each request otherwise noAuthorizationhttp header will be added.
-
OAuth2ClientFeature
OAuth2ClientFeature(OAuth2ClientFilter filter)
Create a new feature with the givenfilter.- Parameters:
filter- Filter instance.
-
-