Home

Awesome

JWTMiddleware

Handles authentication and authorization of models through JWT tokens by themselves or mixed with other authentication methods.

Install

Add this line to your manifest's dependencies array:

.package(url: "https://github.com/skelpo/JWTMiddleware.git", from: "0.6.1")

And add JWTMiddleware to all the target dependency arrays you want to access the package in.

Complete the installation by running vapor update or swift package update.

Modules

There are currently 2 modules in the JWTMiddleware package; JWTMiddleware and JWTAuthenticatable.

The JWTMiddleware module contains middleware for request authentication/authorization and helpers for getting data stored in the request by the middleware.

The JWTAuthenticatable module holds protocols that allow a type to be authenticated/authorized in the middleware declared in the JWTMiddleware module.

JWTMiddleware

The JWTMiddleware module exports the following types:

JWTAuthenticatable

The JWTAuthenticatable module exports the following types:

This module also adds some helper methods to the Request type: