Beispiel #1
0
        try:
            json_args = json.loads(cfg_central.get("auth", "auth_args"))
            auth_args = {}
            for arg in json_args.keys():
                auth_args[str(arg)] = json_args[arg]
        except NoOptionError:
            print "'auth_args' option is required when authentication is enabled."
            sys.exit(-1)
        except ValueError:
            print "'auth_args' contents is not valid JSON."
            sys.exit(-1)

        auth_module = __import__(auth_mod_name, globals(), locals(), [], -1)
        auth_class = getattr(auth_module, auth_class_name)
        auth.install_auth(auth_class(**auth_args))

    try:
        secure_cookies_secrets = json.loads(cfg_central.get(
            "auth", "secure_cookies_secrets"),
                                            encoding='ascii')
        secure_cookies_secrets = [
            x.encode("ascii") for x in secure_cookies_secrets
        ]
    except NoOptionError:
        print "Required option 'secure_cookies_secrets' is missing from 'auth' section."
        sys.exit(-1)

    auth.install_secure_cookies(secure_cookies_secrets)

    # Start up statsd connection if configured
Beispiel #2
0
 def test_backend_installed(self):
     "Validate backend installation fails if not object."
     backend = DummyBackend()
     auth.install_auth(backend)
     self.assertEqual(auth.auth_backend, backend)
Beispiel #3
0
 def test_backend_installed(self):
     "Validate backend installation fails if not object."
     backend = DummyBackend()
     auth.install_auth(backend)
     self.assertEqual(auth.auth_backend, backend)
Beispiel #4
0
     
     try:
         json_args = json.loads(cfg_central.get("auth", "auth_args"))
         auth_args = {}
         for arg in json_args.keys():
             auth_args[str(arg)] = json_args[arg]
     except NoOptionError:
         print "'auth_args' option is required when authentication is enabled."
         sys.exit(-1)
     except ValueError:
         print "'auth_args' contents is not valid JSON."
         sys.exit(-1)
     
     auth_module = __import__(auth_mod_name, globals(), locals(), [], -1)
     auth_class = getattr(auth_module, auth_class_name)
     auth.install_auth(auth_class(**auth_args))
 
 try:
     secure_cookies_secrets = json.loads(cfg_central.get("auth", "secure_cookies_secrets"),
                                         encoding='ascii')
     secure_cookies_secrets = [x.encode("ascii") for x in secure_cookies_secrets]
 except NoOptionError:
     print "Required option 'secure_cookies_secrets' is missing from 'auth' section."
     sys.exit(-1)
 
 auth.install_secure_cookies(secure_cookies_secrets)
 
 # Start up statsd connection if configured
 if statsd_host:
     print "API Stats Enabled. (statsd Server:%s:%d  Prefix:%s)" % (statsd_host, statsd_port, statsd_scheme)
     reactor.listenUDP(0, stats.install_stats(statsd_host,