Пример #1
0
def main(config_file, args):
    logging.basicConfig(level=logging.DEBUG)
    config = create_from_config_file(Configuration,
                                     entity_conf=[{
                                         "class": FedOpConfiguration,
                                         "attr": "op",
                                         "path": ["op", "server_info"]
                                     }],
                                     filename=config_file)
    app = oidc_provider_init_app(config)

    web_conf = config.webserver

    context = create_context(dir_path, web_conf)

    kwargs = {}

    _srv_context = app.server.server_get("endpoint_context")

    if args.display:
        print(json.dumps(_srv_context.provider_info, indent=4, sort_keys=True))
        exit(0)

    if args.insecure:
        _srv_context.federation_entity.collector.insecure = True

    _cert = os.path.join(dir_path, lower_or_upper(web_conf, "server_cert"))
    _srv_context.federation_entity.collector.web_cert_path = _cert

    app.run(host=web_conf['domain'],
            port=web_conf['port'],
            debug=web_conf['debug'],
            ssl_context=context,
            **kwargs)
Пример #2
0
def main(config_file, args):
    logging.basicConfig(level=logging.DEBUG)
    config = Configuration.create_from_config_file(config_file)
    app = oidc_provider_init_app(config, 'oidc_op')

    web_conf = config.webserver

    context = create_context(dir_path, web_conf)

    if args.display:
        print(
            json.dumps(app.endpoint_context.provider_info,
                       indent=4,
                       sort_keys=True))
        exit(0)

    kwargs = {}
    if context:
        kwargs["ssl_context"] = context
        # kwargs["request_handler"] = PeerCertWSGIRequestHandler

    app.run(host=web_conf['domain'],
            port=web_conf['port'],
            debug=web_conf['debug'],
            **kwargs)
Пример #3
0
def main(config_file, args):
    logging.basicConfig(level=logging.DEBUG)
    config = create_from_config_file(Configuration,
                                     entity_conf=[{
                                         "class": OPConfiguration,
                                         "attr": "op",
                                         "path": ["op", "server_info"]
                                     }],
                                     filename=config_file,
                                     base_path=dir_path)
    app = oidc_provider_init_app(config.op, 'oidc_op')
    app.logger = config.logger

    web_conf = config.webserver

    context = create_context(dir_path, web_conf)

    if args.display:
        print(
            json.dumps(app.endpoint_context.provider_info,
                       indent=4,
                       sort_keys=True))
        exit(0)

    kwargs = {}
    if context:
        kwargs["ssl_context"] = context
        # kwargs["request_handler"] = PeerCertWSGIRequestHandler

    app.run(host=web_conf['domain'],
            port=web_conf['port'],
            debug=web_conf['debug'],
            **kwargs)
Пример #4
0
def main(config_file, args):
    logging.basicConfig(level=logging.DEBUG)
    config = Configuration.create_from_config_file(config_file)
    app = oidc_provider_init_app(config)

    web_conf = config.webserver

    context = create_context(dir_path, web_conf)

    kwargs = {}

    if args.display:
        print(
            json.dumps(app.endpoint_context.provider_info,
                       indent=4,
                       sort_keys=True))
        exit(0)

    if args.insecure:
        app.endpoint_context.federation_entity.collector.insecure = True

    _cert = os.path.join(dir_path, lower_or_upper(web_conf, "server_cert"))
    app.endpoint_context.federation_entity.collector.web_cert_path = _cert

    app.run(host=web_conf['domain'],
            port=web_conf['port'],
            debug=web_conf['debug'],
            ssl_context=context,
            **kwargs)
Пример #5
0
def main():
    global app

    parser = argparse.ArgumentParser()
    parser.add_argument('-d', dest='display', action='store_true')
    # parser.add_argument('-t', dest='tls', action='store_true')
    parser.add_argument('-k', dest='insecure', action='store_true')
    parser.add_argument(dest="config")
    args = parser.parse_args()
    kwargs = {}

    if args.display:
        print(
            json.dumps(app.endpoint_context.provider_info,
                       indent=4,
                       sort_keys=True))
        exit(0)

    if args.insecure:
        app.endpoint_context.federation_entity.collector.insecure = True

    context = create_context(dir_path, web_conf)

    app.run(host=web_conf['domain'],
            port=web_conf['port'],
            debug=web_conf['debug'],
            ssl_context=context,
            **kwargs)
Пример #6
0
key_setup()
logging.basicConfig(level=logging.DEBUG)

app = Flask(__name__, static_url_path='')

app.fss_config = Configuration.create_from_config_file("conf.yaml")

app.register_blueprint(sigserv_views)

# Initialize the oidc_provider after views to be able to set correct urls
_server_info_config = app.fss_config.server_info
app.signing_service = SigningService(_server_info_config, cwd=dir_path)

web_conf = app.fss_config.web_conf

app.signing_service.cwd = dir_path
cert_file = lower_or_upper(web_conf, "server_cert")
if not cert_file.startswith("/"):
    _cert = "{}/{}".format(dir_path, cert_file)

with open(cert_file, 'r') as fp:
    pem = fp.read()
    app.signing_service.x5c = pems_to_x5c([pem])

if __name__ == "__main__":
    web_conf = app.fss_config.web_conf
    ssl_context = create_context(dir_path, web_conf)
    app.run(host=web_conf.get('domain'), port=web_conf.get('port'),
            debug=web_conf.get('domain', True), ssl_context=ssl_context)