Exemple #1
0
def _wrap_app(app):
    app = request_id.RequestId(app)
    if cfg.CONF.auth_strategy == 'noauth':
        pass
    elif cfg.CONF.auth_strategy == 'keystone':
        app = auth_token.AuthProtocol(app, {})
    else:
        raise n_exc.InvalidConfigurationOption(
            opt_name='auth_strategy', opt_value=cfg.CONF.auth_strategy)

    # version can be unauthenticated so it goes outside of auth
    app = versions.Versions(app)

    # This should be the last middleware in the list (which results in
    # it being the first in the middleware chain). This is to ensure
    # that any errors thrown by other middleware, such as an auth
    # middleware - are annotated with CORS headers, and thus accessible
    # by the browser.
    app = cors.CORS(app, cfg.CONF)
    app.set_latent(allow_headers=[
        'X-Auth-Token', 'X-Identity-Status', 'X-Roles', 'X-Service-Catalog',
        'X-User-Id', 'X-Tenant-Id', 'X-OpenStack-Request-ID'
    ],
                   allow_methods=['GET', 'PUT', 'POST', 'DELETE', 'PATCH'],
                   expose_headers=[
                       'X-Auth-Token', 'X-Subject-Token', 'X-Service-Token',
                       'X-OpenStack-Request-ID'
                   ])

    return app
Exemple #2
0
    def __init__(self, conf):
        super(RoutedInterfaceDriver, self).__init__(conf)

        # Require use_namespaces to be False.  Routed networking does
        # not use namespaces.
        if self.conf.use_namespaces:
            raise exceptions.InvalidConfigurationOption(
                opt_name='use_namespaces', opt_value='True')
Exemple #3
0
def _wrap_app(app):
    app = request_id.RequestId(app)
    if cfg.CONF.auth_strategy == 'noauth':
        pass
    elif cfg.CONF.auth_strategy == 'keystone':
        app = auth_token.AuthProtocol(app, {})
    else:
        raise n_exc.InvalidConfigurationOption(
            opt_name='auth_strategy', opt_value=cfg.CONF.auth_strategy)
    return app
Exemple #4
0
    def __init__(self):
        opts = ['pan_host']
        if cfg.CONF.pan_api_key:
            opts.append('pan_api_key')
        else:
            opts += ['pan_username', 'pan_password']

        for opt_name in opts:
            opt_value = getattr(cfg.CONF, opt_name, None)
            if not opt_value:
                raise neutron_exc.InvalidConfigurationOption(
                    opt_name=opt_name, opt_value=opt_value)

        self._params = {'hostname': cfg.CONF.pan_host}

        if 'pan_api_key' in opts:
            self._params['api_key'] = cfg.CONF.pan_api_key
        else:
            self._params['api_username'] = cfg.CONF.pan_username
            self._params['api_password'] = cfg.CONF.pan_password

        if cfg.CONF.pan_port:
            self._params['port'] = cfg.CONF.pan_port