Guards
Guards implemented on top of pipelines have a single responsibility to check if a method can be activated.
guard pipeline must implement the IGuard interface.
if the guard decorate a class it will run on all class methods.
Usage#
now lets use out authGuard
Custom Error#
you can also throw your own custom error
Roles Guard example#
we assume we a user context on our request
now we check the controller