| Line | Code |
| 1 | <?php
|
| 2 |
|
| 3 | /**
|
| 4 | The resource owner password credentials (i.e., username and password)
|
| 5 | can be used directly as an authorization grant to obtain an access
|
| 6 | token. The credentials should only be used when there is a high
|
| 7 | degree of trust between the resource owner and the client (e.g., the
|
| 8 | client is part of the device operating system or a highly privileged
|
| 9 | application), and when other authorization grant types are not
|
| 10 | available (such as an authorization code).
|
| 11 |
|
| 12 | Even though this grant type requires direct client access to the
|
| 13 | resource owner credentials, the resource owner credentials are used
|
| 14 | for a single request and are exchanged for an access token. This
|
| 15 | grant type can eliminate the need for the client to store the
|
| 16 | resource owner credentials for future use, by exchanging the
|
| 17 | credentials with a long-lived access token or refresh token.
|
| 18 | */
|
| 19 |
|
| 20 | namespace AuthStack\OAuth2\Model\Protocol\Grant;
|
| 21 |
|
| 22 | use AuthStack\OAuth2\Model\Protocol\Request\PasswordCredentials\GrantRequest;
|
| 23 | use AuthStack\OAuth2\Model\Protocol\Response\PasswordCredentials\GrantResponse;
|
| 24 |
|
| 25 | class PasswordCredentials implements GrantInterface
|
| 26 | {
|
| 27 | public function grantRequest(): GrantRequest
|
| 28 | {
|
| 29 | return new GrantRequest();
|
| 30 | }
|
| 31 |
|
| 32 | public function grantResponse(): GrantResponse
|
| 33 | {
|
| 34 | return new GrantResponse();
|
| 35 | }
|
| 36 | } |