forked from elchris/oauth2-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OAuth2Grants.php
54 lines (46 loc) · 1.12 KB
/
OAuth2Grants.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
<?php
declare(strict_types=1);
namespace Trikoder\Bundle\OAuth2Bundle;
final class OAuth2Grants
{
/**
* @see https://tools.ietf.org/html/rfc6749#section-1.3.1
*
* @var string
*/
public const AUTHORIZATION_CODE = 'authorization_code';
/**
* @see https://tools.ietf.org/html/rfc6749#section-1.3.4
*
* @var string
*/
public const CLIENT_CREDENTIALS = 'client_credentials';
/**
* @see https://tools.ietf.org/html/rfc6749#section-1.3.2
*
* @var string
*/
public const IMPLICIT = 'implicit';
/**
* @see https://tools.ietf.org/html/rfc6749#section-1.3.3
*
* @var string
*/
public const PASSWORD = 'password';
/**
* @see https://tools.ietf.org/html/rfc6749#section-6
*
* @var string
*/
public const REFRESH_TOKEN = 'refresh_token';
public static function has(string $grant): bool
{
return \in_array($grant, [
self::CLIENT_CREDENTIALS,
self::PASSWORD,
self::REFRESH_TOKEN,
self::AUTHORIZATION_CODE,
self::IMPLICIT,
]);
}
}