public function behaviors()
{
// get the parent behaviors to overwrite
$behaviors = parent::behaviors();
if (!$this->getUserAuthClass()) {
unset($behaviors['authenticator']);
} else {
// change to admin user auth class
$behaviors['authenticator'] = ['class' => CompositeAuth::className(), 'user' => $this->getUserAuthClass(), 'authMethods' => [QueryParamAuth::className(), HttpBearerAuth::className()]];
}
$behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON, 'application/xml' => Response::FORMAT_XML]];
// by default rate limiter behavior is removed as its not implememented.
if (isset($behaviors['rateLimiter'])) {
unset($behaviors['rateLimiter']);
}
return $behaviors;
}