当前位置: 首页>>代码示例>>Python>>正文


Python sigver.get_xmlsec_binary函数代码示例

本文整理汇总了Python中saml2.sigver.get_xmlsec_binary函数的典型用法代码示例。如果您正苦于以下问题:Python get_xmlsec_binary函数的具体用法?Python get_xmlsec_binary怎么用?Python get_xmlsec_binary使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_xmlsec_binary函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, idp_conf, logger, conf, publicKey, privateKey, metadataList):
        """
        Constructor.
        Initiates the class.
        :param logger: Logger to be used when something needs to be logged.
        :param conf: idp_proxy_conf see IdpProxy/conig/idp_proxy_conf.example.py
        :param key: A RSA key to be used for encryption.
        :param metadataList: A list of metadata files.
            [{"local": ["swamid-1.0.xml"]}, {"local": ["sp.xml"]}]
        :raise:
        """
        if (logger is None) or (conf is None) or (publicKey is None)or (privateKey is None):
            raise ValueError(
                "A new instance must include a value for logger, conf and key.")
        #Public key to be used for encryption.
        self.publicKey = publicKey
        self.privateKey = privateKey
        #Used for presentation of mako files.
        self.lookup = TemplateLookup(
            directories=[MetadataGeneration.CONST_STATIC_MAKO + 'templates',
                         MetadataGeneration.CONST_STATIC_MAKO + 'htdocs'],
            module_directory='modules',
            input_encoding='utf-8',
            output_encoding='utf-8')
        #The logger.
        self.logger = logger
        #A list of all social services used by this IdPproxy.
        self.socialServiceKeyList = []
        #A list of all service providers used by this sp.
        self.spKeyList = []
        for key in conf:
            self.socialServiceKeyList.append(conf[key]["name"])

        try:
            xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
        except:
            try:
                xmlsec_path = get_xmlsec_binary(["/usr/local/bin"])
            except:
                self.logger.info('Xmlsec must be installed! Tries /usr/bin/xmlsec1.')
                xmlsec_path = '/usr/bin/xmlsec1'

        self.xmlsec_path = xmlsec_path

        config = Config()
        config.disable_ssl_certificate_validation = True
        config.key_file = idp_conf["key_file"]
        config.cert_file = idp_conf["cert_file"]
        config.xmlsec_binary = idp_conf["xmlsec_binary"]
        config.debug = idp_conf["debug"]

        for metadata in metadataList:
            mds = MetadataStore(MetadataGeneration.CONST_ONTS.values(),
                                MetadataGeneration.CONST_ATTRCONV, config)
            mds.imp(metadata)
            for entityId in mds.keys():
                self.spKeyList.append(entityId)
开发者ID:HaToHo,项目名称:IdPproxy,代码行数:57,代码来源:secret.py

示例2: load

    def load(self, cnf, metadata_construction=False):
        """ The base load method, loads the configuration

        :param cnf: The configuration as a dictionary
        :param metadata_construction: Is this only to be able to construct
            metadata. If so some things can be left out.
        :return: The Configuration instance
        """
        for arg in COMMON_ARGS:
            try:
                self._attr[""][arg] = cnf[arg]
            except KeyError:
                pass

        if "service" in cnf:
            for typ in ["aa", "idp", "sp", "pdp"]:
                try:
                    self.load_special(cnf["service"][typ], typ,
                                    metadata_construction=metadata_construction)

                except KeyError:
                    pass

        if not metadata_construction:
            if "xmlsec_binary" not in self._attr[""]:
                self._attr[""]["xmlsec_binary"] = get_xmlsec_binary()
            # verify that xmlsec is where it's supposed to be
            if not os.access(self._attr[""]["xmlsec_binary"], os.F_OK):
                raise Exception("xmlsec binary not in '%s' !" % (
                                            self._attr[""]["xmlsec_binary"]))

        self.load_complex(cnf, metadata_construction=metadata_construction)
        self.context = self.def_context

        return self
开发者ID:ganeshcmohan,项目名称:pysaml,代码行数:35,代码来源:config.py

示例3: test_metadata_file

def test_metadata_file():
    sec_config.xmlsec_binary = sigver.get_xmlsec_binary(["/opt/local/bin"])
    mds = MetadataStore(list(ONTS.values()), ATTRCONV, sec_config, disable_ssl_certificate_validation=True)

    mds.imp(METADATACONF["8"])
    print((len(list(mds.keys()))))
    assert len(list(mds.keys())) == 560
开发者ID:rohe,项目名称:pysaml2-3,代码行数:7,代码来源:test_30_mdstore.py

