WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

sudiptadeb/slim-security

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slim Security

A PSR7 compliant PHP middleware to meet all your security needs.

This project has just started, but to give you an idea about how this will be when you use it. See the sample configuration below.

There are two ways to congifure the middleware.

  • Directly when defining the middleware for each route
  • Globally via a config file (sample configureation below) and just make sure that this is invoked for every request. This will provide a way for even non middleware based projects to use this by just manually calling this on every page

Sample configuration (middleware init)

$app->addRoute('/dashboard/add*',['POST'],function(){})
        ->add(new SDeb\slim-security\SeceuiryMiddleware(
        {
            "csrf":true,
            "auth":true,
            "role":["ADMIN"],
            "params":[
                {
                    "name":"id",
                    "type":"long",
                    "required":true
                },
                {
                    "name":"action",
                    "type":"regex",
                    "regex":"ADD|DELETE|MODIFY"
                    "required":true
                },            
            ]
        }))

Sample configuration (global config):

{
    "properties":{
        "csrf-param-name":"mycsrfparam",
        "csrf-cookie-name":"mycsrfcookie",
        "auth-provider":"Debmego\common\AuthProvider",
        "...":"..."
    },
    "paths":[
        {
        "path":"/dashboard/add*",
        "method":["POST"],
        "csrf":true,
        "auth":true,
        "role":["ADMIN"],
        "params":[
            {
                "name":"id",
                "type":"long",
                "required":true
            },
            {
                "name":"action",
                "type":"regex",
                "regex":"ADD|DELETE|MODIFY"
                "required":true
            },            
        ]
        }
    ]
}

About

A middleware for slim framework with all the security features you will require at one place

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published