CredentialsTokenTTLResult
public enum CredentialsTokenTTLResult
Represents the result of a call to generateNewProfile()
, and one of the two possible getProfileAndCacheIfNeeded
methods, with an authentication token.
On success, the resulting UserProfile
is returned. On failure, the plugin may return
a status code and headers that should be sent in response. If the plugin cannot
process the token provided, then it may choose whether to fail, or to pass unprocessable
to
allow other plugins to handle authentication instead.
-
Authentication was successful. The
UserProfile
represents the identity of the bearer.Declaration
Swift
case success(UserProfile)
-
The token was successfully parsed, but authentication failed. The plugin may provide a status code and headers to send in response.
Declaration
Swift
case failure(HTTPStatusCode?, [String : String]?)
-
The token could not be handled by this plugin. It may be malformed, or intended for another plugin. This case is only used by the getProfileAndCacheIfNeeded method with the completion callback and is intended for plugins with more complicated needs.
Declaration
Swift
case unprocessable(details: String)
-
Helper method to convert an Error to a failure enum
Declaration
Swift
public static func error(_ error: Swift.Error) -> CredentialsTokenTTLResult