Skip to content

Commit 985ddf6

Browse files
authored
Merge pull request #12 from markodobric/feature/exception-aware
Feature/exception aware
2 parents e04c372 + f61eadf commit 985ddf6

File tree

4 files changed

+110
-3
lines changed

4 files changed

+110
-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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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\ExceptionProcessor;
10+
11+
use ActiveCollab\Authentication\Authorizer\ExceptionAware\ExceptionAwareInterface;
12+
13+
/**
14+
* @package ActiveCollab\Authentication\Authorizer\ExceptionProcessor
15+
*/
16+
trait ExceptionAwareProcessor
17+
{
18+
/**
19+
* @var ExceptionAwareInterface
20+
*/
21+
private $exception_processor;
22+
23+
/**
24+
* {@inheritdoc}
25+
*/
26+
public function getExceptionProcessor()
27+
{
28+
return $this->exception_processor;
29+
}
30+
31+
/**
32+
* @param ExceptionAwareInterface|null $exception_processor
33+
* @return $this
34+
*/
35+
protected function &setExceptionProcessor(ExceptionAwareInterface $exception_processor = null)
36+
{
37+
$this->exception_processor = $exception_processor;
38+
39+
return $this;
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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\ExceptionProcessor;
10+
11+
use ActiveCollab\Authentication\Authorizer\ExceptionAware\ExceptionAwareInterface;
12+
13+
/**
14+
* @package ActiveCollab\Authentication\Authorizer\ExceptionProcessor
15+
*/
16+
interface ExceptionAwareProcessorInterface
17+
{
18+
/**
19+
* @return ExceptionAwareInterface
20+
*/
21+
public function getExceptionProcessor();
22+
}

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)