IPWorks Auth 2020 Python Edition

Questions / Feedback?

SAML Class

Properties   Methods   Events   Configuration Settings   Errors  

The SAML class is used to obtain security tokens and assertions.

Syntax

class ipworksauth.SAML

Remarks

The SAML class provides an easy-to-use interface to obtain security tokens and assertions. The class can also be used to parse assertions and inspect the claims within.

The component has built in support for working with Microsoft SharePoint Online and Microsoft Dynamics CRM Online. This support means only a minimum of information needs to be supplied to the component.

Microsoft SharePoint Online and Dynamics CRM Online

To begin working with SharePoint Online or Dynamics CRM Online first set the auth_mode to the appropriate value. The class will automatically populate several properties to known values. Set the user, password, application_urn properties and call get_security_token. For instance:


component.AuthMode = SAMLAuthModes.amDynamicsCRM; //dynamic crm
component.User = "user@mycrm.onmicrosoft.com";
component.Password = "password";
component.ApplicationURN = "urn:crmapac:dynamics.com";
component.GetSecurityToken();
After calling get_security_token the security_token_xml property will be populated.

ADFS and Others

When working with ADFS or another Security Token Service (STS) the get_assertion method may be used to obtain an assertion. To begin set auth_mode to either amADFS or amCustom. Then set local_sts, user, password, and application_urn. For instance:


component.AuthMode = SAMLAuthModes.amADFS;
component.User = "administrator";
component.Password = "admin";
component.LocalSTS = "https://adfs.contoso.com";
component.ApplicationURN = "https://fsweb.contoso.com/ClaimsAwareWebAppWithManagedSTS/";
component.GetAssertion();
If the assertion is signed the class will use the certificate specified in signer_cert to verify the signature. If signer_cert is not set the class will attempt to parse the certificate present in the assertion to perform verification.

After the assertion is parsed and the signature is verified (if present) the following properties will be populated:

Parsing an Assertion

The class may also be used to parse an existing assertion without contacting a STS. To parse an existing assertion call parse_assertion with the assertion XML. If the assertion is signed the class will use the certificate specified in signer_cert to verify the signature. If signer_cert is not set the class will attempt to parse the certificate present in the assertion to perform verification.

After the assertion is parsed and the signature is verified (if present) the following properties will be populated:

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

application_urnThe application's Uniform Resource Name (URN).
assertion_idThe assertion id.
assertion_issue_instantThe time in UTC that the assertion was issued.
assertion_issuerThe assertion issuer.
assertion_not_beforeThe date on which the assertion becomes valid.
assertion_not_on_or_afterThe time at which the assertion expires.
assertion_subjectThe subject of the assertion.
assertion_versionThe version of the assertion.
assertion_xmlThe assertion XML.
auth_modeThe authentication mode.
cert_encodedThe certificate (PEM/base64 encoded).
cert_storeThe name of the certificate store for the client certificate.
cert_store_passwordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
cert_store_typeThe type of certificate store for this certificate.
cert_subjectThe subject of the certificate used for client authentication.
claim_countThe number of records in the Claim arrays.
claim_issuer_nameThe name of the issuer.
claim_original_issuerThe name of the original issuer.
claim_property_countThe number of properties in the claim.
claim_property_indexSelects a property.
claim_property_nameThe name of the property.
claim_property_valueThe value of the property.
claim_type_nameThe type name of the claim.
claim_valueThe value of the claim.
claim_value_typeThe type of value.
federation_stsThe URL of the federation Security Token Service (STS).
federation_urnThe federation Uniform Resource Name (URN).
local_stsThe local Security Token Service (STS).
passwordThe user's password.
proxy_auth_schemeThis property is used to tell the class which type of authorization to perform when connecting to the proxy.
proxy_auto_detectThis property tells the class whether or not to automatically detect and use proxy system settings, if available.
proxy_passwordThis property contains a password if authentication is to be used for the proxy.
proxy_portThis property contains the TCP port for the proxy Server (default 80).
proxy_serverIf a proxy Server is given, then the HTTP request is sent to the proxy instead of the server otherwise specified.
proxy_sslThis property determines when to use SSL for the connection to the proxy.
proxy_userThis property contains a user name, if authentication is to be used for the proxy.
security_token_xmlThe security token XML.
signer_cert_encodedThe certificate (PEM/base64 encoded).
signer_cert_storeThe name of the certificate store for the client certificate.
signer_cert_store_passwordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
signer_cert_store_typeThe type of certificate store for this certificate.
signer_cert_subjectThe subject of the certificate used for client authentication.
ssl_accept_server_cert_encodedThe certificate (PEM/base64 encoded).
ssl_cert_encodedThe certificate (PEM/base64 encoded).
ssl_cert_storeThe name of the certificate store for the client certificate.
ssl_cert_store_passwordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
ssl_cert_store_typeThe type of certificate store for this certificate.
ssl_cert_subjectThe subject of the certificate used for client authentication.
ssl_server_cert_encodedThe certificate (PEM/base64 encoded).
userThe username.
attr_countThe number of records in the Attr arrays.
attr_nameThe Name provides the local name (without prefix) of the attribute.
attr_namespaceAttribute namespace.
attr_prefixAttribute prefix (if any).
attr_valueAttribute value.
x_child_countThe number of records in the XChild arrays.
x_child_nameThe Name property provides the local name (without prefix) of the element.
x_child_namespaceNamespace of the element.
x_child_prefixPrefix of the element (if any).
x_child_x_textThe inner text of the element.
x_elementThe name of the current element.
x_namespaceThe namespace of the current element.
x_parentThe parent of the current element.
x_pathProvides a way to point to a specific element in the document.
x_prefixThe prefix of the current element.
x_sub_treeA snapshot of the current element in the document.
x_textThe text of the current element.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

configSets or retrieves a configuration setting.
get_assertionGets the assertion.
get_security_tokenGets the security token.
parse_assertionParses the specified assertion.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

on_charactersFired for plain text segments of the input stream.
on_commentFired when a comment section is encountered.
on_end_elementFired when an end-element tag is encountered.
on_errorInformation about errors during data delivery.
on_piFired when a processing instruction section is encountered.
on_ssl_server_authenticationFired after the server presents its certificate to the client.
on_ssl_statusShows the progress of the secure connection.
on_start_elementFired when a begin-element tag is encountered in the document.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

AssertionXPathThe XPath to the assertion.
DecryptAssertionWhether to decrypt the assertion.
EncryptedAssertionXPathThe XPath to the encrypted assertion.
RawRequestReturns the raw HTTP request.
RawResponseReturns the raw HTTP response.
UserRealmThe URL of a web service to determine the LocalSTS (if any).
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Auth 2020 Python Edition - Version 20.0 [Build 8155]