OAuth2TokenStorage
open class OAuth2TokenStorage : OAuth2TokenStore
extension OAuth2TokenStorage: OAuth2TokenStoreUserInfoTransforming
Default implementation for the OAuth2TokenStore.
-
The store to use when handling
OAuth2Tokens.Declaration
Swift
open var store: CodableStoring -
This closure defines the key for storing the
OAuth2Tokenin theCodableStoringstore.Declaration
Swift
open var keyHandler: (URL) -> String -
Instantiates the
OAuth2TokenStoragebased on aCodableStoring. It will use theCodableStoringto store and retrieve theOAuth2Tokens.Declaration
Swift
public init(store: CodableStoring, keyHandler: @escaping (URL) -> String = OAuth2TokenStorage.key)Parameters
storeThe store to use when handling
OAuth2Tokens.keyHandlerThis closure defines the key for storing the
OAuth2Tokenin theCodableStoringstore.
-
Stores the
OAuth2Tokenfor the given URL.Declaration
Swift
open func store(token: OAuth2Token, for url: URL) throwsParameters
tokenthe token to be stored
forthe url the token is associated to
-
Retrieves the
OAuth2Tokenfor the given URL.Declaration
Swift
open func token(for url: URL) throws -> OAuth2Token?Parameters
urlthe url which the token is needed for
Return Value
the token associated with the url, nil if not found
-
Deletes the
OAuth2Tokenfor the given URL.Declaration
Swift
open func deleteToken(for url: URL) throwsParameters
urlthe url which the token is no longer needed
-
Clears all OAuth2 tokens by removing keys related to stored token data
Declaration
Swift
open func clear()
-
Default key prefix for storing
OAuth2Tokens.Declaration
Swift
public static let keyPrefix: String -
Default key handler.
Declaration
Swift
public class func key(for url: URL) -> String -
Declaration
Swift
public func toUserInfo() throws -> [String : Any] -
Declaration
Swift
public func apply(userInfo: [String : Any]) throws