| @@ 60-81 (lines=22) @@ | ||
| 57 | return $generatedToken; |
|
| 58 | } |
|
| 59 | ||
| 60 | public function retrieveAccessToken($accessToken) |
|
| 61 | { |
|
| 62 | $stmt = $this->db->prepare( |
|
| 63 | sprintf( |
|
| 64 | 'SELECT client_id, user_id, issued_at, scope FROM %s WHERE token = :token', |
|
| 65 | $this->dbPrefix.'access_token' |
|
| 66 | ) |
|
| 67 | ); |
|
| 68 | $stmt->bindValue(':token', $accessToken, PDO::PARAM_STR); |
|
| 69 | $stmt->execute(); |
|
| 70 | $result = $stmt->fetch(PDO::FETCH_ASSOC); |
|
| 71 | if (false === $result) { |
|
| 72 | return false; |
|
| 73 | } |
|
| 74 | ||
| 75 | return new AccessToken( |
|
| 76 | $result['client_id'], |
|
| 77 | $result['user_id'], |
|
| 78 | $result['issued_at'], |
|
| 79 | $result['scope'] |
|
| 80 | ); |
|
| 81 | } |
|
| 82 | ||
| 83 | public function createTableQueries($dbPrefix) |
|
| 84 | { |
|
| @@ 61-83 (lines=23) @@ | ||
| 58 | return $generatedCode; |
|
| 59 | } |
|
| 60 | ||
| 61 | public function retrieveAuthorizationCode($authorizationCode) |
|
| 62 | { |
|
| 63 | $stmt = $this->db->prepare( |
|
| 64 | sprintf( |
|
| 65 | 'SELECT client_id, user_id, issued_at, redirect_uri, scope FROM %s WHERE code = :code', |
|
| 66 | $this->dbPrefix.'authorization_code' |
|
| 67 | ) |
|
| 68 | ); |
|
| 69 | $stmt->bindValue(':code', $authorizationCode, PDO::PARAM_STR); |
|
| 70 | $stmt->execute(); |
|
| 71 | $result = $stmt->fetch(PDO::FETCH_ASSOC); |
|
| 72 | if (false === $result) { |
|
| 73 | return false; |
|
| 74 | } |
|
| 75 | ||
| 76 | return new AuthorizationCode( |
|
| 77 | $result['client_id'], |
|
| 78 | $result['user_id'], |
|
| 79 | $result['issued_at'], |
|
| 80 | $result['redirect_uri'], |
|
| 81 | $result['scope'] |
|
| 82 | ); |
|
| 83 | } |
|
| 84 | ||
| 85 | public function isFreshAuthorizationCode($authorizationCode) |
|
| 86 | { |
|
| @@ 32-53 (lines=22) @@ | ||
| 29 | parent::__construct($db, $dbPrefix); |
|
| 30 | } |
|
| 31 | ||
| 32 | public function getResourceServer($resourceServerId) |
|
| 33 | { |
|
| 34 | $stmt = $this->db->prepare( |
|
| 35 | sprintf( |
|
| 36 | 'SELECT id, scope, secret FROM %s WHERE id = :id', |
|
| 37 | $this->dbPrefix.'resource_server' |
|
| 38 | ) |
|
| 39 | ); |
|
| 40 | ||
| 41 | $stmt->bindValue(':id', $resourceServerId, PDO::PARAM_STR); |
|
| 42 | $stmt->execute(); |
|
| 43 | $result = $stmt->fetch(PDO::FETCH_ASSOC); |
|
| 44 | if (false === $result) { |
|
| 45 | return false; |
|
| 46 | } |
|
| 47 | ||
| 48 | return new ResourceServer( |
|
| 49 | $result['id'], |
|
| 50 | $result['scope'], |
|
| 51 | $result['secret'] |
|
| 52 | ); |
|
| 53 | } |
|
| 54 | ||
| 55 | public function createTableQueries($dbPrefix) |
|
| 56 | { |
|