Class CsrfTokenInterceptor

  • All Implemented Interfaces:
    okhttp3.Interceptor

    
    public class CsrfTokenInterceptor
     implements Interceptor
                        

    This interceptor is responsible for setting the X-CSRF-Token header for communication with services exposed by SAPcpms.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static Interceptor.Companion Companion
    • 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.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Response intercept(@NonNull() Interceptor.Chain chain)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CsrfTokenInterceptor

        CsrfTokenInterceptor(String rootUrl)
        Constructs a new CsrfTokenInterceptor with one root URL.
        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.
        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.
        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.
        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)