AuthenticationChain
in package
implements
AuthenticationChainContract
Uses
Microable, Containable
Authentication chain.
This class is responsible for managing the authentication backends in the application.
It will be run on every request to authenticate the user by the kernel
Table of Contents
Interfaces
Properties
- $context : ContainerInterface|Container|null
- Application container context
- $macros : array<string|int, mixed>
- $application : PioniaApplication
- $authentications : Arrayable
Methods
- __call() : mixed
- Dynamically handle calls to the class.
- __callStatic() : mixed
- Dynamically handle calls to the class.
- __construct() : mixed
- addAfter() : static
- Add an authentication after another
- addAll() : $this
- Add multiple authentications at ago
- addAuthenticationBackend() : static
- Adds an authentication backend to the chain
- addBefore() : static
- Add an authentication backend before another
- contextArrAdd() : void
- contextHas() : bool
- Check if a value exists in the container
- contextMake() : mixed
- Make an instance of a class from the container. This will throw an exception if the class is not found
- contextMakeSilently() : mixed
- Create an instance of a class without throwing an exception when it fails
- flushMacros() : void
- Remove all the macros we had registered
- getAuthentications() : array<string|int, mixed>
- Get the authentications in chain
- getOrDefault() : mixed
- Get a value from the container or return a default value
- getOrFail() : mixed
- Get a value from the container or throw an exception.
- getSilently() : mixed
- Get a value from the container or return null instead of throwing an exception
- handle() : void
- Run the authentication chain on a request Fires the PreAuthRunEvent before running the chain and PostAuthRunEvent after running the chain
- hasMacro() : bool
- Check if we have a method in the balonables
- isAuthenticationContract() : bool
- macro() : void
- Add a new mixable to the macros
- mixin() : void
- Mix another object into the class.
- next() : void
- Run the next authentication backend in the chain.
- set() : static
- Set a value in the container
- canRunOnCurrentService() : bool
- run() : void
Properties
$context
Application container context
public
ContainerInterface|Container|null
$context
$macros
protected
static array<string|int, mixed>
$macros
= []
$application
private
PioniaApplication
$application
$authentications
private
Arrayable
$authentications
Methods
__call()
Dynamically handle calls to the class.
public
__call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
__callStatic()
Dynamically handle calls to the class.
public
static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
__construct()
public
__construct(PioniaApplication $application) : mixed
Parameters
- $application : PioniaApplication
addAfter()
Add an authentication after another
public
addAfter(string $authToPoint, string $authToAdd) : static
Parameters
- $authToPoint : string
- $authToAdd : string
Return values
staticaddAll()
Add multiple authentications at ago
public
addAll(array<string|int, mixed>|Arrayable $authentications) : $this
Parameters
- $authentications : array<string|int, mixed>|Arrayable
Return values
$thisaddAuthenticationBackend()
Adds an authentication backend to the chain
public
addAuthenticationBackend(string $authenticationContract) : static
Parameters
- $authenticationContract : string
Return values
staticaddBefore()
Add an authentication backend before another
public
addBefore(string $authToPoint, string $authToAdd) : static
Parameters
- $authToPoint : string
- $authToAdd : string
Return values
staticcontextArrAdd()
public
contextArrAdd(string $contextKey, array<string|int, mixed> $dataToAdd) : void
Parameters
- $contextKey : string
- $dataToAdd : array<string|int, mixed>
contextHas()
Check if a value exists in the container
public
contextHas(string $key) : bool
Parameters
- $key : string
Return values
boolcontextMake()
Make an instance of a class from the container. This will throw an exception if the class is not found
public
contextMake(string $name[, array<string|int, mixed> $parameters = [] ]) : mixed
Parameters
- $name : string
- $parameters : array<string|int, mixed> = []
Tags
contextMakeSilently()
Create an instance of a class without throwing an exception when it fails
public
contextMakeSilently(string $name[, array<string|int, mixed> $parameters = [] ]) : mixed
Parameters
- $name : string
- $parameters : array<string|int, mixed> = []
flushMacros()
Remove all the macros we had registered
public
static flushMacros() : void
getAuthentications()
Get the authentications in chain
public
getAuthentications() : array<string|int, mixed>
Return values
array<string|int, mixed>getOrDefault()
Get a value from the container or return a default value
public
getOrDefault(string $key, mixed $default) : mixed
Parameters
- $key : string
- $default : mixed
getOrFail()
Get a value from the container or throw an exception.
public
getOrFail(string $key) : mixed
Parameters
- $key : string
Tags
getSilently()
Get a value from the container or return null instead of throwing an exception
public
getSilently(mixed $key) : mixed
Parameters
- $key : mixed
handle()
Run the authentication chain on a request Fires the PreAuthRunEvent before running the chain and PostAuthRunEvent after running the chain
public
handle(Request $request) : void
Parameters
- $request : Request
hasMacro()
Check if we have a method in the balonables
public
static hasMacro(string $name) : bool
Parameters
- $name : string
Return values
boolisAuthenticationContract()
public
isAuthenticationContract(string $authenticationContract) : bool
Parameters
- $authenticationContract : string
Return values
boolmacro()
Add a new mixable to the macros
public
static macro(string $key, $value) : void
Parameters
mixin()
Mix another object into the class.
public
static mixin(object $mixin[, bool $replace = true ]) : void
Parameters
- $mixin : object
- $replace : bool = true
Tags
next()
Run the next authentication backend in the chain.
public
next(Request $request, AuthenticationContract $next) : void
Parameters
- $request : Request
- $next : AuthenticationContract
set()
Set a value in the container
public
set(string $name, mixed $value) : static
Parameters
- $name : string
- $value : mixed
Return values
staticcanRunOnCurrentService()
private
canRunOnCurrentService(AuthenticationBackend $auth, string|null $currentService) : bool
Parameters
- $auth : AuthenticationBackend
- $currentService : string|null
Return values
boolrun()
private
run(Request $request) : void
Parameters
- $request : Request