Did I find the right examples for you? yes no

All Samples(62)  |  Call(56)  |  Derive(0)  |  Import(6)
Convert a pysaml2 SAML2 message class instance into a basic dictionary
format.
The export interface.

:param _dict: The pysaml2 metadata instance
:param onts: List of schemas to use for the conversion
:return: The converted information

        def to_dict(_dict, onts, mdb_safe=False):
    """
    Convert a pysaml2 SAML2 message class instance into a basic dictionary
    format.
    The export interface.

    :param _dict: The pysaml2 metadata instance
    :param onts: List of schemas to use for the conversion
    :return: The converted information
    """
    res = {}
    if isinstance(_dict, SamlBase):
        res["__class__"] = "%s&%s" % (_dict.c_namespace, _dict.c_tag)
        for key in _dict.keyswv():
            if key in IMP_SKIP:
                continue
            val = getattr(_dict, key)
            if key == "extension_elements":
                _eel = extension_elements_to_elements(val, onts)
                _val = [_eval(_v, onts, mdb_safe) for _v in _eel]
            elif key == "extension_attributes":
                if mdb_safe:
                    _val = dict([(k.replace(".", "__"), v) for k, v in
                                 val.items()])
                    #_val = {k.replace(".", "__"): v for k, v in val.items()}
                else:
                    _val = val
            else:
                _val = _eval(val, onts, mdb_safe)

            if _val:
                if mdb_safe:
                    key = key.replace(".", "__")
                res[key] = _val
    else:
        for key, val in _dict.items():
            _val = _eval(val, onts, mdb_safe)
            if _val:
                if mdb_safe and "." in key:
                    key = key.replace(".", "__")
                res[key] = _val
    return res
        


src/p/y/pysaml2-2.0.0/src/saml2/mongo_store.py   pysaml2(Download)
 
from saml2.ident import code, IdentDB, Unknown
from saml2.mdie import to_dict, from_dict
 
from saml2 import md
            "name_id_key": nkey,
            "assertion_id": assertion.id,
            "assertion": to_dict(assertion, ONTS.values(), True),
            "to_sign": to_sign
        }
    def store(self, ident, name_id):
        self.mdb.store(ident, name_id=to_dict(name_id, ONTS.values(), True))
 
    def find_nameid(self, userid, nformat=None, sp_name_qualifier=None,
                    name_qualifier=None, sp_provided_id=None, **kwargs):
    def find_local_id(self, name_id):
        cnid = to_dict(name_id, ONTS.values(), True)
        for item in self.mdb.get(name_id=cnid):
            return item[self.mdb.primary_key]
        return None
 
    def remove_remote(self, name_id):
        cnid = to_dict(name_id, ONTS.values(), True)

src/p/y/pysaml2-HEAD/src/saml2/mongo_store.py   pysaml2(Download)
 
from saml2.ident import code, IdentDB, Unknown
from saml2.mdie import to_dict, from_dict
 
from saml2 import md
            "name_id_key": nkey,
            "assertion_id": assertion.id,
            "assertion": to_dict(assertion, ONTS.values(), True),
            "to_sign": to_sign
        }
    def store(self, ident, name_id):
        self.mdb.store(ident, name_id=to_dict(name_id, ONTS.values(), True))
 
    def find_nameid(self, userid, nformat=None, sp_name_qualifier=None,
                    name_qualifier=None, sp_provided_id=None, **kwargs):
    def find_local_id(self, name_id):
        cnid = to_dict(name_id, ONTS.values(), True)
        for item in self.mdb.get(name_id=cnid):
            return item[self.mdb.primary_key]
        return None
 
    def remove_remote(self, name_id):
        cnid = to_dict(name_id, ONTS.values(), True)

src/p/y/pysaml2-2.0.0/src/saml2/mdstore.py   pysaml2(Download)
from saml2.extension.idpdisc import DiscoveryResponse
 
from saml2.mdie import to_dict
 
from saml2 import md
            return
 
        _ent = to_dict(entity_descr, self.onts)
        flag = 0
        # verify support for SAML2

src/p/y/pysaml2-HEAD/src/saml2/mdstore.py   pysaml2(Download)
from saml2.extension.idpdisc import DiscoveryResponse
 
from saml2.mdie import to_dict
 
from saml2 import md
            return
 
        _ent = to_dict(entity_descr, self.onts)
        flag = 0
        # verify support for SAML2

src/p/y/pysaml2-2.0.0/tests/test_20_assertion.py   pysaml2(Download)
from saml2.authn_context import pword
from saml2.mdie import to_dict
from saml2 import md, assertion
from saml2.saml import Attribute
from saml2.saml import Issuer
 
 
gn = to_dict(md.RequestedAttribute(name="urn:oid:2.5.4.42",
                                   friendly_name="givenName",
                                   name_format=NAME_FORMAT_URI), ONTS)
 
sn = to_dict(md.RequestedAttribute(name="urn:oid:2.5.4.4",
                                   name_format=NAME_FORMAT_URI), ONTS)
 
mail = to_dict(md.RequestedAttribute(name="urn:oid:0.9.2342.19200300.100.1.3",
                                     friendly_name="mail",
                                     name_format=NAME_FORMAT_URI), ONTS)
def test_filter_on_attributes_0():
    a = to_dict(Attribute(name="urn:oid:2.5.4.5", name_format=NAME_FORMAT_URI,
                          friendly_name="serialNumber"), ONTS)
 
    required = [a]

src/p/y/pysaml2-HEAD/tests/test_20_assertion.py   pysaml2(Download)
# coding=utf-8
from saml2.authn_context import pword
from saml2.mdie import to_dict
from saml2 import md, assertion
from saml2.saml import Attribute
 
 
gn = to_dict(md.RequestedAttribute(name="urn:oid:2.5.4.42",
                                   friendly_name="givenName",
                                   name_format=NAME_FORMAT_URI), ONTS)
 
sn = to_dict(md.RequestedAttribute(name="urn:oid:2.5.4.4",
                                   name_format=NAME_FORMAT_URI), ONTS)
 
mail = to_dict(md.RequestedAttribute(name="urn:oid:0.9.2342.19200300.100.1.3",
                                     friendly_name="mail",
                                     name_format=NAME_FORMAT_URI), ONTS)
def test_filter_on_attributes_0():
    a = to_dict(Attribute(name="urn:oid:2.5.4.5", name_format=NAME_FORMAT_URI,
                          friendly_name="serialNumber"), ONTS)
 
    required = [a]