File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 11
11
use OpenClassrooms \ServiceProxy \Interceptor \Contract \PrefixInterceptor ;
12
12
use OpenClassrooms \ServiceProxy \Model \Request \Instance ;
13
13
use OpenClassrooms \ServiceProxy \Model \Response \Response ;
14
+ use Psr \Log \LoggerInterface ;
15
+ use Psr \Log \NullLogger ;
14
16
use Symfony \Component \ExpressionLanguage \ExpressionLanguage ;
15
17
16
18
final class SecurityInterceptor extends AbstractInterceptor implements PrefixInterceptor
17
19
{
20
+ private readonly LoggerInterface $ logger ;
21
+
18
22
public function __construct (
19
- iterable $ handlers = [],
23
+ iterable $ handlers = [],
20
24
private readonly ?SecurityInterceptorConfig $ config = null ,
25
+ ?LoggerInterface $ logger = null ,
21
26
) {
22
27
parent ::__construct ($ handlers );
28
+ $ this ->logger = $ logger ?? new NullLogger ();
23
29
}
24
30
25
31
public function getPrefixPriority (): int
@@ -41,6 +47,7 @@ public function prefix(Instance $instance): Response
41
47
;
42
48
43
49
if ($ this ->config ?->bypassSecurity) {
50
+ $ this ->logger ->error ('Security is bypassed. ' );
44
51
return new Response ();
45
52
}
46
53
You can’t perform that action at this time.
0 commit comments