PHPackages                             norotaro/wn-guardian-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. norotaro/wn-guardian-plugin

ActiveWinter-plugin[Utility &amp; Helpers](/categories/utility)

norotaro/wn-guardian-plugin
===========================

v1.1.2(4y ago)5162MITPHP

Since Jul 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/norotaro/wn-guardian-plugin)[ Packagist](https://packagist.org/packages/norotaro/wn-guardian-plugin)[ Docs](https://github.com/norotaro/wn-guardian-plugin)[ RSS](/packages/norotaro-wn-guardian-plugin/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (1)Versions (5)Used By (0)

Guardian Plugin for WinterCMS
=============================

[](#guardian-plugin-for-wintercms)

Allows to easily restrict access to routes declared by plugins in `routes.php`.

Using the `AuthorizationControl` middleware provided with this plugin your routes will be accesibles only by the clients registered in the back-end.

Installation
------------

[](#installation)

Run the following command in a project's root directory:

```
composer require norotaro/wn-guardian-plugin
php artisan winter:up
```

Managing clients
----------------

[](#managing-clients)

Clients are managed on the Guardian menu found in the back-end. Each client provides minimal data fields - **Name**, **Shortname**, **Active** and **Authorization Codes**.

Each **Authorization Code** is represented by a **Value** and an **Active** field.

Client authorization
--------------------

[](#client-authorization)

When a client make a request it needs to authenticate sending the following headers:

- `User-Agent: {{shortname}}`
- `Authorization: {{activeCode}}`

Where `{{shortname}}` is a short name of a client created in the back-end and `{{activeCode}}` is one of the code created for that client and that is active.

AuthorizationControl middleware
-------------------------------

[](#authorizationcontrol-middleware)

Access to routes are restricted by applying the `AuthorizationControl` middleware.

```
