Structure
AuthenticateMiddlewareUseCase
public struct AuthenticateMiddlewareUseCase: UseCase
Use cases for authentication middlewares.
Initializers
Methods
payload(by:)
public func payload(by token: String ) throws -> SessionPayload
This use case has work of expand payload from JWT.
Parameters
Name | Type | Description |
---|---|---|
token | String |
Please pass in the JWT that expand payload. |
Throws
See JWTRepository.verifyJWT
.
Returns
See SessionPayload
.
user(by:)
public func user(by token: String ) throws -> Future<(Int, User)>
This use case has work of receiving the JWT and get User
's infomation.
Parameters
Name | Type | Description |
---|---|---|
token | String |
Please pass in the JWT that expand payload. |
Throws
See JWTRepository.verifyJWT
.
Returns
The Future
that returns (Int, User)
. Int is User
's Id.