TrustedPersistantOAuth2Session

An OAuth2Session implementation to store OAuth2 metadata using the Keychain.

  • The account id.

    Declaration

    Swift

    public var accountId: String
  • The access token’s expiration date.

    Declaration

    Swift

    public var accessTokenExpirationDate: NSDate?
  • The access token. The information is read securely from Keychain.

    Declaration

    Swift

    public var accessToken: String?
  • The refresh token. The information is read securely from Keychain.

    Declaration

    Swift

    public var refreshToken: String?
  • The refresh token’s expiration date.

    Declaration

    Swift

    public var refreshTokenExpirationDate: NSDate?
  • Check validity of accessToken. return true if still valid, false when expired.

    Declaration

    Swift

    public func tokenIsNotExpired() -> Bool
  • Check validity of refreshToken. return true if still valid, false when expired.

    Declaration

    Swift

    public func refreshTokenIsNotExpired() -> Bool
  • Save in memory tokens information. Saving tokens allow you to refresh accesstoken transparently for the user without prompting for grant access.

    Declaration

    Swift

    public func saveAccessToken(accessToken: String?, refreshToken: String?, accessTokenExpiration: String?, refreshTokenExpiration: String?)
  • Clear all tokens. Method used when doing logout or revoke.

    Declaration

    Swift

    public func clearTokens()
  • Initialize TrustedPersistantOAuth2Session using account id. Account id is the service id used for keychain storage.

    Declaration

    Swift

    public init(accountId: String, groupId: String? = nil, accessToken: String? = nil, accessTokenExpirationDate: NSDate? = nil, refreshToken: String? = nil, refreshTokenExpirationDate: NSDate? = nil)

    Parameters

    accountId

    uniqueId to identify the oauth2module

    groupId

    used for SSO between app issued from same developer certificate.

    accessToken

    optional parameter to initilaize the storage with initial values

    accessTokenExpirationDate

    optional parameter to initilaize the storage with initial values

    refreshToken

    optional parameter to initilaize the storage with initial values

    refreshTokenExpirationDate

    optional parameter to initilaize the storage with initial values