Interface CsrfTokenRetriever
- All Known Implementing Classes:
DefaultCsrfTokenRetriever
public interface CsrfTokenRetriever
Retrieves a CSRF token from a given remote system.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CsrfTokenRetrieverThe disabledCsrfTokenRetrieverthrows anIllegalStateExceptionin case it is invoked. -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanIndicates if CSRF token retrieval is enabled.retrieveCsrfToken(org.apache.http.client.HttpClient httpClient, String servicePath) Retrieves an CSRF Token from a remote system by issuing an CSRF token request.retrieveCsrfToken(org.apache.http.client.HttpClient httpClient, String servicePath, Map<String, Collection<String>> headers) Retrieves an CSRF Token from a remote system by issuing an CSRF token request.
-
Field Details
-
DISABLED_CSRF_TOKEN_RETRIEVER
The disabledCsrfTokenRetrieverthrows anIllegalStateExceptionin case it is invoked.
-
-
Method Details
-
retrieveCsrfToken
@Nonnull CsrfToken retrieveCsrfToken(@Nonnull org.apache.http.client.HttpClient httpClient, @Nonnull String servicePath) Retrieves an CSRF Token from a remote system by issuing an CSRF token request.- Parameters:
httpClient- TheHttpClientto be used to issue the CSRF token request.servicePath- The service path (which would be appended to the destination URI) to be used to issue the CSRF token request.- Returns:
- The fetched
CsrfToken. - Throws:
CsrfTokenRetrievalException- When CSRF Token could not be fetched.
-
retrieveCsrfToken
@Nonnull CsrfToken retrieveCsrfToken(@Nonnull org.apache.http.client.HttpClient httpClient, @Nonnull String servicePath, @Nonnull Map<String, Collection<String>> headers) Retrieves an CSRF Token from a remote system by issuing an CSRF token request.- Parameters:
httpClient- TheHttpClientto be used to issue the CSRF token request.servicePath- The service path (which would be appended to the destination URI) to be used to issue the CSRF token request.headers- Additional headers to use for the CSRF token request.- Returns:
- The fetched
CsrfToken. - Throws:
CsrfTokenRetrievalException- When CSRF Token could not be fetched.
-
isEnabled
default boolean isEnabled()Indicates if CSRF token retrieval is enabled.- Returns:
- Flag indicating if CSRF token retrieval is enabled
-