CLASS
AccessToken
Contents
- Properties
value
expiresOn
description
debugDescription
- Methods
isValid(atTime:minTtl:)
isEqual(_:)
@objcMembers public class AccessToken: NSObject
A representation of an OAuth Access Token, that includes both the raw value of the token, as well as relevant properties of the token.
Properties
value
public let value: String
The raw value of the Access Token
expiresOn
public let expiresOn: Date
The expiration date of the Access Token
description
override public var description: String
Return a String
representation of the AccessToken
instance, for example to be used for debugging
- Returns: a
String
representation of theAccessToken
instance,
debugDescription
override public var debugDescription: String
Methods
isValid(atTime:minTtl:)
public func isValid(atTime: Date, minTtl: TimeInterval) -> Bool
Calculate whether the Access Token is valid on a particular moment.
The minTtl
is used as threshold: the Access Token is considered valid if it is valid for at least minTtl
seconds before it expires.
-
Parameter atTime: the moment that validity of the Access Token is calculated for
-
Parameter minTtl: a
TimeInterval
that holds the time period that the Access Token must be valid for until it expires. -
Returns: true if the token is valid for the given
atTime
andminTtl
, false if not
Parameters
Name | Description |
---|---|
atTime | the moment that validity of the Access Token is calculated for |
minTtl | a TimeInterval that holds the time period that the Access Token must be valid for until it expires. |
isEqual(_:)
override public func isEqual(_ object: Any?) -> Bool