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 - JimTools/basic-auth: PSR-7 and PSR-15 HTTP Basic Authentication Middleware

BranchesTags
Open more actions menu

Latest commit

 

History

333 Commits
333 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.vitepress
.vitepress
 
 
docs
docs
 
 
src
src
 
 
tests
tests
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.php-cs-fixer.dist.php
.php-cs-fixer.dist.php
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
phpunit.xml.dist
phpunit.xml.dist
 
 

Repository files navigation

PSR-7 and PSR-15 Basic Auth Middleware

Note

This package is a maintained version of a tuupola/slim-basic-auth, version 1 is forked from 3.x and will remained 100% backward compatible with the original library.

This middleware implements HTTP Basic Authentication. It was originally developed for Slim but can be used with all frameworks using PSR-7 or PSR-15 style middlewares. It has been tested with Slim Framework and Zend Expressive.

Latest Version Software License Build Status Coverage

use Slim\Factory\AppFactory;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Tuupola\Middleware\HttpBasicAuthentication;

require __DIR__ . '/vendor/autoload.php';

$app = AppFactory::create();
$app->addErrorMiddleware(true, true, true);
$app->addMiddleware(new HttpBasicAuthentication([
    'users' => ['cosmo' => 'tooManySecrets'],
]));

$app->get('/', function (Request $request, Response $response) {
    $response->getBody()->write('Hello, ' . $request->getServerParams()['PHP_AUTH_USER']);

    return $response;
});

$app->run();

Note

Heads up! You are reading documentation for 3.x branch which is PHP 7.1 and up only. If you are using older version of PHP see the 2.x branch. These two branches are not backwards compatible, see UPGRADING for instructions how to upgrade.

Install

composer require jimtools/basic-auth
composer remove tuupola/slim-basic-auth # migration only

Documentation

GitHub issues are used for only to discuss bugs and new features, for support please use GitHub discussions.

  • Documentation
  • Support
  • Bugs

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see LICENSE for more information.

About

PSR-7 and PSR-15 HTTP Basic Authentication Middleware

jimtools.github.io/basic-auth/

Topics

basic-authenticationpsr-15psr-7

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity

Stars

1 star

Watchers

0 watching

Forks

1 fork
Report repository

Releases

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.