示例4: test_load_local_dir

def test_load_local_dir():
    sec_config.xmlsec_binary = sigver.get_xmlsec_binary(["/opt/local/bin"])
    mds = MetadataStore(ONTS.values(), ATTRCONV, sec_config, disable_ssl_certificate_validation=True)

    mds.imp(METADATACONF["9"])
    print mds
    assert len(mds) == 3  # Three sources
    assert len(mds.keys()) == 4  # number of idps
开发者ID:balagopalraj,项目名称:clearlinux,代码行数:8,代码来源:test_30_mdstore.py

示例5: xmlsec

def xmlsec():
  """
  xmlsec path
  """
  if get_xmlsec_binary:
    return get_xmlsec_binary()
  else:
    return '/usr/local/bin/xmlsec1'
开发者ID:Terradue,项目名称:hue,代码行数:8,代码来源:conf.py

示例6: test_mdx_certs

def test_mdx_certs():
    sec_config.xmlsec_binary = sigver.get_xmlsec_binary(["/opt/local/bin"])
    http = HTTPBase(verify=False, ca_bundle=None)

    mdx = MetaDataMDX(ONTS.values(), ATTRCONV, "http://pyff-test.nordu.net",
                      sec_config, None, http)
    foo = mdx.certs("https://idp.umu.se/saml2/idp/metadata.php", "idpsso")

    assert len(foo) == 1
开发者ID:tpazderka,项目名称:pysaml2,代码行数:9,代码来源:test_30_mdstore.py

示例7: test_load_extern_incommon

def test_load_extern_incommon():
    sec_config.xmlsec_binary = sigver.get_xmlsec_binary(["/opt/local/bin"])
    mds = MetadataStore(ONTS.values(), ATTRCONV, sec_config,
                        disable_ssl_certificate_validation=True)

    mds.imp(METADATACONF["10"])
    print(mds)
    assert mds
    assert len(mds.keys())
开发者ID:HaToHo,项目名称:pysaml2,代码行数:9,代码来源:test_30_mdstore.py

示例8: test_load_external

def test_load_external():
    sec_config.xmlsec_binary = sigver.get_xmlsec_binary(["/opt/local/bin"])
    mds = MetadataStore(ATTRCONV, sec_config,
                        disable_ssl_certificate_validation=True)

    mds.imp(METADATACONF["10"])
    print(mds)
    assert len(mds) == 1  # One source
    assert len(mds.keys()) > 1  # number of idps
开发者ID:Amli,项目名称:pysaml2,代码行数:9,代码来源:test_30_mdstore_old.py

示例9: test_mdx_service

def test_mdx_service():
    sec_config.xmlsec_binary = sigver.get_xmlsec_binary(["/opt/local/bin"])
    http = HTTPBase(verify=False, ca_bundle=None)

    mdx = MetaDataMDX(ONTS.values(), ATTRCONV, "http://pyff-test.nordu.net",
                      sec_config, None, http)
    foo = mdx.service("https://idp.umu.se/saml2/idp/metadata.php",
                      "idpsso_descriptor", "single_sign_on_service")

    assert len(foo) == 1
    assert foo.keys()[0] == BINDING_HTTP_REDIRECT
开发者ID:tpazderka,项目名称:pysaml2,代码行数:11,代码来源:test_30_mdstore.py

示例10: setup_class

    def setup_class(self):
        xmlexec = get_xmlsec_binary()
        self.sec = sigver.SecurityContext(xmlexec, key_file=PRIV_KEY,
                                          cert_file=PUB_KEY, debug=1)

        self._assertion = factory( saml.Assertion,
            version="2.0",
            id="11111",
            issue_instant="2009-10-30T13:20:28Z",
            signature=sigver.pre_signature_part("11111", self.sec.my_cert, 1),
            attribute_statement=do_attribute_statement({
                    ("","","surName"): ("Foo",""),
                    ("","","givenName") :("Bar",""),
                })
            )
开发者ID:FluidReview,项目名称:saml2,代码行数:15,代码来源:test_40_sigver.py

示例11: test_decrypt

    def test_decrypt(self):
        attr_stat = saml.attribute_statement_from_string(
                            open("encrypted_attribute_statement.xml").read())

        assert len(attr_stat.attribute) == 0
        assert len(attr_stat.encrypted_attribute) == 4

        xmlsec = get_xmlsec_binary()
        sec = SecurityContext(xmlsec, key_file="private_key.pem")

        resp = AuthnResponse(sec, None, "entity_id")
        resp.decrypt_attributes(attr_stat)

        assert len(attr_stat.attribute) == 4
        assert len(attr_stat.encrypted_attribute) == 4
