index : flyspray | |
Archlinux32 customized Flyspray installation | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | vendor/league/oauth2-client/src/Grant/Password.php | 33 |
diff --git a/vendor/league/oauth2-client/src/Grant/Password.php b/vendor/league/oauth2-client/src/Grant/Password.php new file mode 100644 index 0000000..b124b34 --- /dev/null +++ b/vendor/league/oauth2-client/src/Grant/Password.php @@ -0,0 +1,33 @@ +<?php + +namespace League\OAuth2\Client\Grant; + +use League\OAuth2\Client\Token\AccessToken; + +class Password implements GrantInterface +{ + public function __toString() + { + return 'password'; + } + + public function prepRequestParams($defaultParams, $params) + { + if (! isset($params['username']) || empty($params['username'])) { + throw new \BadMethodCallException('Missing username'); + } + + if (! isset($params['password']) || empty($params['password'])) { + throw new \BadMethodCallException('Missing password'); + } + + $params['grant_type'] = 'password'; + + return array_merge($defaultParams, $params); + } + + public function handleResponse($response = array()) + { + return new AccessToken($response); + } +} |