Ejemplo n.º 1
0
    def get(self, oper_id, test_id, events, endpoint):
        # addr = get_client_address(environ)
        key = path = '{}/{}'.format(oper_id, test_id)

        try:
            _op = self.op[key]
            _op.events = events
            if endpoint == '.well-known/openid-configuration':
                init_keyjar(_op, self.op_args['keyjar'], self.com_args)
                write_jwks_uri(_op, self.op_args, self.folder)
        except KeyError:
            _op = self.setup_op(oper_id, test_id, self.com_args, self.op_args,
                                self.test_conf, events)
            _op.conv = Conversation(test_id, _op, None)
            _op.orig_keys = key_summary(_op.keyjar, '').split(', ')
            self.op[key] = _op

        return _op, path, key
Ejemplo n.º 2
0
 def index(self, op):
     init_keyjar(op, self.op_args['keyjar'], self.com_args)
     write_jwks_uri(op, self.op_args)
     return b'OK'
Ejemplo n.º 3
0
    def setup_op(self, oper_id, test_id, com_args, op_arg, test_conf, events):
        _tc = test_conf[test_id]
        if not _tc:
            raise UnknownTestID(test_id)

        op = self.provider_cls(sdb=SessionDB(com_args["baseurl"]), **com_args)
        op.events = events
        op.oper_id = oper_id
        op.test_id = test_id
        try:
            op.ms_conf = _tc['metadata_statements']
        except KeyError:
            op.msu_conf = _tc['metadata_statement_uris']

        for _authn in com_args["authn_broker"]:
            _authn.srv = op

        for key, val in list(op_arg.items()):
            if key == 'keyjar':
                init_keyjar(op, val, com_args)
            else:
                setattr(op, key, val)

        write_jwks_uri(op, op_arg, self.folder)

        if op.baseurl.endswith("/"):
            div = ""
        else:
            div = "/"

        op.name = op.baseurl = "{}{}{}/{}".format(op.baseurl, div, oper_id,
                                                  test_id)
        op.signers = self.signers
        _kj = build_keyjar(self.key_defs)[1]

        op.federation_entity = FederationEntity(None,
                                                keyjar=_kj,
                                                iss=op.name,
                                                signer=None)
        op.federation_entity.httpcli = op

        try:
            _capa = _tc['capabilities']
        except KeyError:
            pass
        else:
            op.capabilities.update(_capa)
            # update jwx
            for _typ in ["signing_alg", "encryption_alg", "encryption_enc"]:
                for item in ["id_token", "userinfo"]:
                    cap_param = '{}_{}_values_supported'.format(item, _typ)
                    try:
                        op.jwx_def[_typ][item] = _capa[cap_param][0]
                    except KeyError:
                        pass

        try:
            op.claims_type = _tc["claims"]
        except KeyError:
            pass

        try:
            op.behavior_type = _tc["behavior"]
            op.server.behavior_type = _tc["behavior"]
        except KeyError:
            pass

        return op
Ejemplo n.º 4
0
Archivo: op.py Proyecto: rohe/oidctest
 def index(self, op):
     init_keyjar(op, self.op_args['keyjar'], self.com_args)
     write_jwks_uri(op, self.op_args, {})
     return b'OK'