- Unauthorize response now allows ResponseInterface as type
This commit is contained in:
parent
63c7dc23f9
commit
e20157a162
@ -14,11 +14,11 @@ class SecurityHandler {
|
||||
|
||||
protected ResponseInterface $redirectResponse;
|
||||
|
||||
protected ? \Closure $unauthorizeResponse;
|
||||
protected \Closure|ResponseInterface|null $unauthorizeResponse;
|
||||
|
||||
protected ? Taxus $taxus;
|
||||
|
||||
public function __construct(ResponseInterface $redirectResponse, ? \Closure $unauthorizeResponse = null, ? Taxus $taxus = null) {
|
||||
public function __construct(ResponseInterface $redirectResponse, \Closure|ResponseInterface|null $unauthorizeResponse = null, ? Taxus $taxus = null) {
|
||||
$this->redirectResponse = $redirectResponse;
|
||||
$this->unauthorizeResponse = $unauthorizeResponse;
|
||||
$this->taxus = $taxus;
|
||||
@ -51,6 +51,10 @@ class SecurityHandler {
|
||||
}
|
||||
|
||||
if ($this->unauthorizeResponse) {
|
||||
if ($this->unauthorizeResponse instanceof ResponseInterface) {
|
||||
return $this->unauthorizeResponse;
|
||||
}
|
||||
|
||||
return call_user_func_array($this->unauthorizeResponse, [ $user, ['method' => $fromMethod, 'object' => $fromObject ], $className, $methodName ]);
|
||||
}
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user