-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGuardInterface.php
51 lines (43 loc) · 1.05 KB
/
GuardInterface.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
<?php
namespace WebmanTech\Auth\Interfaces;
/**
* Guard 接口
*/
interface GuardInterface
{
/**
* 获取授权方法
* @return AuthenticationMethodInterface
*/
public function getAuthenticationMethod(): AuthenticationMethodInterface;
/**
* 获取认证失败处理器
* @return AuthenticationFailureHandlerInterface
*/
public function getAuthenticationFailedHandler(): AuthenticationFailureHandlerInterface;
/**
* 登录
* @param IdentityInterface $identity
*/
public function login(IdentityInterface $identity): void;
/**
* 退出登录
*/
public function logout(): void;
/**
* 是否未登录
* @return bool
*/
public function isGuest(): bool;
/**
* 获取当前登录用户
* @param bool $refresh
* @return IdentityInterface|null
*/
public function getUser(bool $refresh = false): ?IdentityInterface;
/**
* 获取当前登录用户 ID
* @return string|null
*/
public function getId(): ?string;
}