开发者ID:ganeshcmohan,项目名称:pysaml,代码行数:15,代码来源:test_41_response.py

示例12: test_load_string

def test_load_string():
    sec_config.xmlsec_binary = sigver.get_xmlsec_binary(["/opt/local/bin"])
    mds = MetadataStore(ONTS.values(), ATTRCONV, sec_config,
                        disable_ssl_certificate_validation=True)

    mds.imp(METADATACONF["11"])
    # print(mds)
    assert len(mds.keys()) == 1
    idps = mds.with_descriptor("idpsso")

    assert list(idps.keys()) == [
        'http://xenosmilus.umdc.umu.se/simplesaml/saml2/idp/metadata.php']
    certs = mds.certs(
        'http://xenosmilus.umdc.umu.se/simplesaml/saml2/idp/metadata.php',
        "idpsso", "signing")
    assert len(certs) == 1
开发者ID:HaToHo,项目名称:pysaml2,代码行数:16,代码来源:test_30_mdstore.py

示例13: load

    def load(self, cnf, metadata_construction=False):
        """ The base load method, loads the configuration

        :param cnf: The configuration as a dictionary
        :param metadata_construction: Is this only to be able to construct
            metadata. If so some things can be left out.
        :return: The Configuration instance
        """
        _uc = self.unicode_convert
        for arg in COMMON_ARGS:
            if arg == "virtual_organization":
                if "virtual_organization" in cnf:
                    for key, val in cnf["virtual_organization"].items():
                        self.vorg[key] = VirtualOrg(None, key, val)
                continue

            try:
                setattr(self, arg, _uc(cnf[arg]))
            except KeyError:
                pass
            except TypeError:  # Something that can't be a string
                setattr(self, arg, cnf[arg])

        if "service" in cnf:
            for typ in ["aa", "idp", "sp", "pdp", "aq"]:
                try:
                    self.load_special(
                        cnf["service"][typ], typ,
                        metadata_construction=metadata_construction)
                    self.serves.append(typ)
                except KeyError:
                    pass

        if not metadata_construction:
            if not self.xmlsec_binary:
                self.xmlsec_binary = get_xmlsec_binary()

            # verify that xmlsec is where it's supposed to be
            if not os.path.exists(self.xmlsec_binary):
                #if not os.access(, os.F_OK):
                raise Exception(
                    "xmlsec binary not in '%s' !" % self.xmlsec_binary)

        self.load_complex(cnf, metadata_construction=metadata_construction)
        self.context = self.def_context

        return self
开发者ID:mlepine,项目名称:pysaml2,代码行数:47,代码来源:config.py

示例14: test_sign_assertion

    def test_sign_assertion(self):
        ass = self._assertion
        print ass
        sign_ass = self.sec.sign_assertion_using_xmlsec("%s" % ass,
                                                        nodeid=ass.id)
        #print sign_ass
        sass = saml.assertion_from_string(sign_ass)
        #print sass
        assert _eq(sass.keyswv(), ['attribute_statement', 'issue_instant',
                                   'version', 'signature', 'id'])
        assert sass.version == "2.0"
        assert sass.id == "11111"
        assert time_util.str_to_time(sass.issue_instant)

        print xmlsec_version(get_xmlsec_binary())

        item = self.sec.check_signature(sass, class_name(sass), sign_ass)

        assert isinstance(item, saml.Assertion)
开发者ID:FluidReview,项目名称:saml2,代码行数:19,代码来源:test_40_sigver.py

示例15: setup_class

    def setup_class(self):
        xmlexec = get_xmlsec_binary()
        md = MetadataStore([saml, samlp], None, xmlexec)
        md.load("local", full_path("metadata_cert.xml"))

        crypto = get_xmlsec_cryptobackend()
        self.sec = sigver.SecurityContext(crypto, key_file=PRIV_KEY,
                             cert_file=PUB_KEY, debug=1, metadata=md)

        self._assertion = factory( saml.Assertion,
                                   version="2.0",
                                   id="11111",
                                   issue_instant="2009-10-30T13:20:28Z",
                                   signature=sigver.pre_signature_part("11111", self.sec.my_cert, 1),
                                   attribute_statement=do_attribute_statement({
                                       ("","","surName"): ("Foo",""),
                                       ("","","givenName") :("Bar",""),
                                       })
        )
开发者ID:caustin,项目名称:pysaml2,代码行数:19,代码来源:test_40_sigver.py


注:本文中的saml2.sigver.get_xmlsec_binary函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。