CredentialsPluginProtocol
public protocol CredentialsPluginProtocol
The protocol that defines the API for Credentials plugins for authentication of
incoming requests.
-
The name of the plugin.
Declaration
Swift
var name: String { get } -
User profile cache.
Declaration
Swift
var usersCache: NSCache<NSString, BaseCacheElement>? { get set } -
An indication as to whether the plugin is redirecting or not. The redirecting scheme is used for web session authentication, where the users, that are not logged in, are redirected to a login page. All other types of authentication are non-redirecting, i.e., unauthorized requests are rejected.
Declaration
Swift
var redirecting: Bool { get } -
Authenticate an incoming request.
Declaration
Swift
func authenticate (request: RouterRequest, response: RouterResponse, options: [String:Any], onSuccess: @escaping (UserProfile) -> Void, onFailure: @escaping (HTTPStatusCode?, [String:String]?) -> Void, onPass: @escaping (HTTPStatusCode?, [String:String]?) -> Void, inProgress: @escaping () -> Void)Parameters
requestThe
RouterRequestobject used to get information about the request.responseThe
RouterResponseobject used to respond to the request.optionsThe dictionary of plugin specific options.
onSuccessThe closure to invoke in the case of successful authentication.
onFailureThe closure to invoke in the case of an authentication failure.
onPassThe closure to invoke when the plugin doesn’t recognize the authentication data (usually an authentication token) in the request.
inProgressThe closure to invoke to cause a redirect to the login page in the case of redirecting authentication.
-
userProfileDelegateDefault implementationA delegate for
UserProfilemanipulation.Default Implementation
The default (nil) value for
UserProfileDelegate.Declaration
Swift
var userProfileDelegate: UserProfileDelegate? { get }
View on GitHub
CredentialsPluginProtocol Protocol Reference