コード例 #1
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)
コード例 #2
0
ファイル: local_op.py プロジェクト: peppelinux/fedservice
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)
コード例 #3
0
ファイル: server.py プロジェクト: IdentityPython/oidc-op
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
ファイル: server.py プロジェクト: eosc-kc/fedservice
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(config_file):
    logging.basicConfig(level=logging.DEBUG)

    config = Configuration.create_from_config_file(config_file)
    app = application.oidc_provider_init_app(config, 'oidc_op')

    web_conf = config.webserver
    ssl_context = (web_conf['cert'].format(dir_path),
                   web_conf['key'].format(dir_path))

    app.run(host=web_conf['domain'], port=web_conf['port'],
            debug=web_conf['debug'], ssl_context=ssl_context)
コード例 #6
0
except ImportError:
    import application

logger = logging.getLogger("")
LOGFILE_NAME = 'floop.log'
hdlr = logging.FileHandler(LOGFILE_NAME)
base_formatter = logging.Formatter(
    "%(asctime)s %(name)s:%(levelname)s %(message)s")

hdlr.setFormatter(base_formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.DEBUG)

dir_path = os.path.dirname(os.path.realpath(__file__))

template_dir = os.path.join(dir_path, 'templates')

name = 'oidc_op'
app = application.oidc_provider_init_app(name, template_folder=template_dir)
logging.basicConfig(level=logging.DEBUG)

if __name__ == "__main__":
    _conf = app.config.get('CONFIG')
    web_conf = _conf['webserver']
    ssl_context = (web_conf['cert'].format(dir_path),
                   web_conf['key'].format(dir_path))
    app.run(host=app.config.get('DOMAIN'),
            port=app.config.get('PORT'),
            debug=True,
            ssl_context=ssl_context)
コード例 #7
0
from oidcmsg.configure import create_from_config_file

from oidcrp.configure import Configuration
from oidcrp.configure import RPConfiguration
from oidcrp.util import create_context

try:
    from . import application
except ImportError:
    import application

dir_path = os.path.dirname(os.path.realpath(__file__))

if __name__ == "__main__":
    conf = sys.argv[1]
    name = 'oidc_rp'
    template_dir = os.path.join(dir_path, 'templates')

    _config = create_from_config_file(Configuration,
                                      entity_conf=[{"class": RPConfiguration, "attr": "rp"}],
                                      filename=conf)

    app = application.oidc_provider_init_app(_config.rp, name, template_folder=template_dir)
    _web_conf = _config.web_conf
    context = create_context(dir_path, _web_conf)

    debug = _web_conf.get('debug', True)
    app.run(host=_web_conf["domain"], port=_web_conf["port"],
            debug=_web_conf.get("debug", False), ssl_context=context)
コード例 #8
0
        if x509_binary:
            x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_ASN1, x509_binary)
            environ['peercert'] = x509
        else:
            logger.warning('No peer certificate')
            environ['peercert'] = ''
        return environ


logging.basicConfig(level=logging.DEBUG)
config_file = "conf_uwsgi.yaml"
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

# To be able to publish the TLS cert in the entity statement
_cert = os.path.join(dir_path, lower_or_upper(web_conf, "server_cert"))
app.server.endpoint_context.federation_entity.collector.web_cert_path = _cert


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')