GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - codeigniter4/shield: Authentication and Authorization for CodeIgniter 4

BranchesTags
Open more actions menu

Latest commit

 

History

3,001 Commits
3,001 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
admin
admin
 
 
bin
bin
 
 
docs
docs
 
 
src
src
 
 
tests
tests
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.php-cs-fixer.dist.php
.php-cs-fixer.dist.php
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
UPGRADING.md
UPGRADING.md
 
 
composer-unused.php
composer-unused.php
 
 
composer.json
composer.json
 
 
infection.json5
infection.json5
 
 
mkdocs.yml
mkdocs.yml
 
 
phpstan-baseline.php
phpstan-baseline.php
 
 
phpstan.dist.neon
phpstan.dist.neon
 
 
phpunit.dist.xml
phpunit.dist.xml
 
 
psalm-baseline.xml
psalm-baseline.xml
 
 
psalm.xml
psalm.xml
 
 
psalm_autoload.php
psalm_autoload.php
 
 
pyrameter.php
pyrameter.php
 
 
rector.php
rector.php
 
 
roave-bc-check.yaml
roave-bc-check.yaml
 
 
structarmed.php
structarmed.php
 
 

Repository files navigation

CodeIgniter Shield

Unit Tests Static Analysis PHP-CS-Fixer Rector Psalm Architecture Coverage Status

Shield is the official authentication and authorization framework for CodeIgniter 4. While it does provide a base set of tools that are commonly used in websites, it is designed to be flexible and easily customizable.

The primary goals for Shield are:

  1. It must be very flexible and allow developers to extend/override almost any part of it.
  2. It must have security at its core. It is an auth lib after all.
  3. To cover many auth needs right out of the box, but be simple to add additional functionality to.

Authentication Methods

Shield provides two primary methods Session-based and Access Token authentication out of the box.

It also provides HMAC SHA256 Token and JSON Web Token authentication.

Session-based

This is your typical email/username/password system you see everywhere. It includes a secure "remember-me" functionality. This can be used for standard web applications, as well as for single page applications. Includes full controllers and basic views for all standard functionality, like registration, login, forgot password, etc.

Access Token

These are much like the access tokens that GitHub uses, where they are unique to a single user, and a single user can have more than one. This can be used for API authentication of third-party users, and even for allowing access for a mobile application that you build.

HMAC SHA256 Token

This is a slightly more complicated improvement on Access Token authentication. The main advantage with HMAC is the shared Secret Key is not passed in the request, but is instead used to create a hash signature of the request body.

JSON Web Token

JWT or JSON Web Token is a compact and self-contained way of securely transmitting information between parties as a JSON object. It is commonly used for authentication and authorization purposes in web applications.

Important Features

  • Session-based authentication (traditional ID/Password with Remember-me)
  • Stateless authentication using Personal Access Tokens
  • Optional Email verification on account registration
  • Optional Email-based Two-Factor Authentication after login
  • Magic Link Login when a user forgets their password
  • Flexible Groups-based access control (think Roles, but more flexible)
  • Users can be granted additional Permissions

See the An Official Auth Library for more Info.

Getting Started

Prerequisites

Usage of Shield requires the following:

  • A CodeIgniter 4.3.5+ based project
  • Composer for package management
  • PHP 8.1+

Installation

Installation is done through Composer.

composer require codeigniter4/shield

See the docs for more specific instructions on installation and usage recommendations.

Contributing

Shield does accept and encourage contributions from the community in any shape. It doesn't matter whether you can code, write documentation, or help find bugs, all contributions are welcome. See the CONTRIBUTING.md file for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

Every open-source project depends on its contributors to be a success. The following users have contributed in one manner or another in making Shield:

Contributors

Made with contrib.rocks.

The following articles/sites have been fundamental in shaping the security and best practices used within this library, in no particular order:

  • Google Cloud: 13 best practices for user account, authentication, and password management, 2021 edition
  • NIST Digital Identity Guidelines
  • Implementing Secure User Authentication in PHP Applications with Long-Term Persistence (Login with "Remember Me" Cookies)
  • Password Storage - OWASP Cheat Sheet Series

About

Authentication and Authorization for CodeIgniter 4

shield.codeigniter.com

Topics

authauthenticationauthorizationcodeigniter4

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

431 stars

Watchers

33 watching

Forks

144 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.