| Both sides previous revisionPrevious revision | |
| 712:integration:saml [2026/02/20 14:02] – [Configure the SAML Identity Provider (IdP)] Suess, Bernhard | 712:integration:saml [2026/03/19 09:31] (current) – Doczkal, Tristan |
|---|
| |
| ===== Configuring Stages attributes in default-matcher section with JavaScript ===== | ===== Configuring Stages attributes in default-matcher section with JavaScript ===== |
| | JavaScript control flow statements (e.g. "if","switch") can be used to configure values for Stages attributes. All assertion attributes of the SAML response are accessible as variables and can be used in the JavaScript expression |
| |
| ''JavaScript control flow statements (e.g. "if","switch") can be used to configure values for Stages attributes. All assertion attributes of the SAML response are accessible as variables and can be used in the JavaScript expression JavaScript expressions can be used with the following Stages attributes: * defaultRolesUsername * defaultLicenseType * licensePoolIdent **General JavaScript expression notation:** <code> <Stages_attribute>="=<JavaScript_expression>" </code> **JavaScript notation of if-clauses:** <code> if (condition1) 'returnValue1'; else if (condition2) 'returnValue2'; else if (condition3) 'returnValue3'; else 'returnValue4'; </code> **JavaScript notation of value conditions:** SAML Attributes that are defined via identity_provider_attribute elements can be used in these scripts. E.g. <code> <identity-provider-attribute name="email" id="<EMailAddress>" /> </code> <code> Attribute contains value: </code> <code> <saml_attribute_id>.match(/.*value/) // <= 7.9.10.0, <= 7.10.1.0 <saml_attribute_name>.match(/.*value/) //> 7.9.10.0,> 7.10.1.0 </code> Attribute equals value: <code> <saml_attribute_id>=="value // <= 7.9.10.0, <= 7.10.1.0 <saml_attribute_name>=="value //> 7.9.10.0,> 7.10.1.0 </code> **Names of license types for license assignment** ^License name^License type^ |Modeler|QM| |Contributor|FloatingADev| |Participant|FloatingDev| |Project Manager|FloatingPM| |Viewer|AuthPsReader| **Example configuration:** ''\\ '' ''\\ ''This example creates Stages users with the following conditions: * The pattern matches the entry of the SAML attribute "id". * Depending on the users' email address (domain-part), SAML attribute name "email" is used to assign different values for defaultRolesUsername, defaultLicenseType and licensePoolIdent <code> <identity-provider-attribute-match id="<saml_attribute_id>" pattern="<matching_value>" defaultRolesUsername="= if (email.match(/.*@company1.com/)) 'User1'; else if (email.match(/.*@company2.com/)) 'User2'; else 'default'; " defaultLicenseType="= if (email.match(/.*@company1.com/)) 'QM'; else if (email.match(/.*@company2.com/)) 'PM'; else 'none'; " licensePoolIdent="= if (email.match(/.*@company2.com/)) 'company2'; else ''; | JavaScript expressions can be used with the following Stages attributes: |
| |
| | * defaultRolesUsername |
| | * defaultLicenseType |
| | * licensePoolIdent |
| | |
| | **General JavaScript expression notation:** |
| | |
| | <code> |
| | <Stages_attribute>="=<JavaScript_expression>" |
| | |
| | </code> |
| | |
| | **JavaScript notation of if-clauses:** |
| | |
| | <code> |
| | if (condition1) 'returnValue1'; |
| | else if (condition2) 'returnValue2'; |
| | else if (condition3) 'returnValue3'; |
| | else 'returnValue4'; |
| | |
| | </code> |
| | |
| | **JavaScript notation of value conditions:** |
| | |
| | SAML Attributes that are defined via identity_provider_attribute elements can be used in these scripts. E.g. |
| | |
| | <code> |
| | <identity-provider-attribute name="email" id="<EMailAddress>" /> |
| | |
| | </code> |
| | |
| | <code> |
| | Attribute contains value: |
| | |
| | </code> |
| | |
| | <code> |
| | <saml_attribute_id>.match(/.*value/) // <= 7.9.10.0, <= 7.10.1.0 |
| | <saml_attribute_name>.match(/.*value/) //> 7.9.10.0,> 7.10.1.0 |
| | |
| | </code> |
| | |
| | Attribute equals value: |
| | |
| | <code> |
| | <saml_attribute_id>=="value // <= 7.9.10.0, <= 7.10.1.0 |
| | <saml_attribute_name>=="value //> 7.9.10.0,> 7.10.1.0 |
| | |
| | </code> |
| | |
| | **Names of license types for license assignment** |
| | |
| | ^License name^License type^ |
| | |Modeler|QM| |
| | |Contributor|FloatingADev| |
| | |Participant|FloatingDev| |
| | |Project Manager|FloatingPM| |
| | |Viewer|AuthPsReader| |
| | |
| | **Example configuration:** \\ \\ This example creates Stages users with the following conditions: |
| | |
| | * The pattern matches the entry of the SAML attribute "id". |
| | * Depending on the users' email address (domain-part), SAML attribute name "email" is used to assign different values for defaultRolesUsername, defaultLicenseType and licensePoolIdent |
| | |
| | <code> |
| | <identity-provider-attribute-match |
| | id="<saml_attribute_id>" |
| | pattern="<matching_value>" |
| | defaultRolesUsername="= |
| | if (email.match(/.*@company1.com/)) 'User1'; |
| | else if (email.match(/.*@company2.com/)) 'User2'; |
| | else 'default'; |
| | " |
| | defaultLicenseType="= |
| | if (email.match(/.*@company1.com/)) 'QM'; |
| | else if (email.match(/.*@company2.com/)) 'PM'; |
| | else 'none'; |
| | " |
| | licensePoolIdent="= |
| | if (email.match(/.*@company2.com/)) 'company2'; |
| | else ''; |
| " | " |
| autocreateUser="true" | autocreateUser="true" |
| |
| /> | /> |
| |
| |
| Please note that the values of multi value attributes are provided to the scripts as one value as a comma separated string. | Please note that the values of multi value attributes are provided to the scripts as one value as a comma separated string. |
| | |
| |
| |