Exemplo n.º 1
0
    def get_profile_info(self, test_id=None):
        try:
            _conv = self.session["conv"]
        except KeyError:
            pass
        else:
            try:
                iss = _conv.entity.provider_info["issuer"]
            except (TypeError, KeyError):
                iss = get_issuer(_conv)

            profile = self.to_profile("dict")

            if test_id is None:
                try:
                    test_id = self.session["testid"]
                except KeyError:
                    return {}

            return {
                "Issuer": iss,
                "Profile": profile,
                "Test ID": test_id,
                "Test description": self.session.test_flows[test_id]['desc'],
                "Timestamp": in_a_while()
            }

        return {}
Exemplo n.º 2
0
    def get_profile_info(self, test_id=None):
        try:
            _conv = self.session["conv"]
        except KeyError:
            pass
        else:
            try:
                iss = _conv.entity.provider_info["issuer"]
            except (TypeError, KeyError):
                iss = get_issuer(_conv)

            profile = self.to_profile("dict")

            if test_id is None:
                try:
                    test_id = self.session["testid"]
                except KeyError:
                    return {}

            return {
                "Issuer": iss,
                "Profile": profile,
                "Test ID": test_id,
                "Test description": self.session["node"].desc,
                "Timestamp": in_a_while(),
            }

        return {}
Exemplo n.º 3
0
def set_webfinger_resource(oper, args):
    """
    Context: WebFinger Query
    Action: Specifies the webfinger resource. If the OP supports
    webfinger queries then the resource is set to the value of 'webfinger_url'
    or 'webfinger_email' from the test instance configuration.

    :param oper: An WebFinger instance
    :param args: None or a dictionary with the key 'pattern'
    """

    try:
        oper.resource = oper.op_args["resource"]
    except KeyError:
        if oper.dynamic:
            if args:
                _p = urlparse(get_issuer(oper.conv))
                oper.op_args["resource"] = args["pattern"].format(
                    test_id=oper.conv.test_id, host=_p.netloc,
                    oper_id=oper.conv.operator_id)
            else:
                _base = oper.sh.tool_conf['issuer']
                if oper.conv.operator_id is None:
                    oper.resource = _base
                else:
                    oper.resource = os.path.join(_base, oper.conv.operator_id,
                                                 oper.conv.test_id)
Exemplo n.º 4
0
def set_discovery_issuer(oper, args):
    """
    Context: AsyncAuthn
    Action: Pick up issuer ID either from static configuration or dynamic
    discovery.

    """
    if oper.dynamic:
        oper.op_args["issuer"] = get_issuer(oper.conv)
Exemplo n.º 5
0
def set_discovery_issuer(oper, args):
    """
    Context: AsyncAuthn
    Action: Pick up issuer ID either from static configuration or dynamic
    discovery.

    """
    if oper.dynamic:
        oper.op_args["issuer"] = get_issuer(oper.conv)
Exemplo n.º 6
0
def set_discovery_issuer(oper, args):
    """
    Context: Authorization Query
    Action: Pick up issuer ID either from static configuration or dynamic
    discovery.

    :param oper: An AsyncAuthn instance
    :param args: None
    """
    if oper.dynamic:
        oper.op_args["issuer"] = get_issuer(oper.conv)
Exemplo n.º 7
0
def resource(oper, args):
    """
    Context:
    Action:
    Example:

    :param oper: 
    :param args: 
    :return: 
    """

    _p = urlparse(get_issuer(oper.conv))
    oper.op_args["resource"] = args["pattern"].format(
        test_id=oper.conv.test_id, host=_p.netloc,
        oper_id=oper.conv.operator_id)
Exemplo n.º 8
0
def set_discovery_issuer(oper, args):
    if oper.dynamic:
        oper.op_args["issuer"] = get_issuer(oper.conv)
Exemplo n.º 9
0
def resource(oper, args):
    _p = urlparse(get_issuer(oper.conv))
    oper.op_args["resource"] = args["pattern"].format(
        test_id=oper.conv.test_id, host=_p.netloc,
        oper_id=oper.conv.operator_id)