public function behaviors() { $behaviors = parent::behaviors(); $behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application\\json' => Response::FORMAT_JSON]]; $behaviors['authenticator'] = ['class' => QueryParamAuth::className()]; return $behaviors; }
/** * @inheritdoc */ public function behaviors() { $behaviors = parent::behaviors(); $behaviors['authenticator']['authMethods'] = !$this->authMethods ? [] : [QueryParamAuth::className()]; $behaviors['authenticator']['user'] = Yii::createObject(['class' => 'api\\components\\auth\\AuthApi', 'identityClass' => 'api\\components\\auth\\CheckToken']); return $behaviors; }
/** @inheritdoc */ public function behaviors() { $behaviors = parent::behaviors(); $behaviors['authenticator']['authMethods'][] = QueryParamAuth::class; $behaviors['authenticator']['authMethods'][] = HttpBearerAuth::class; return $behaviors; }
public function behaviors() { $behaviors = parent::behaviors(); $behaviors['contentNegotiator']['formats']['text/html'] = \yii\web\Response::FORMAT_JSON; $behaviors['rateLimiter']['user'] = $this->user; return $behaviors; }
public function behaviors() { $behaviors = parent::behaviors(); $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['login' => ['POST', 'OPTIONS']]]; $behaviors['authenticator'] = ['class' => CompositeAuth::className(), 'except' => ['login'], 'authMethods' => [QueryParamAuth::className()]]; return $behaviors; }
/** * @inheritdoc */ public function behaviors() { $behavior = ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => [wanhunet::$app->controller->getRoute()]]], 'denyCallback' => function ($rule, $action) { throw new ForbiddenHttpException(); }]]; return ArrayHelper::merge($behavior, parent::behaviors()); }
/** * Behaviors * @return array */ public function behaviors() { $behaviors = parent::behaviors(); $behaviors['authenticator']['optional'] = $this->unsecuredActions; $behaviors['authenticator']['authMethods'][] = ['class' => QueryParamAuth::className(), 'tokenParam' => 'token']; return $behaviors; }
public function behaviors() { // Options Request Behavior must going at first because swagger makes OPTIONS requests before POST // and this behavior must run early than VerbsFilter $behaviors = ['optionsRequestFilter' => OptionsRequestFilter::className()]; $behaviors = array_merge($behaviors, parent::behaviors(), ['contentNegotiator' => ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]], 'corsFilter' => Cors::className(), 'authenticator' => QueryParamAuthSwagger::className()]); return $behaviors; }
/** * @inheritdoc */ public function behaviors() { $behaviors = parent::behaviors(); $behaviors['authenticator'] = ['class' => HttpBearerAuth::className(), 'only' => ['dashboard']]; $behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]]; $behaviors['access'] = ['class' => AccessControl::className(), 'only' => ['dashboard'], 'rules' => [['actions' => ['dashboard'], 'allow' => true, 'roles' => ['@']]]]; return $behaviors; }
public function behaviors() { $behaviors = parent::behaviors(); $behaviors['authenticator'] = ['class' => QueryParamAuth::className(), 'tokenParam' => 'access_token']; //unset($behaviors['contentNegotiator']['formats']); $behaviors['contentNegotiator']['formats']['application/xml'] = Response::FORMAT_JSON; $behaviors['rateLimiter']['enableRateLimitHeaders'] = false; return $behaviors; }
public function behaviors() { $behaviors = parent::behaviors(); $behaviors['contentNegotiator']['formats'] = ['application/json' => Response::FORMAT_JSON]; $behaviors['access'] = ['class' => 'yii\\filters\\AccessControl', 'rules' => [['allow' => true, 'matchCallback' => function ($rule, $action) { return in_array(Yii::$app->request->hostInfo, Yii::$app->params['acceptableHosts']); }]]]; $behaviors['corsFilter'] = ['class' => 'yii\\filters\\Cors', 'cors' => ['Origin' => Yii::$app->params['acceptableHosts'], 'Access-Control-Request-Method' => ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'], 'Access-Control-Request-Headers' => ['*'], 'Access-Control-Allow-Credentials' => true, 'Access-Control-Max-Age' => 86400, 'Access-Control-Expose-Headers' => []]]; return $behaviors; }
public function behaviors() { $behaviors = parent::behaviors(); $behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_JSON; $behaviors['authenticator'] = ['class' => CompositeAuth::className(), 'authMethods' => [HttpBearerAuth::className()]]; // $behaviors['authenticator']['only'] = ['delete']; $behaviors['access'] = ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'actions' => ['index'], 'matchCallback' => function ($rule, $action) { if (User::findOne(Yii::$app->user->id)) { return User::findOne(Yii::$app->user->id)->username === 'root'; } }], ['allow' => true, 'actions' => ['view'], 'roles' => ['@']]]]; return $behaviors; }
/** * Returns a list of behaviors that this component should behave as. */ public function behaviors() { $behaviors = parent::behaviors(); $behaviors['contentNegotiator'] = ['class' => 'yii\\filters\\ContentNegotiator', 'formats' => ['application/json' => Response::FORMAT_JSON]]; $rulesIps = []; if (false === empty(\Yii::$app->params['secret']['allowIPs'])) { $rulesIps = \Yii::$app->params['secret']['allowIPs']; } $behaviors['AccessControl'] = ['class' => 'yii\\filters\\AccessControl', 'denyCallback' => function ($rule, $action) { throw new ForbiddenHttpException(\Yii::t('yii', 'You are not allowed to perform this action.')); }, 'rules' => [['allow' => true, 'ips' => $rulesIps]]]; return $behaviors; }
public function behaviors() { $behaviors = parent::behaviors(); if ($this->jsonCallback) { $behaviors['contentNegotiator']['formats']['*/*'] = Response::FORMAT_JSONP; $behaviors['contentNegotiator']['formats']['application/xml'] = Response::FORMAT_JSONP; $behaviors['contentNegotiator']['formats']['application/json'] = Response::FORMAT_JSONP; } else { $behaviors['contentNegotiator']['formats']['*/*'] = Response::FORMAT_JSON; $behaviors['contentNegotiator']['formats']['application/xml'] = Response::FORMAT_JSON; $behaviors['contentNegotiator']['formats']['application/json'] = Response::FORMAT_JSON; } $behaviors['corsFilter'] = ['class' => yii\filters\Cors::className(), 'cors' => Yii::$app->params['cors']]; return $behaviors; }
public function behaviors() { $behaviors = parent::behaviors(); //set response header to application/json only $behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]]; $behaviors['ipFilter'] = ['class' => IPFilter::className()]; $behaviors['tokenFilter'] = ['class' => TokenFilter::className()]; $behaviors['openPollFilter'] = ['class' => OpenPollFilter::className()]; // $behaviors['verbs'] = [ // 'class' => VerbFilter::className(), // 'actions' => [ // 'submit' => ['get'], // 'get' => ['get'], // ], // ]; return $behaviors; }
/** * @return array */ public function behaviors() { $behaviors = parent::behaviors(); return $behaviors; }
public function behaviors() { $behaviors = parent::behaviors(); unset($behaviors['contentNegotiator']['formats']['application/xml']); return $behaviors; }
public function behaviors() { return ArrayHelper::merge(parent::behaviors(), ['authenticator' => ['class' => CompositeAuth::className(), 'authMethods' => [HttpBasicAuth::className(), HttpBearerAuth::className(), QueryParamAuth::className()]]]); }
/** * @inheritDoc */ public function behaviors() { return array_merge(parent::behaviors(), ['auth' => ['class' => CompositeAuth::class, 'authMethods' => [HttpBearerAuth::class, QueryParamAuth::class]], 'accessControl' => $this->accessControlBehavior()]); }
public function behaviors() { $behaviors = parent::behaviors(); $behaviors['authenticator'] = ['class' => HttpBearerAuth::className(), 'only' => ['logout', 'test']]; return \yii\helpers\ArrayHelper::merge([['class' => \yii\filters\Cors::className(), 'cors' => ['Origin' => ['*'], 'Access-Control-Allow-Origin' => ['*'], 'Access-Control-Request-Method' => $this->_verbs, 'Access-Control-Request-Headers' => ['*']]]], $behaviors); }
/** * @inheritdoc */ public function behaviors() { $behaviors = parent::behaviors(); $behaviors['authenticator'] = ['class' => QueryParamAuth::className()]; return $behaviors; }
/** * @inheritdoc */ public function behaviors() { $behaviors = parent::behaviors(); $behaviors['authenticator'] = ['class' => CompositeAuth::className(), 'authMethods' => [['class' => HttpBearerAuth::className(), 'only' => $this->authOnly(), 'except' => $this->authExcept()], ['class' => QueryParamAuth::className(), 'only' => $this->authOnly(), 'except' => $this->authExcept()]]]; return $behaviors; }
public function behaviors() { $behaviors = parent::behaviors(); $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['index' => ['get']]]; return $behaviors; }
/** * @inheritdoc */ public function behaviors() { return ArrayHelper::merge(parent::behaviors(), ['exceptionFilter' => ['class' => ErrorToExceptionFilter::className()]]); }
public function behaviors() { $behaviors = parent::behaviors(); //$behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_JSON; return $behaviors; }
public function behaviors() { return parent::behaviors(); }
public function behaviors() { return ArrayHelper::merge(parent::behaviors(), ['authenticator' => ['class' => CompositeAuth::className(), 'authMethods' => [['class' => QueryParamAuth::className(), 'tokenParam' => 'access_token']]]]); }
/** * @return array */ public function behaviors() { $filters = ['apiChecker' => ['class' => ApiCheckerFilter::className()], 'authenticator' => ['class' => TokenAuth::className(), 'except' => $this->authExcept, 'only' => $this->authOnly], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['*' => ['post']]]]; return array_merge(parent::behaviors(), $filters); }
/** * @return array */ public function behaviors() { $behaviors = parent::behaviors(); $behaviors['contentNegotiator']['formats'] = ['application/json' => Response::FORMAT_JSON]; return $behaviors; }
/** * @inheritdoc */ public function behaviors() { return ArrayHelper::merge(parent::behaviors(), ['exceptionFilter' => ['class' => ErrorToExceptionFilter::className()], 'corsFilter' => ['class' => \backend\rest\filters\Cors::className(), 'cors' => ['Origin' => ['*'], 'Access-Control-Request-Method' => ['POST', 'PUT', 'OPTIONS', 'PATCH', 'DELETE'], 'Access-Control-Request-Headers' => ['X-Pagination-Total-Count', 'X-Pagination-Page-Count', 'X-Pagination-Current-Page', 'X-Pagination-Per-Page', 'Content-Length', 'Content-type', 'Link'], 'Access-Control-Allow-Credentials' => true, 'Access-Control-Max-Age' => 3600, 'Access-Control-Expose-Headers' => ['X-Pagination-Total-Count', 'X-Pagination-Page-Count', 'X-Pagination-Current-Page', 'X-Pagination-Per-Page', 'Content-Length', 'Content-type', 'Link'], 'Access-Control-Allow-Headers' => ['X-Pagination-Total-Count', 'X-Pagination-Page-Count', 'X-Pagination-Current-Page', 'X-Pagination-Per-Page', 'Content-Length', 'Content-type', 'Link']]]]); }