CSRFTokenStoring

public protocol CSRFTokenStoring

Defines a protocol which is capable of storing CSRF tokens.

  • Stores the CSRF token for the given URL.

    Declaration

    Swift

    func store(token: String, for url: URL) throws

    Parameters

    token

    the CSRF token to be stored

    for

    the url the token is associated to; Called with the return value of the CSRFTokenURLProviding.csrfTokenURL() function, no need to change this value.

  • Retrieves the CSRF token for the given URL.

    Declaration

    Swift

    func token(for url: URL) throws -> String?

    Parameters

    url

    the url which the csrf token is needed for

    Return Value

    the token associated with the url, nil if not found. Called with the return value of the CSRFTokenURLProviding.csrfTokenURL() function, no need to change this value.

  • Deletes the CSRF token for the given URL.

    Declaration

    Swift

    func deleteToken(for url: URL) throws

    Parameters

    url

    the url which the csrf token is no longer needed. Called with the return value of the CSRFTokenURLProviding.csrfTokenURL() function, no need to change this value.