File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace Pdsinterop \Solid \Auth \Enum \OAuth2 ;
4+
5+ /**
6+ * Enum class representing valid values for Grant Types
7+ *
8+ * The values are taken ad-verbatim from RFC6749, they are used as identifiers
9+ * by the League OAuth2 Server and Client libraries.
10+ *
11+ * Any advise whether or not to use specific grants is taken directly from the
12+ * OAuth 2.0 Security Best Current Practices:
13+ * https://tools.ietf.org/html/draft-ietf-oauth-security-topics
14+ */
15+ class GrantType
16+ {
17+ /**
18+ * RFC6749 - OAuth2: Authorization Code Grant
19+ * RFC7636 - Proof Key for Code Exchange (PKCE)
20+ *
21+ * It is recommended that all clients use the PKCE extension with this flow
22+ * as well to provide better security.
23+ */
24+ public const AUTH_CODE = 'authorization_code ' ;
25+
26+ // RFC6749 - OAuth2: Client Credentials Grant
27+ public const CLIENT_CREDENTIALS = 'client_credentials ' ;
28+
29+ // RFC8628: OAuth 2.0 Device Authorization Grant
30+ public const DEVICE_CODE = "urn:ietf:params:oauth:grant-type:device_code " ;
31+
32+ /**
33+ * RFC6749 - OAuth2: Implicit Grant
34+ *
35+ * @deprecated Please use Authorization Code flow with PKCE instead!
36+ */
37+ public const IMPLICIT = 'implicit ' ;
38+
39+ /**
40+ * RFC6749 - OAuth2: Resource Owner Password Credentials Grant
41+ *
42+ * @deprecated
43+ */
44+ public const PASSWORD = 'password ' ;
45+
46+ // RFC6749 - OAuth2: Refresh Token Grant
47+ public const REFRESH_TOKEN = 'refresh_token ' ;
48+
49+ }
You can’t perform that action at this time.
0 commit comments