Class CsrfTokenInterceptor
-
- All Implemented Interfaces:
-
okhttp3.Interceptor
public class CsrfTokenInterceptor implements InterceptorThis interceptor is responsible for setting the X-CSRF-Token header for communication with services exposed by SAPcpms.
-
-
Constructor Summary
Constructors Constructor Description CsrfTokenInterceptor(String rootUrl)Constructs a new CsrfTokenInterceptor with one root URL. CsrfTokenInterceptor(String rootUrl, CsrfTokenStore store)Constructs a new CsrfTokenInterceptor with one root URL. CsrfTokenInterceptor(CsrfTokenUrlProvider urlProvider)Constructs a new CsrfTokenInterceptor. CsrfTokenInterceptor(CsrfTokenUrlProvider urlProvider, CsrfTokenStore store)Constructs a new CsrfTokenInterceptor.
-
Method Summary
Modifier and Type Method Description Responseintercept(@NonNull() Interceptor.Chain chain)-
-
Constructor Detail
-
CsrfTokenInterceptor
CsrfTokenInterceptor(String rootUrl)
Constructs a new CsrfTokenInterceptor with one root URL. Use if you have only one root URL for every CSRF token request.
- Parameters:
rootUrl- The URL from which the CSRF token will be requested.
-
CsrfTokenInterceptor
CsrfTokenInterceptor(String rootUrl, CsrfTokenStore store)
Constructs a new CsrfTokenInterceptor with one root URL. Use if you have only one root URL for every CSRF token request.
- Parameters:
rootUrl- The URL from which the CSRF token will be requested.store- The store which the token will be persisted to.
-
CsrfTokenInterceptor
CsrfTokenInterceptor(CsrfTokenUrlProvider urlProvider)
Constructs a new CsrfTokenInterceptor. Use if you have multiple backends and the backends accept different CSRF tokens. By default the tokens will be stored by host and port in memory.
- Parameters:
urlProvider- The CsrfTokenUrlProvider implementation which provides the CSRF URL for every request URL which are protected with CSRF.
-
CsrfTokenInterceptor
CsrfTokenInterceptor(CsrfTokenUrlProvider urlProvider, CsrfTokenStore store)
Constructs a new CsrfTokenInterceptor. Use if you have multiple backends and the backends accept different CSRF tokens.
- Parameters:
urlProvider- The CsrfTokenUrlProvider implementation which provides the CSRF URL for every request URL which are protected with CSRF.store- The store which the token will be persisted to.
-
-
Method Detail
-
intercept
@NonNull() Response intercept(@NonNull() Interceptor.Chain chain)
-
-
-
-