1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Slides\Saml2\Resolvers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Http\Request; |
|
|
|
|
6
|
|
|
use Illuminate\Support\Facades\Log; |
7
|
|
|
use Slides\Saml2\Contracts\IdentityProvidable; |
8
|
|
|
use Slides\Saml2\Contracts\ResolvesIdentityProvider; |
9
|
|
|
use Slides\Saml2\Repositories\IdentityProviderRepository; |
10
|
|
|
|
11
|
|
|
class IdentityProviderResolver implements ResolvesIdentityProvider |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var IdentityProviderRepository |
15
|
|
|
*/ |
16
|
|
|
protected IdentityProviderRepository $repository; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @param IdentityProviderRepository $repository |
20
|
|
|
*/ |
21
|
|
|
public function __construct(IdentityProviderRepository $repository) |
22
|
|
|
{ |
23
|
|
|
$this->repository = $repository; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Resolve a tenant from the request. |
28
|
|
|
* |
29
|
|
|
* @param Request $request |
30
|
|
|
* |
31
|
|
|
* @return IdentityProvidable|null |
32
|
|
|
*/ |
33
|
|
|
public function resolve(Request $request): ?IdentityProvidable |
34
|
|
|
{ |
35
|
|
|
if (!$uuid = $request->route('uuid')) { |
36
|
|
|
if (config('saml2.debug')) { |
|
|
|
|
37
|
|
|
Log::debug('[Saml2] Identity Provider UUID is not present in the URL so cannot be resolved', [ |
38
|
|
|
'url' => $request->fullUrl() |
39
|
|
|
]); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
return null; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
if (!$idp = $this->repository->findByUUID($uuid)) { |
46
|
|
|
if (config('saml2.debug')) { |
47
|
|
|
Log::debug('[Saml2] Identity Provider cannot be found', ['uuid' => $uuid]); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
return null; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
if ($idp->trashed()) { |
54
|
|
|
if (config('saml2.debug')) { |
55
|
|
|
Log::debug("[Saml2] Identity Provider #{$idp->id} resolved but marked as deleted", [ |
56
|
|
|
'id' => $idp->id, |
57
|
|
|
'uuid' => $uuid, |
58
|
|
|
'deleted_at' => $idp->deleted_at->toDateTimeString() |
|
|
|
|
59
|
|
|
]); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
return null; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
return $idp; |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths