Authenticatable
Capable of being authenticated.
protocol Authenticatable
Browse conforming typesCapable of being authenticated.
protocol Authenticatable
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
static func guardMiddleware(throwing error: Error = Abort(.unauthorized, reason: "\(Self.self) not authenticated.")) -> Middleware
This middleware ensures that an Authenticatable
type A
has been authenticated by a previous Middleware
or throws an Error
. The middlewares that actually perform authentication will not throw errors if they fail to authenticate the user (except in some exceptional cases like malformed data). This allows the middlewares to be composed together to create chains of authentication for multiple user types.
@preconcurrency static func redirectMiddleware(makePath: @escaping (Request) -> String) -> Middleware
Basic middleware to redirect unauthenticated requests to the supplied path
static func redirectMiddleware(path: String) -> Middleware
Basic middleware to redirect unauthenticated requests to the supplied path
protocol SessionAuthenticatable : Authenticatable
Models conforming to this protocol can have their authentication status cached using SessionAuthenticator
.