Exemplo n.º 1
0
    public function init()
    {
        parent::init();

        $this->add(array(
            'name' => 'oauth2_type',
            'filters' => array(
                array('name' => 'StringToLower'),
            ),
            'validators' => array(
                array(
                    'name' => 'Callback',
                    'options' => array('callback' => function ($value) {
                        return ($value === 'mongo');
                    }),
                ),
            ),
            'error_message' => 'Please provide a valid DSN type adapter (pdo, mongo)',
        ));
        $this->add(array(
            'name' => 'oauth2_dsn',
            'error_message' => 'Please provide a valid DSN for OAuth2 database',
            'required' => false
        ));
        $this->add(array(
            'name' => 'oauth2_database',
            'error_message' => 'Please provide a valid database name for OAuth2 Mongo adapter'
        ));
        $this->add(array(
            'name' => 'oauth2_route',
            'validators' => array(
                array(
                    'name' => 'Uri',
                    'options' => array(
                        'allowRelative' => true
                    ),
                ),
            ),
            'error_message' => 'Please provide a valid URL route for OAuth2 Mongo adapter'
        ));
        $this->add(array(
            'name' => 'oauth2_locator_name',
            'error_message' => 'Please provide a valid locator name for OAuth2 Mongo adapter',
            'required' => false
        ));
        $this->add(array(
            'name' => 'oauth2_options',
            'validators' => array(
                array(
                    'name' => 'Callback',
                    'options' => array('callback' => function ($value) {
                        return is_array($value);
                    }),
                ),
            ),
            'error_message' => 'Please provide a valid options for OAuth2 Mongo adapter',
            'required' => false
        ));
    }
 public function init()
 {
     parent::init();
     $this->add(['name' => 'realm', 'error_message' => 'Please provide a realm for HTTP basic authentication']);
     $this->add(['name' => 'htpasswd', 'validators' => [['name' => 'Callback', 'options' => ['callback' => function ($value) {
         return file_exists($value);
     }]]], 'error_message' => 'Path provided for htpasswd file must exist']);
 }
 public function init()
 {
     parent::init();
     $this->add(['name' => 'realm', 'error_message' => 'Please provide a realm for HTTP digest authentication']);
     $this->add(['name' => 'digest_domains', 'error_message' => 'Please provide a digest domains for HTTP digest authentication']);
     $this->add(['name' => 'nonce_timeout', 'validators' => [['name' => 'Callback', 'options' => ['callback' => function ($value) {
         return is_numeric($value);
     }]]], 'error_message' => 'Please provide a valid nonce timeout for HTTP digest authentication']);
     $this->add(['name' => 'htdigest', 'validators' => [['name' => 'Callback', 'options' => ['callback' => function ($value) {
         return file_exists($value);
     }]]], 'error_message' => 'Path provided for htdigest file must exist']);
 }
 public function init()
 {
     parent::init();
     $this->add(['name' => 'oauth2_type', 'filters' => [['name' => 'StringToLower']], 'validators' => [['name' => 'Callback', 'options' => ['callback' => function ($value) {
         return $value === 'pdo';
     }]]], 'error_message' => 'Please provide a valid DSN type adapter (pdo, mongo)']);
     $this->add(['name' => 'oauth2_dsn', 'error_message' => 'Please provide a valid DSN for OAuth2 PDO adapter']);
     $this->add(['name' => 'oauth2_username', 'error_message' => 'Please provide a username for OAuth2 PDO database', 'required' => false]);
     $this->add(['name' => 'oauth2_password', 'error_message' => 'Please provide a password DSN for OAuth2 PDO database', 'required' => false]);
     $this->add(['name' => 'oauth2_route', 'validators' => [['name' => 'Uri', 'options' => ['allowRelative' => true]]], 'error_message' => 'Please provide a valid URL route for OAuth2 PDO adapter']);
     $this->add(['name' => 'oauth2_options', 'validators' => [['name' => 'Callback', 'options' => ['callback' => function ($value) {
         return is_array($value);
     }]]], 'error_message' => 'Please provide a valid options for OAuth2 PDO adapter', 'required' => false]);
 }