Skip to content

kanata-php/user-authorization-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Authorization

Kanata Plugin

This plugin adds an authorization layer where it is configurable which routes will be protected, and a formal way of keeping Users.

Installation

Activate plugin:

php kanata plugin:activate UserAuthorization

Publish config file:

php kanata plugin:publish UserAuthorization config

Config

Seed

To start with your first user without having to register through the UI, you can seed via kanata command:

php kanata user-auth:seed --name=John [email protected] --password=secret --email-verified

Email Verification

To have the email verified, you'll need 2 items to be in place:

  1. Mail Plugin installed and active.
  2. Configuration authorization.email-confirmation set to true.

Once you have those 2 in place, the system will send an email for confirmation. Without that users will have email set to verified as soon as they register.

API

Single-Use Token

this endpoint servers the purpose to generate a Token to be used only once, after that it gets expired.

Request

GET /api/issue-single-use-token

Responses

Success:

Status: 200

Header:

Authorization: Bearer {token-value}

Body:

{
  "token": "token-value"
}

Errors

422 - Validation/Authorization Error.

500 - Server Error.

Commands

Issue token

php kanata token:issue --name="my-token-name" [email protected]

Seed Users

php kanata user-auth:seed --name="John Doe" [email protected] --password=secret

About

Kanata Plugin for user authorization.

Resources

Stars

Watchers

Forks

Packages

No packages published