-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
HandlerContract.php
65 lines (57 loc) · 1.72 KB
/
HandlerContract.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
namespace romanzipp\Blockade\Handlers\Contracts;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
interface HandlerContract
{
/**
* Check if the current request is excluded for blockade authentication.
*
* @param \Illuminate\Http\Request $request
*
* @return bool
*/
public function isExcludedForRequest(Request $request): bool;
/**
* Check if the current request is already authenticated.
*
* @param \Illuminate\Http\Request $request
*
* @return bool
*/
public function isAuthenticated(Request $request): bool;
/**
* Check if the current request is attempting authentication.
*
* @param \Illuminate\Http\Request $request
*
* @return bool
*/
public function requestAttemptsAuthentication(Request $request): bool;
/**
* Attempt the blockade authentication.
*
* @param \Illuminate\Http\Request $request
*
* @return bool
*/
public function attemptAuthentication(Request $request): bool;
/**
* Store the successful authentication state and return a response.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function getSuccessResponse(Request $request, \Closure $next): SymfonyResponse;
/**
* Get the response for failed or missing authentication.
*
* @param \Illuminate\Http\Request $request
* @param array<string, mixed> $data
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function getFailedResponse(Request $request, array $data = []): SymfonyResponse;
}