def make_federation_entity(config, eid='', httpcli=None, verify_ssl=True):
    """
    Construct a :py:class:`fedoidcmsg.entity.FederationEntity` instance based
    on given configuration.

    :param config: Federation entity configuration
    :param eid: Entity ID
    :param httpcli: A http client instance to use when sending HTTP requests
    :param verify_ssl: Whether TLS/SSL certificates should be verified
    :return: A :py:class:`fedoidcmsg.entity.FederationEntity` instance
    """
    args = {}

    if not eid:
        try:
            eid = config['entity_id']
        except KeyError:
            pass

    if 'self_signer' in config:
        self_signer = make_internal_signing_service(config['self_signer'],
                                                    eid)
        args['self_signer'] = self_signer

    try:
        bundle_cnf = config['fo_bundle']
    except KeyError:
        pass
    else:
        _args = dict([(k, v) for k, v in bundle_cnf.items() if k in KJ_SPECS])
        if _args:
            _kj = init_key_jar(**_args)
        else:
            _kj = None

        if 'dir' in bundle_cnf:
            jb = FSJWKSBundle(eid, _kj, bundle_cnf['dir'],
                              key_conv={'to': quote_plus, 'from': unquote_plus})
        else:
            jb = JWKSBundle(eid, _kj)
        args['fo_bundle'] = jb

    for item in ['context', 'entity_id', 'fo_priority', 'mds_owner']:
        try:
            args[item] = config[item]
        except KeyError:
            pass

    if 'entity_id' not in args:
        args['entity_id'] = eid

    # These are mutually exclusive
    if 'sms_dir' in config:
        args['sms_dir'] = config['sms_dir']
        return FederationEntityOOB(httpcli, iss=eid, **args)
    elif 'mds_service' in config:
        args['verify_ssl'] = verify_ssl
        args['mds_service'] = config['mds_service']
        return FederationEntityAMS(httpcli, iss=eid, **args)
    elif 'mdss_endpoint' in config:
        args['verify_ssl'] = verify_ssl
        # These are mandatory for this type of entity
        for key in ['mdss_endpoint', 'mdss_owner', 'mdss_keys']:
            args[key] = config[key]
        return FederationEntitySwamid(httpcli, iss=eid, **args)
def make_federation_entity(config, eid='', httpcli=None, verify_ssl=True):
    """
    Construct a :py:class:`fedoidcmsg.entity.FederationEntity` instance based
    on given configuration.

    :param config: Federation entity configuration
    :param eid: Entity ID
    :param httpcli: A http client instance to use when sending HTTP requests
    :param verify_ssl: Whether TLS/SSL certificates should be verified
    :return: A :py:class:`fedoidcmsg.entity.FederationEntity` instance
    """
    args = {}

    if not eid:
        try:
            eid = config['entity_id']
        except KeyError:
            pass

    if 'self_signer' in config:
        self_signer = make_internal_signing_service(config['self_signer'],
                                                    eid)
        args['self_signer'] = self_signer

    try:
        bundle_cnf = config['fo_bundle']
    except KeyError:
        pass
    else:
        _args = dict([(k, v) for k, v in bundle_cnf.items() if k in KJ_SPECS])
        if _args:
            _kj = init_key_jar(**_args)
        else:
            _kj = None

        if 'dir' in bundle_cnf:
            jb = FSJWKSBundle(eid, _kj, bundle_cnf['dir'],
                              key_conv={'to': quote_plus, 'from': unquote_plus})
        else:
            jb = JWKSBundle(eid, _kj)
        args['fo_bundle'] = jb

    for item in ['context', 'entity_id', 'fo_priority', 'mds_owner']:
        try:
            args[item] = config[item]
        except KeyError:
            pass

    if 'entity_id' not in args:
        args['entity_id'] = eid

    # These are mutually exclusive
    if 'sms_dir' in config:
        args['sms_dir'] = config['sms_dir']
        return FederationEntityOOB(httpcli, iss=eid, **args)
    elif 'mds_service' in config:
        args['verify_ssl'] = verify_ssl
        args['mds_service'] = config['mds_service']
        return FederationEntityAMS(httpcli, iss=eid, **args)
    elif 'mdss_endpoint' in config:
        args['verify_ssl'] = verify_ssl
        # These are mandatory for this type of entity
        for key in ['mdss_endpoint', 'mdss_owner', 'mdss_keys']:
            args[key] = config[key]
        return FederationEntitySwamid(httpcli, iss=eid, **args)
def make_federation_entity ( config , eid = '' , httpcli = None , verify_ssl = True ) : args = { } if not eid : try : eid = config [ 'entity_id' ] except KeyError : pass if 'self_signer' in config : self_signer = make_internal_signing_service ( config [ 'self_signer' ] , eid ) args [ 'self_signer' ] = self_signer try : bundle_cnf = config [ 'fo_bundle' ] except KeyError : pass else : _args = dict ( [ ( k , v ) for k , v in bundle_cnf . items ( ) if k in KJ_SPECS ] ) if _args : _kj = init_key_jar ( * * _args ) else : _kj = None if 'dir' in bundle_cnf : jb = FSJWKSBundle ( eid , _kj , bundle_cnf [ 'dir' ] , key_conv = { 'to' : quote_plus , 'from' : unquote_plus } ) else : jb = JWKSBundle ( eid , _kj ) args [ 'fo_bundle' ] = jb for item in [ 'context' , 'entity_id' , 'fo_priority' , 'mds_owner' ] : try : args [ item ] = config [ item ] except KeyError : pass if 'entity_id' not in args : args [ 'entity_id' ] = eid # These are mutually exclusive if 'sms_dir' in config : args [ 'sms_dir' ] = config [ 'sms_dir' ] return FederationEntityOOB ( httpcli , iss = eid , * * args ) elif 'mds_service' in config : args [ 'verify_ssl' ] = verify_ssl args [ 'mds_service' ] = config [ 'mds_service' ] return FederationEntityAMS ( httpcli , iss = eid , * * args ) elif 'mdss_endpoint' in config : args [ 'verify_ssl' ] = verify_ssl # These are mandatory for this type of entity for key in [ 'mdss_endpoint' , 'mdss_owner' , 'mdss_keys' ] : args [ key ] = config [ key ] return FederationEntitySwamid ( httpcli , iss = eid , * * args )
Construct a :py:class:`fedoidcmsg.entity.FederationEntity` instance based
    on given configuration.

    :param config: Federation entity configuration
    :param eid: Entity ID
    :param httpcli: A http client instance to use when sending HTTP requests
    :param verify_ssl: Whether TLS/SSL certificates should be verified
    :return: A :py:class:`fedoidcmsg.entity.FederationEntity` instance
Construct a : py : class : fedoidcmsg . entity . FederationEntity instance based on given configuration .