def _init_middleware(self): """Initialize WSGI middlewarez.""" 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) acl.setup_policy(self._conf)
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)
def _set_policy(self, json): acl.setup_policy(self.conf) rules = policy.Rules.load_json(json) acl.ENFORCER.set_rules(rules, use_conf=False)