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
Constructors Constructor Description BearerTokenAuthInterceptor()Constructor.BearerTokenAuthInterceptor(String theToken)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetToken()Returns the bearer token to usevoidinterceptRequest(ca.uhn.fhir.rest.client.api.IHttpRequest theRequest)voidinterceptResponse(ca.uhn.fhir.rest.client.api.IHttpResponse theResponse)voidsetToken(String theToken)Sets the bearer token to use
-
-
-
Constructor Detail
-
BearerTokenAuthInterceptor
public BearerTokenAuthInterceptor()
Constructor. If this constructor is used, a token must be supplied later
-
BearerTokenAuthInterceptor
public BearerTokenAuthInterceptor(String theToken)
Constructor- Parameters:
theToken- The bearer token to use (must not be null)
-
-
Method Detail
-
interceptRequest
public void interceptRequest(ca.uhn.fhir.rest.client.api.IHttpRequest theRequest)
- Specified by:
interceptRequestin interfaceca.uhn.fhir.rest.client.api.IClientInterceptor
-
interceptResponse
public void interceptResponse(ca.uhn.fhir.rest.client.api.IHttpResponse theResponse)
- Specified by:
interceptResponsein interfaceca.uhn.fhir.rest.client.api.IClientInterceptor
-
-