Git Product home page Git Product logo

wn-guardian-plugin's Introduction

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

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

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

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

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

Access to routes are restricted by applying the AuthorizationControl middleware.

<?php
Route::middleware([\Norotaro\Guardian\Middlewares\AuthorizationControl::class])
    ->group(function () {
    // All routes here will require authorization
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.