circli/api-auth-extension

Installs: 1 751

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:circli-extension

1.0.0 2019-12-05 13:47 UTC

This package is auto-updated.

Last update: 2024-09-29 09:17:27 UTC


README

Extension to help with basic api authentication

The package include 3 different authentication providers

  1. BasicAuth
  2. AccessKey
  3. Token

BasicAuth

Usage

use Circli\ApiAuth\Repository\ArrayBasicAuthRepository;
use Circli\ApiAuth\Provider\BasicAuthProvider;
use Circli\ApiAuth\Middleware\ApiAuthenticationMiddleware;

$authRepository = new ArrayBasicAuthRepository(['admin' => 'password']);

$middleware = new ApiAuthenticationMiddleware(new BasicAuthProvider($authRepository));

AccessKey

Usage

use Circli\ApiAuth\Repository\AccessKeyRepository;
use Circli\ApiAuth\Provider\AccessKeyProvider;
use Circli\ApiAuth\Middleware\ApiAuthenticationMiddleware;

$repository = new YourImplementationOfAccessKeyRepository();

$middleware = new ApiAuthenticationMiddleware(new AccessKeyProvider($repository));

Token

Usage

use Circli\ApiAuth\Repository\AuthTokenRepository;
use Circli\ApiAuth\Provider\AuthTokenProvider;
use Circli\ApiAuth\Middleware\ApiAuthenticationMiddleware;

$repository = new YourImplementationOfAuthTokenRepository();

$middleware = new ApiAuthenticationMiddleware(new AuthTokenProvider($repository));