JWT

extension JWT: TypeSafeCredentials
  • id

    Note: This field does not apply to Type-safe JWT credentials. Use the JWT claims instead.

    Declaration

    Swift

    public var id: String { get }
  • Answers JWT.

    Declaration

    Swift

    public var provider: String { get }
  • Attempts to authenticate a request with an Authorization header containing a JWT. The possible outcomes depend on the X-token-type header:

    • If X-token-type is set to JWT, then this will either succeed or fail.
    • If X-token-type is set to another value, this will pass (defer to other type-safe middlewares in the case of multi-auth).
    • If X-token-type is not set, then this and will either succeed or pass.

    Declaration

    Swift

    public static func authenticate(request: RouterRequest, response: RouterResponse,
                                    onSuccess: @escaping (JWT<T>) -> Void,
                                    onFailure: @escaping (HTTPStatusCode?, [String : String]?) -> Void,
                                    onSkip: @escaping (HTTPStatusCode?, [String : String]?) -> Void)