Skip to content

Commit f61eadf

Browse files
author
Marko Dobric
committed
Improve saml authorizer
1 parent e68b405 commit f61eadf

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Active Collab Authentication project.
5+
*
6+
* (c) A51 doo <[email protected]>. All rights reserved.
7+
*/
8+
9+
namespace ActiveCollab\Authentication\Authorizer\ExceptionAware;
10+
11+
/**
12+
* @package ActiveCollab\Authentication\Authorizer\ExceptionAware
13+
*/
14+
trait ExceptionAware
15+
{
16+
/**
17+
* @var ExceptionAwareInterface
18+
*/
19+
private $exception_processor;
20+
21+
/**
22+
* {@inheritdoc}
23+
*/
24+
public function getExceptionProcessor()
25+
{
26+
return $this->exception_processor;
27+
}
28+
29+
/**
30+
* @param ExceptionAwareInterface|null $exception_processor
31+
* @return $this
32+
*/
33+
protected function &setExceptionProcessor(ExceptionAwareInterface $exception_processor = null)
34+
{
35+
$this->exception_processor = $exception_processor;
36+
37+
return $this;
38+
}
39+
}

src/Authorizer/SamlAuthorizer.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
namespace ActiveCollab\Authentication\Authorizer;
1010

1111
use ActiveCollab\Authentication\AuthenticatedUser\RepositoryInterface;
12+
use ActiveCollab\Authentication\Authorizer\ExceptionAware\ExceptionAwareInterface;
13+
use ActiveCollab\Authentication\Authorizer\ExceptionProcessor\ExceptionAwareProcessor as ExceptionAware;
14+
use ActiveCollab\Authentication\Authorizer\ExceptionProcessor\ExceptionAwareProcessorInterface;
1215
use ActiveCollab\Authentication\Authorizer\RequestAware\RequestAware;
1316
use ActiveCollab\Authentication\Authorizer\RequestAware\RequestAwareInterface;
1417
use ActiveCollab\Authentication\Authorizer\RequestProcessor\RequestProcessorInterface;
@@ -18,9 +21,9 @@
1821
/**
1922
* @package ActiveCollab\Authentication\Authorizer
2023
*/
21-
class SamlAuthorizer extends Authorizer implements RequestAwareInterface
24+
class SamlAuthorizer extends Authorizer implements RequestAwareInterface, ExceptionAwareProcessorInterface
2225
{
23-
use RequestAware;
26+
use RequestAware, ExceptionAware;
2427

2528
/**
2629
* @var RepositoryInterface
@@ -30,11 +33,13 @@ class SamlAuthorizer extends Authorizer implements RequestAwareInterface
3033
/**
3134
* @param RepositoryInterface $user_repository
3235
* @param RequestProcessorInterface $request_processor
36+
* @param ExceptionAwareInterface $exception_processor
3337
*/
34-
public function __construct(RepositoryInterface $user_repository, RequestProcessorInterface $request_processor = null)
38+
public function __construct(RepositoryInterface $user_repository, RequestProcessorInterface $request_processor = null, ExceptionAwareInterface $exception_processor = null)
3539
{
3640
$this->user_repository = $user_repository;
3741
$this->setRequestProcessor($request_processor);
42+
$this->setExceptionProcessor($exception_processor);
3843
}
3944

4045
/**

0 commit comments

Comments
 (0)