metadata.py

About this file

We attempted to read from templates/app_lib_onelogin_saml2_metadata.py_hw.txt but failed.

Code Check Report


app/lib/onelogin/saml2/metadata.py:38:121: E501 line too long (123 > 120 characters)
app/lib/onelogin/saml2/metadata.py:103:121: E501 line too long (139 > 120 characters)
app/lib/onelogin/saml2/metadata.py:104:121: E501 line too long (167 > 120 characters)
app/lib/onelogin/saml2/metadata.py:105:121: E501 line too long (135 > 120 characters)
app/lib/onelogin/saml2/metadata.py:106:121: E501 line too long (136 > 120 characters)
app/lib/onelogin/saml2/metadata.py:147:121: E501 line too long (135 > 120 characters)
app/lib/onelogin/saml2/metadata.py:154:121: E501 line too long (210 > 120 characters)
app/lib/onelogin/saml2/metadata.py:195:121: E501 line too long (141 > 120 characters)
app/lib/onelogin/saml2/metadata.py:227:121: E501 line too long (122 > 120 characters)
                        

Documentation drawn from source code

OneLoginSaml2Metadata class

Copyright (c) 2010-2018 OneLogin, Inc.
MIT License

Metadata class of OneLogin's Python Toolkit.


OneLogin_Saml2_Metadata(object):


A class that contains methods related to the metadata of the SP


builder(sp, authnsign=False, wsign=False, valid_until=None, cache_duration=None, contacts=None, organization=None):

Builds the metadata of the SP

:param sp: The SP data
:type sp: string

:param authnsign: authnRequestsSigned attribute
:type authnsign: string

:param wsign: wantAssertionsSigned attribute
:type wsign: string

:param valid_until: Metadata's expiry date
:type valid_until: string|DateTime|Timestamp

:param cache_duration: Duration of the cache in seconds
:type cache_duration: int|string

:param contacts: Contacts info
:type contacts: dict

:param organization: Organization info
:type organization: dict
organization_names.append(""" %s""" % (lang, info['name']))
organization_displaynames.append(""" %s""" % (lang, info['displayname']))
organization_urls.append(""" %s""" % (lang, info['url']))
str_organization = """ \n%(org)s\n """ % {'org': org_data}
attr_cs_desc_str = """ %s
req_attr_aux_str +=
req_attr_aux_str +=
requested_attribute = """ str_attribute_consuming_service = """
%(service_name)s
%(attr_cs_desc)s%(requested_attribute_str)s


sign_metadata(metadata, key, cert, sign_algorithm=OneLogin_Saml2_Constants.RSA_SHA1, digest_algorithm=OneLogin_Saml2_Constants.SHA1):

Signs the metadata with the key/cert provided

:param metadata: SAML Metadata XML
:type metadata: string

:param key: x509 key
:type key: string

:param cert: x509 cert
:type cert: string

:returns: Signed Metadata
:rtype: string

:param sign_algorithm: Signature algorithm method
:type sign_algorithm: string

:param digest_algorithm: Digest algorithm method
:type digest_algorithm: string

__add_x509_key_descriptors(root, cert, signing):

add_x509_key_descriptors(metadata, cert=None, add_encryption=True):

Adds the x509 descriptors (sign/encryption) to the metadata
The same cert will be used for sign/encrypt

:param metadata: SAML Metadata XML
:type metadata: string

:param cert: x509 cert
:type cert: string

:param add_encryption: Determines if the KeyDescriptor[use="encryption"] should be added.
:type add_encryption: boolean

:returns: Metadata with KeyDescriptors
:rtype: string

Source code