예제 #1
0
def start(config):
    # load the config
    global _config
    _config = config

    global _client
    _client = Client(_config)

    # load the jwk set.
    if 'jwks_uri' in _config:
        global _jwt_validator
        _jwt_validator = JwtValidator(_config)
    else:
        print 'Found no url to JWK set, will not be able to validate JWT signature.'

    # initiate the app
    _app.secret_key = generate_random_string()

    # some default values
    _debug = 'debug' in _config and _config['debug']

    if 'port' in _config:
        port = _config['port']
    else:
        port = 5443

    if _debug:
        print 'Running conf:'
        print_json(_config)

    if 'disable_https' in _config and _config['disable_https']:
        _app.run('0.0.0.0', debug=_debug, port=port)
    else:
        _app.run('0.0.0.0',
                 debug=_debug,
                 port=port,
                 ssl_context=('keys/localhost.pem', 'keys/localhost.pem'))
예제 #2
0
    return config.load_config()


def redirect_with_baseurl(path):
    return redirect(_config['base_url'] + path)


if __name__ == '__main__':
    # load the config
    _config = load_config()

    _client = Client(_config)

    # load the jwk set.
    if 'jwks_uri' in _config:
        _jwt_validator = JwtValidator(_config)
    else:
        print 'Found no url to JWK set, will not be able to validate JWT signature.'
        _jwt_validator = None

    # create a session store
    _session_store = {}

    # initiate the app
    _app.secret_key = generate_random_string()

    # some default values
    if 'port' in _config:
        port = int(_config['port'])
    else:
        port = 5443