PHP Class Psr7Middlewares\Middleware\BasicAuthentication

Inheritance: use trait Psr7Middlewares\Utils\AuthenticationTrait
Show file Open project: oscarotero/psr7-middlewares

Public Methods

Method Description
__invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface Execute the middleware.
getUsername ( Psr\Http\Message\ServerRequestInterface $request ) : string | null Returns the username.

Private Methods

Method Description
checkUserPassword ( string $username, string $password ) : boolean Validate the user and password.
parseAuthorizationHeader ( string $header ) : false | array Parses the authorization header for a basic authentication.

Method Details

__invoke() public method

Execute the middleware.
public __invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\ServerRequestInterface
$response Psr\Http\Message\ResponseInterface
$next callable
return Psr\Http\Message\ResponseInterface

getUsername() public static method

Returns the username.
public static getUsername ( Psr\Http\Message\ServerRequestInterface $request ) : string | null
$request Psr\Http\Message\ServerRequestInterface
return string | null