-
Notifications
You must be signed in to change notification settings - Fork 2
/
SecurityEvent.php
executable file
·66 lines (52 loc) · 1.44 KB
/
SecurityEvent.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
66
<?php
/**
* Webiny Framework (http://www.webiny.com/framework)
*
* @copyright Copyright Webiny LTD
*/
namespace Webiny\Component\Security;
use Webiny\Component\EventManager\Event;
use Webiny\Component\Security\User\AbstractUser;
/**
* This class is passed along with the events fired by Security component.
*
* @package Webiny\Component\Security
*/
class SecurityEvent extends Event
{
// invalid login credentials submitted
const LOGIN_INVALID = 'wf.security.login_invalid';
// valid login credentials submitted
const LOGIN_VALID = 'wf.security.login_valid';
// user is authenticated, but doesn't have the right role to access the current area
const ROLE_INVALID = 'wf.security.role_invalid';
// valid login credentials submitted
const LOGOUT = 'wf.security.logout';
// user not authenticated to access the requested area
const NOT_AUTHENTICATED = 'wf.security.not_authenticated';
// user is authenticated
const AUTHENTICATED = 'wf.security.authenticated';
/**
* @var User\AbstractUser
*/
private $user;
/**
* Base constructor.
*
* @param AbstractUser $user
*/
public function __construct(AbstractUser $user)
{
$this->user = $user;
parent::__construct();
}
/**
* Returns the instance of current user.
*
* @return AbstractUser
*/
public function getUser()
{
return $this->user;
}
}