import Vapor struct UserAuthenticator: AsyncBasicAuthenticator where User.SessionID == ExpiringUserId { func authenticate (basic: BasicAuthorization, for request: Request) async throws { if let user = try await request.db.withSQLConnection { connection in return try await User.find (email: basic.username, password: basic.password, on: connection) } { request.auth.login (user) } } }