Ejemplo n.º 1
0
 public function getLogouts()
 {
     if (!is_array($this->logouts)) {
         $this->logouts = Oauth2Client::getAllLogoutGroupedValid();
     }
     return $this->logouts;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Oauth2Client::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'client', $this->client])->andFilterWhere(['like', 'client_secret', $this->client_secret])->andFilterWhere(['like', 'scopes', $this->scopes])->andFilterWhere(['like', 'redirect_uris', $this->redirect_uris])->andFilterWhere(['like', 'logout_uri', $this->logout_uri]);
     return $dataProvider;
 }
Ejemplo n.º 4
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.');
 }
Ejemplo n.º 5
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;
 }