AuthMiddleware
in package
Class AuthMiddleware
Table of Contents
- $permissionService : PermissionService
- $url : Url
- $userPreferences : UserPreferences
- __construct() : mixed
- AuthMiddleware constructor.
- __invoke() : ResponseInterface
- Middleware callback ensuring that a admin is logged in.
- checkAdminPermission() : bool
- redirectToLoginResponse() : Response
- Creates a response that is redirecting the the shop store's login.php page.
Properties
$permissionService
private
PermissionService
$permissionService
$url
private
Url
$url
$userPreferences
private
UserPreferences
$userPreferences
Methods
__construct()
AuthMiddleware constructor.
public
__construct(UserPreferences $userPreferences, Url $url, PermissionService $permissionService) : mixed
Parameters
- $userPreferences : UserPreferences
- $url : Url
- $permissionService : PermissionService
Return values
mixed —__invoke()
Middleware callback ensuring that a admin is logged in.
public
__invoke(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $handler : RequestHandlerInterface
Return values
ResponseInterface —checkAdminPermission()
private
checkAdminPermission(int $userId, ServerRequestInterface $request) : bool
Parameters
- $userId : int
- $request : ServerRequestInterface
Return values
bool —redirectToLoginResponse()
Creates a response that is redirecting the the shop store's login.php page.
private
redirectToLoginResponse(ServerRequestInterface $request) : Response
Parameters
- $request : ServerRequestInterface