Class BearerTokenAuthInterceptor

  • All Implemented Interfaces:

    public class BearerTokenAuthInterceptor
    extends Object
    HTTP interceptor to be used for adding HTTP Authorization using "bearer tokens" to requests. Bearer tokens are used for protocols such as OAUTH2 (see the RFC 6750 specification on bearer token usage for more information).

    This interceptor adds a header resembling the following:
       Authorization: Bearer dsfu9sd90fwp34.erw0-reu
    where the token portion (at the end of the header) is supplied by the invoking code.

    See the HAPI Documentation for information on how to use this class.

    • Constructor Detail

      • BearerTokenAuthInterceptor

        public BearerTokenAuthInterceptor()
        Constructor. If this constructor is used, a token must be supplied later
      • BearerTokenAuthInterceptor

        public BearerTokenAuthInterceptor​(String theToken)
        theToken - The bearer token to use (must not be null)
    • Method Detail

      • interceptRequest

        public void interceptRequest​( theRequest)
        Specified by:
        interceptRequest in interface
      • interceptResponse

        public void interceptResponse​( theResponse)
        Specified by:
        interceptResponse in interface
      • setToken

        public void setToken​(String theToken)
        Sets the bearer token to use