settings.py

About this file

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

Code Check Report


app/lib/onelogin/saml2/settings.py:442:121: E501 line too long (125 > 120 characters)
app/lib/onelogin/saml2/settings.py:444:121: E501 line too long (121 > 120 characters)
app/lib/onelogin/saml2/settings.py:446:121: E501 line too long (153 > 120 characters)
app/lib/onelogin/saml2/settings.py:681:121: E501 line too long (138 > 120 characters)
app/lib/onelogin/saml2/settings.py:737:121: E501 line too long (143 > 120 characters)
app/lib/onelogin/saml2/settings.py:741:121: E501 line too long (149 > 120 characters)
                        

Documentation drawn from source code

OneLogin_Saml2_Settings class

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

Setting class of OneLogin's Python Toolkit.


validate_url(url):

Auxiliary method to validate an urllib
:param url: An url to be validated
:type url: string
:returns: True if the url is valid
:rtype: bool

OneLogin_Saml2_Settings(object):


Handles the settings of the Python toolkits.


__init__(self, settings=None, custom_base_path=None, sp_validation_only=False):

Initializes the settings:
- Sets the paths of the different folders
- Loads settings info from settings file or array/object provided

:param settings: SAML Toolkit Settings
:type settings: dict

:param custom_base_path: Path where are stored the settings file and the cert folder
:type custom_base_path: string

:param sp_validation_only: Avoid the IdP validation
:type sp_validation_only: boolean

__load_paths(self, base_path=None):

Set the paths of the different folders

__update_paths(self, settings):

Set custom paths if necessary

get_base_path(self):

Returns base path

:return: The base toolkit folder path
:rtype: string

get_cert_path(self):

Returns cert path

:return: The cert folder path
:rtype: string

get_lib_path(self):

Returns lib path

:return: The library folder path
:rtype: string

get_ext_lib_path(self):

Returns external lib path

:return: The external library folder path
:rtype: string

get_schemas_path(self):

Returns schema path

:return: The schema folder path
:rtype: string

__load_settings_from_dict(self, settings):

Loads settings info from a settings Dict

:param settings: SAML Toolkit Settings
:type settings: dict

:returns: True if the settings info is valid
:rtype: boolean

__load_settings_from_file(self):

Loads settings info from the settings json file

:returns: True if the settings info is valid
:rtype: boolean

__add_default_values(self):

Add default values if the settings info is not complete

check_settings(self, settings):

Checks the settings info.

:param settings: Dict with settings data
:type settings: dict

:returns: Errors found on the settings data
:rtype: list

check_idp_settings(self, settings):

Checks the IdP settings info.
:param settings: Dict with settings data
:type settings: dict
:returns: Errors found on the IdP settings data
:rtype: list

check_sp_settings(self, settings):

Checks the SP settings info.
:param settings: Dict with settings data
:type settings: dict
:returns: Errors found on the SP settings data
:rtype: list

check_sp_certs(self):

Checks if the x509 certs of the SP exists and are valid.
:returns: If the x509 certs of the SP exists and are valid
:rtype: boolean

get_sp_key(self):

Returns the x509 private key of the SP.
:returns: SP private key
:rtype: string or None

get_sp_cert(self):

Returns the x509 public cert of the SP.
:returns: SP public cert
:rtype: string or None

get_sp_cert_new(self):

Returns the x509 public of the SP planned
to be used soon instead the other public cert
:returns: SP public cert new
:rtype: string or None

get_idp_cert(self):

Returns the x509 public cert of the IdP.
:returns: IdP public cert
:rtype: string

get_idp_data(self):

Gets the IdP data.

:returns: IdP info
:rtype: dict

get_sp_data(self):

Gets the SP data.

:returns: SP info
:rtype: dict

get_security_data(self):

Gets security data.

:returns: Security info
:rtype: dict

get_contacts(self):

Gets contact data.

:returns: Contacts info
:rtype: dict

get_organization(self):

Gets organization data.

:returns: Organization info
:rtype: dict

get_sp_metadata(self):

Gets the SP metadata. The XML representation.
:returns: SP metadata (xml)
:rtype: string

validate_metadata(self, xml):

Validates an XML SP Metadata.

:param xml: Metadata's XML that will be validate
:type xml: string

:returns: The list of found errors
:rtype: list

format_idp_cert(self):

Formats the IdP cert.

format_idp_cert_multi(self):

Formats the Multple IdP certs.

format_sp_cert(self):

Formats the SP cert.

format_sp_cert_new(self):

Formats the SP cert.

format_sp_key(self):

Formats the private key.

get_errors(self):

Returns an array with the errors, the array is empty when the settings is ok.

:returns: Errors
:rtype: list

set_strict(self, value):

Activates or deactivates the strict mode.

:param value: Strict parameter
:type value: boolean

is_strict(self):

Returns if the 'strict' mode is active.

:returns: Strict parameter
:rtype: boolean

is_debug_active(self):

Returns if the debug is active.

:returns: Debug parameter
:rtype: boolean

Source code