piges / security
Piges security library for PHP
1.0.0
2022-03-18 15:59 UTC
Requires
- codercat/jwk-to-pem: 1.1
- firebase/php-jwt: 6.0
This package is auto-updated.
Last update: 2025-03-24 21:20:48 UTC
README
Library for use security funcionality of piges PaaS
Installation
composer require piges/security
Usage
Use autentication
<?php use Piges\Auth\AuthFilter; use Piges\Auth\AuthenticationHolder; try { AuthFilter::filter(); $user = Array( 'id' => AuthenticationHolder::getAuthentication()->getId(), 'authorities' => AuthenticationHolder::getAuthentication()->getAuthorities() ); } catch (\Throwable $th) { echo "Error in authentication: " + $th->getMessage(); }
Use UCP
<?php use Piges\Auth\AuthFilter; use Piges\Ucp\UcpFilter; use Piges\Ucp\UcpHolder; try { AuthFilter::filter(); UcpFilter::filter(); $user = Array( 'tenant' => UcpHolder::getUcp()->getTenant()->getName(), 'eopoos' => UcpHolder::getUcp()->getEopoos(), 'permissions' => UcpHolder::getUcp()->getPermissions() ); } catch (\Throwable $th) { echo "Error in authentication or in ucp: " + $th->getMessage(); }