-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathAuthenticationHandlerEvent.php
More file actions
132 lines (114 loc) · 3.02 KB
/
AuthenticationHandlerEvent.php
File metadata and controls
132 lines (114 loc) · 3.02 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/**
* This file is part of the LdapToolsBundle package.
*
* (c) Chad Sikorra <Chad.Sikorra@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace LdapTools\Bundle\LdapToolsBundle\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
/**
* Represents an authentication handler event, such as success or failure, where the response can be set.
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class AuthenticationHandlerEvent extends EventDispatcher
{
/**
* The event name that happens after the default authentication success handler is called.
*/
const SUCCESS = 'ldap_tools_bundle.guard.login.success';
/**
* The event name that happens after the default authentication failure handler is called.
*/
const FAILURE = 'ldap_tools_bundle.guard.login.failure';
/**
* The event name that happens when the entry point is called for the guard and returns a redirect/response.
*/
const START = 'ldap_tools_bundle.guard.login.start';
/**
* @var Response
*/
protected $response;
/**
* @var AuthenticationException|null
*/
protected $exception;
/**
* @var Request
*/
protected $request;
/**
* @var TokenInterface|null
*/
protected $token;
/**
* @var string|null
*/
protected $providerKey;
/**
* @param Response $response
* @param Request $request
* @param null|AuthenticationException $exception
* @param TokenInterface|null $token
* @param string|null $providerKey
*/
public function __construct(Response $response, Request $request, AuthenticationException $exception = null, TokenInterface $token = null, $providerKey = null)
{
$this->request = $request;
$this->response = $response;
$this->exception = $exception;
$this->token = $token;
$this->providerKey = $providerKey;
}
/**
* @return Response
*/
public function getResponse()
{
return $this->response;
}
/**
* @return Request
*/
public function getRequest()
{
return $this->request;
}
/**
* @param Response $response
* @return $this
*/
public function setResponse(Response $response)
{
$this->response = $response;
return $this;
}
/**
* @return AuthenticationException|null
*/
public function getException()
{
return $this->exception;
}
/**
* @return null|TokenInterface
*/
public function getToken()
{
return $this->token;
}
/**
* @return null|string
*/
public function getProviderKey()
{
return $this->providerKey;
}
}