api.saml.configuration package

Submodules

api.saml.configuration.model module

class api.saml.configuration.model.SAMLConfiguration(configuration_storage, db, metadata_parser)[source]

Bases: ConfigurationGrouping

Contains SP and IdP settings.

IDP_DISPLAY_NAME_DEFAULT_TEMPLATE = 'Identity Provider #{0}'
federated_identity_provider_entity_ids

Contains configuration metadata

filter_expression

Contains configuration metadata

get_identity_providers(db)[source]

Returns identity providers

Parameters:

db (sqlalchemy.orm.session.Session) – Database session

Returns:

List of IdentityProviderMetadata objects

Return type:

List[IdentityProviderMetadata]

Raise:

ConfigurationError

get_service_provider(db)[source]

Returns service provider

Parameters:

db (sqlalchemy.orm.session.Session) – Database session

Returns:

ServiceProviderMetadata object

Return type:

ServiceProviderMetadata

Raise:

ConfigurationError

non_federated_identity_provider_xml_metadata

Contains configuration metadata

patron_id_attributes

Contains configuration metadata

patron_id_regular_expression

Contains configuration metadata

patron_id_use_name_id

Contains configuration metadata

service_provider_debug_mode

Contains configuration metadata

service_provider_private_key

Contains configuration metadata

service_provider_strict_mode

Contains configuration metadata

service_provider_xml_metadata

Contains configuration metadata

session_lifetime

Contains configuration metadata

exception api.saml.configuration.model.SAMLConfigurationError(message=None, inner_exception=None)[source]

Bases: BaseError

Raised in the case of any configuration errors.

class api.saml.configuration.model.SAMLConfigurationFactory(parser)[source]

Bases: ConfigurationFactory

Factory creating new instances of SAMLConfiguration class.

create(configuration_storage, db, configuration_grouping_class)[source]

Create a new instance of SAMLConfiguration.

Parameters:
  • configuration_storage (ConfigurationStorage) – ConfigurationStorage object

  • db (sqlalchemy.orm.session.Session) – Database session

  • configuration_grouping_class (Type[ConfigurationGrouping]) – Configuration bucket’s class

Returns:

SAMLConfiguration object

Return type:

SAMLConfiguration

class api.saml.configuration.model.SAMLOneLoginConfiguration(configuration)[source]

Bases: object

Converts metadata objects to the OneLogin’s SAML Toolkit format

ASSERTION_CONSUMER_SERVICE = 'assertionConsumerService'
AUTHN_REQUESTS_SIGNED = 'authnRequestsSigned'
BINDING = 'binding'
DEBUG = 'debug'
ENCRYPTION = 'encryption'
ENTITY_ID = 'entityId'
IDP = 'idp'
NAME_ID_FORMAT = 'NameIDFormat'
PRIVATE_KEY = 'privateKey'
SECURITY = 'security'
SIGNING = 'signing'
SINGLE_SIGN_ON_SERVICE = 'singleSignOnService'
SP = 'sp'
STRICT = 'strict'
URL = 'url'
X509_CERT = 'x509cert'
X509_CERT_MULTI = 'x509certMulti'
property configuration

Returns original configuration

Returns:

Original configuration

Return type:

api.saml.configuration.model.SAMLConfiguration

get_identity_provider_settings(db, idp_entity_id)[source]

Returns a dictionary containing identity provider’s settings in a OneLogin’s SAML Toolkit format

Parameters:
  • db (sqlalchemy.orm.session.Session) – Database session

  • idp_entity_id (string) – IdP’s entity ID

Returns:

Dictionary containing identity provider’s settings in a OneLogin’s SAML Toolkit format

Return type:

Dict

get_service_provider_settings(db)[source]

Returns a dictionary containing service provider’s settings in the OneLogin’s SAML Toolkit format

Parameters:

db (sqlalchemy.orm.session.Session) – Database session

Returns:

Dictionary containing service provider’s settings in the OneLogin’s SAML Toolkit format

Return type:

Dict

get_settings(db, idp_entity_id)[source]

Returns a dictionary containing SP’s and IdP’s settings in the OneLogin’s SAML Toolkit format

Parameters:
  • db (sqlalchemy.orm.session.Session) – Database session

  • idp_entity_id (string) – IdP’s entity ID

Returns:

Dictionary containing SP’s and IdP’s settings in the OneLogin’s SAML Toolkit format

Return type:

Dict

class api.saml.configuration.model.SAMLSettings[source]

Bases: dict

Converts SAMLConfiguration to SETTINGS-compatible dictionary.

Once a database session becomes available, this class updates SAMLConfiguration with a list of available federated IdPs.

api.saml.configuration.validator module

class api.saml.configuration.validator.ProviderType(value)[source]

Bases: Enum

An enumeration.

IdentityProvider = 'IdP'
ServiceProvider = 'SP'
class api.saml.configuration.validator.SAMLSettingsValidator(metadata_parser, subject_filter)[source]

Bases: Validator

Validates SAMLAuthenticationProvider’s settings submitted by a user

validate(settings, content)[source]

Validates provider’s setting values submitted by the user

Parameters:
  • settings (Optional[ProblemDetail]) – Dictionary containing provider’s settings (SAMLAuthenticationProvider.SETTINGS)

  • content (werkzeug.datastructures.MultiDict) – Dictionary containing submitted form’s metadata

Returns:

ProblemDetail in the case of any errors, None if validation succeeded

Return type:

Optional[core.util.problem_detail.ProblemDetail]

Module contents