Пример #1
0
 public function getClient()
 {
     // Load on client by id on first call.
     if ($this->_client === false) {
         $this->_client = Oauth2Client::findOne($this->client_id);
     }
     return $this->_client;
 }
Пример #2
0
 /**
  * Finds the Oauth2Client model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Oauth2Client the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Oauth2Client::findOne($id)) !== null) {
         return $model;
     }
     throw new NotFoundHttpException('The requested page does not exist.');
 }
Пример #3
0
 public static function getSessionLogoutRedirectLocation()
 {
     $data = static::getSessionLogoutRedirect();
     if (!isset($data['client_id'], $data['redirect_uri'])) {
         return null;
     }
     $client = Oauth2Client::findOne($data['client_id']);
     if (!$client) {
         return null;
     }
     $r = $client->validateRedirectURI($data['redirect_uri']);
     if (!$r) {
         return null;
     }
     if (isset($data['state'])) {
         $r .= (parse_url($r, PHP_URL_QUERY) ? '&' : '?') . http_build_query(['state' => $data['state']]);
     }
     return $r;
 }