Class OAuth1ClientFeature

  • All Implemented Interfaces:
    javax.ws.rs.core.Feature

    final class OAuth1ClientFeature
    extends java.lang.Object
    implements javax.ws.rs.core.Feature
    OAuth1 client filter feature registers the support for performing authenticated requests to the Service Provider. The feature does not perform Authorization Flow (see OAuth1AuthorizationFlow for details how to use Authorization Flow and retrieve Access Token). The feature uses ConsumerCredentials and AccessToken to initialize the internal filter which will add Authorization headers containing OAuth authorization information including the oauth signature.

    The internal filter can be controlled by properties put into the client request using ClientRequestContext.setProperty(String, Object) method. The property keys are defined in this class as a static variables (see their javadocs for usage). Using these properties a specific AccessToken can be defined for each request for example.

    Example of using specific access token for one request:
     final Response response = client.target("foo").request()
               .property(OAUTH_PROPERTY_ACCESS_TOKEN, new AccessToken("ab454f84e", "f454de848a54b")).get();
     

    See OAuth1Builder for more information of how to build this feature.

    Since:
    2.3
    • Constructor Detail

      • OAuth1ClientFeature

        OAuth1ClientFeature​(OAuth1Parameters parameters,
                            OAuth1Secrets secrets)
        Create a new feature.
        Parameters:
        parameters - OAuth parameters.
        secrets - OAuth client/token secret.
    • Method Detail

      • configure

        public boolean configure​(javax.ws.rs.core.FeatureContext context)
        Specified by:
        configure in interface javax.ws.rs.core.Feature