All Projects → dereuromark → Cakephp Tinyauth

dereuromark / Cakephp Tinyauth

Licence: mit
CakePHP TinyAuth plugin for an easy and fast user authentication and authorization. Single or multi role. DB or config file based.

Projects that are alternatives of or similar to Cakephp Tinyauth

Awesome Iam
👤 Identity and Access Management Knowledge for Cloud Platforms
Stars: ✭ 186 (+63.16%)
Mutual labels:  authentication, authorization, acl
Authorization
PSR7 Middleware for authorization
Stars: ✭ 50 (-56.14%)
Mutual labels:  cakephp, cakephp-plugin, authorization
auth
Auth objects for CakePHP
Stars: ✭ 28 (-75.44%)
Mutual labels:  cakephp, authorization, cakephp-plugin
Brandenburg
Laravel Authentication Package
Stars: ✭ 79 (-30.7%)
Mutual labels:  authentication, authorization, acl
Laravel Acl
This package helps you to associate users with permissions and permission groups with laravel framework
Stars: ✭ 404 (+254.39%)
Mutual labels:  authentication, authorization, acl
Acl
Plugin for managing ACL in CakePHP applications.
Stars: ✭ 113 (-0.88%)
Mutual labels:  cakephp, cakephp-plugin, acl
React Mobx Firebase Authentication
🔥Boilerplate Project for Authentication with Firebase in React and MobX
Stars: ✭ 111 (-2.63%)
Mutual labels:  authentication, authorization
Vakt
Attribute-based access control (ABAC) SDK for Python
Stars: ✭ 92 (-19.3%)
Mutual labels:  authorization, acl
Imperium
Role-based Authorizations library for Node.js
Stars: ✭ 109 (-4.39%)
Mutual labels:  authorization, acl
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-15.79%)
Mutual labels:  authentication, authorization
Ueberauth
An Elixir Authentication System for Plug-based Web Applications
Stars: ✭ 1,259 (+1004.39%)
Mutual labels:  authentication, authorization
Spring Security React Ant Design Polls App
Full Stack Polls App built using Spring Boot, Spring Security, JWT, React, and Ant Design
Stars: ✭ 1,336 (+1071.93%)
Mutual labels:  authentication, authorization
Mern Boilerplate
Fullstack boilerplate with React, Redux, Express, Mongoose, Passport Local, JWT, Facebook and Google OAuth out of the box.
Stars: ✭ 112 (-1.75%)
Mutual labels:  authentication, authorization
Nextjs Redux Firebase Authentication
Boilerplate Project for Authentication with Firebase in NextJs and Redux
Stars: ✭ 90 (-21.05%)
Mutual labels:  authentication, authorization
Aspnetcorewindowsauth
Local and Windows Authentication, ASP.NET Core MVC, IdentityServer4
Stars: ✭ 87 (-23.68%)
Mutual labels:  authentication, authorization
Spring Webmvc Pac4j
Security library for Spring Web MVC: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 110 (-3.51%)
Mutual labels:  authentication, authorization
Blazorboilerplate
Blazor Boilerplate / Starter Template with MatBlazor
Stars: ✭ 1,258 (+1003.51%)
Mutual labels:  authentication, authorization
Jcasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Java
Stars: ✭ 1,335 (+1071.05%)
Mutual labels:  authorization, acl
Express Jwt
An example API for creating/verifying json web tokens
Stars: ✭ 105 (-7.89%)
Mutual labels:  authentication, authorization
Warden Github Rails
Use GitHub as authorization and more. Use organizations and teams as means of authorization by simply wrapping your rails routes in a block. Also useful to get a user's details through OAuth.
Stars: ✭ 100 (-12.28%)
Mutual labels:  authentication, authorization

CakePHP TinyAuth Plugin

CI Latest Stable Version Coverage Status Minimum PHP Version License Total Downloads Coding Standards

A CakePHP plugin to handle authentication and user authorization the easy way.

This branch is for CakePHP 4.0+. For details see version map.

Features

Authentication

What are public actions, which ones need login?

  • Powerful wildcard (*) operator.
  • Quick Setup for 5 minute integration.

Authorization

Once you are logged in, what actions can you see with your role(s)?

  • Single-role: 1 user has 1 role (users and roles table for example)
  • Multi-role: 1 user can have 1...n roles (users, roles and a "roles_users" pivot table for example)
  • Quick Setup for 5 minute integration.

Useful helpers

  • AuthUser Component and Helper for stateful and stateless "auth data" access.
  • Authentication Component and Helper for isPublic() check on current other other actions.
  • Auth DebugKit panel for detailed insights into current URL and auth status.

What's the idea?

Default CakePHP authentication and authorization depends on code changes in at least each controller, maybe more classes. This plugin hooks in with a single line of change and manages all that using config files and there is no need to touch all those controllers, including plugin controllers.

It is also possible to manage the config files without the need to code. And it can with adapters also be moved completely to the DB and managed by CRUD backend.

Ask yourself: Do you need the overhead and complexity involved with the full blown (RBAC DB) ACL? See also my post acl-access-control-lists-revised/. If not, then this plugin could very well be your answer and a super quick solution to your auth problem :)

But even if you don't leverage the authentication or authorization, the available AuthUserComponent and AuthUserHelper can be very useful when dealing with role based decisions in your controller or view level. They also work stand-alone.

Demo

See https://sandbox.dereuromark.de/auth-sandbox

auth_allow.ini

Define the public actions (accessible by anyone) per controller:

Users = index,view
Admin/Maintenance = pingCheck
PluginName.SomeController = *
MyPlugin.Api/V1 = *

auth_acl.ini

Define what actions may be accessed by what logged-in user role:

[Users]
index = *
add,edit = user,super-user

[Admin/Users]
* = admin

[Translate.Admin/Languages]
* = *

AuthUser component and helper

$currentId = $this->AuthUser->id();

$isMe = $this->AuthUser->isMe($userEntity->id);

if ($this->AuthUser->hasRole('mod')) {
} 

if ($this->AuthUser->hasAccess(['action' => 'secretArea'])) {
}

// Helper only
echo $this->AuthUser->link('Admin Backend', ['prefix' => 'Admin', 'action' => 'index']);
echo $this->AuthUser->postLink('Delete', ['action' => 'delete', $id], ['confirm' => 'Sure?']);

Installation

Including the plugin is pretty much as with every other CakePHP plugin:

composer require dereuromark/cakephp-tinyauth

Then, to load the plugin either run the following command:

bin/cake plugin load TinyAuth

or manually add the following line to your app's src/Application.php file's bootstrap() function:

$this->addPlugin('TinyAuth');

That's it. It should be up and running.

Docs

For setup and usage see Docs.

Also note the original blog post and how it all started.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].