Class BearerTokenAuthInterceptor
java.lang.Object
ca.uhn.fhir.rest.client.interceptor.BearerTokenAuthInterceptor
- All Implemented Interfaces:
ca.uhn.fhir.rest.client.api.IClientInterceptor
public class BearerTokenAuthInterceptor
extends Object
implements ca.uhn.fhir.rest.client.api.IClientInterceptor
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetToken()
Returns the bearer token to usevoid
interceptRequest
(ca.uhn.fhir.rest.client.api.IHttpRequest theRequest) void
interceptResponse
(ca.uhn.fhir.rest.client.api.IHttpResponse theResponse) void
Sets the bearer token to use
-
Constructor Details
-
BearerTokenAuthInterceptor
public BearerTokenAuthInterceptor()Constructor. If this constructor is used, a token must be supplied later -
BearerTokenAuthInterceptor
Constructor- Parameters:
theToken
- The bearer token to use (must not be null)
-
-
Method Details
-
getToken
Returns the bearer token to use -
interceptRequest
- Specified by:
interceptRequest
in interfaceca.uhn.fhir.rest.client.api.IClientInterceptor
-
interceptResponse
- Specified by:
interceptResponse
in interfaceca.uhn.fhir.rest.client.api.IClientInterceptor
-
setToken
Sets the bearer token to use
-