def __init__(self, conf, api, cache): super(Driver, self).__init__(conf, None, None, None) self._api = api self._cache = cache self._conf.register_opts(_WS_OPTIONS, group=_WS_GROUP) self._ws_conf = self._conf[_WS_GROUP] if self._conf.auth_strategy: auth_strategy = auth.strategy(self._conf.auth_strategy) self._auth_strategy = lambda app: auth_strategy.install( app, self._conf) else: self._auth_strategy = None
def __init__(self, conf, api, cache): super(Driver, self).__init__(conf, None, None, None) self._api = api self._cache = cache self._conf.register_opts(drivers_transport_websocket.ALL_OPTS, group=drivers_transport_websocket.GROUP_NAME) self._ws_conf = self._conf[drivers_transport_websocket.GROUP_NAME] if self._conf.auth_strategy: auth_strategy = auth.strategy(self._conf.auth_strategy) self._auth_strategy = lambda app: auth_strategy.install( app, self._conf) else: self._auth_strategy = None
def _init_middleware(self): """Initialize WSGI middlewarez.""" # NOTE(zhiyan): Install Profiler if (self._conf.profiler.enabled and self._conf.profiler.trace_wsgi_transport): self.app = profile.install_wsgi_tracer(self.app, self._conf) auth_app = self.app # NOTE(flaper87): Install Auth if self._conf.auth_strategy: strategy = auth.strategy(self._conf.auth_strategy) auth_app = strategy.install(self.app, self._conf) self.app = auth.SignedHeadersAuth(self.app, auth_app) # NOTE(wangxiyuan): Install CORS, this middleware should be called # before Keystone auth. self.app = cors.install_cors(self.app, auth_app, self._conf) acl.setup_policy(self._conf)