OAuth2TokenStorage
open class OAuth2TokenStorage : OAuth2TokenStore
extension OAuth2TokenStorage: OAuth2TokenStoreUserInfoTransforming
Default implementation for the OAuth2TokenStore
.
-
The store to use when handling
OAuth2Token
s.Declaration
Swift
open var store: CodableStoring
-
This closure defines the key for storing the
OAuth2Token
in theCodableStoring
store.Declaration
Swift
open var keyHandler: (URL) -> String
-
Instantiates the
OAuth2TokenStorage
based on aCodableStoring
. It will use theCodableStoring
to store and retrieve theOAuth2Token
s.Declaration
Swift
public init(store: CodableStoring, keyHandler: @escaping (URL) -> String = OAuth2TokenStorage.key)
Parameters
store
The store to use when handling
OAuth2Token
s.keyHandler
This closure defines the key for storing the
OAuth2Token
in theCodableStoring
store.
-
Stores the
OAuth2Token
for the given URL.Declaration
Swift
open func store(token: OAuth2Token, for url: URL) throws
Parameters
token
the token to be stored
for
the url the token is associated to
-
Retrieves the
OAuth2Token
for the given URL.Declaration
Swift
open func token(for url: URL) throws -> OAuth2Token?
Parameters
url
the url which the token is needed for
Return Value
the token associated with the url, nil if not found
-
Deletes the
OAuth2Token
for the given URL.Declaration
Swift
open func deleteToken(for url: URL) throws
Parameters
url
the 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
OAuth2Token
s.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