CachingJwtProvider
@objc(VSSCachingJwtProvider)
open class CachingJwtProvider : NSObject, AccessTokenProvider
Implementation of AccessTokenProvider which provides AccessToken using cache+renew callback
-
Cached Jwt
Declaration
Swift
public private(set) var jwt: Jwt? { get }
-
Callback, which takes a TokenContext and completion handler Completion handler should be called with either JWT, or Error
Declaration
Swift
@objc public let renewJwtCallback: (TokenContext, @escaping (Jwt?, Error?) -> Void) -> Void
-
Initializer
Declaration
Swift
@objc public init(initialJwt: Jwt? = nil, renewJwtCallback: @escaping (TokenContext, @escaping (Jwt?, Error?) -> Void) -> Void)
Parameters
initialJwt
Initial jwt value
renewJwtCallback
Callback, which takes a TokenContext and completion handler Completion handler should be called with either JWT, or Error
-
Typealias for callback used below
Declaration
Swift
public typealias JwtStringCallback = (String?, Error?) -> Void
-
Typealias for callback used below
Declaration
Swift
public typealias RenewJwtCallback = (TokenContext, @escaping JwtStringCallback) -> Void
-
Initializer
Declaration
Swift
@objc public convenience init(initialJwt: Jwt? = nil, renewTokenCallback: @escaping RenewJwtCallback)
Parameters
initialJwt
Initial jwt value
renewTokenCallback
Callback, which takes a TokenContext and completion handler Completion handler should be called with either JWT String, or Error
-
Typealias for callback used below
Declaration
Swift
public typealias AccessTokenCallback = (AccessToken?, Error?) -> Void
-
Provides access token using callback
Declaration
Swift
public func getToken(with tokenContext: TokenContext, completion: @escaping AccessTokenCallback)
Parameters
tokenContext
TokenContext
provides context explaining why token is neededcompletion
completion closure