CSRFTokenURLProviding

public protocol CSRFTokenURLProviding

Defines a protocol which is capable of providing CSRF URL for every request URL.

  • csrfTokenURL(for:) Default implementation

    Provides the CSRF URL for the request URL

    Default Implementation

    default implementation to delegate call to csrfTokenURL(for:) that returns a non-optional URL as return parameter. This default implementation ensures compatibility for existing implementations of CSRFTokenURLProviding while allowing to provide a custom implementation.

    Declaration

    Swift

    @available(*, deprecated, renamed: "csrfTokenURL(for:﹚", message: "Developers shall implement csrfTokenURL(for:﹚ function that can return an optional URL. You can return nil if you don't want to handle a specific request and consequently the CSRFTokenObserver will not set the X-CSRF-Token header.")
    func csrfTokenURL(for: URL) -> URL

    Parameters

    for

    request URL which needs CSRF token

    Return Value

    the URL from which the CSRF token will be requested

  • Provides the CSRF URL for the request URL

    Declaration

    Swift

    func csrfTokenURL(for: URL) -> URL?

    Parameters

    for

    request URL which needs CSRF token

    Return Value

    the URL from which the CSRF token will be requested. If nil, then that’s the indicator that no CSRF token shall be requested for the given request URL.