Hi Jessica,
This should be the sample you are looking for
/*
- This script creates a signed SAML Response (sometimes a.k.a. Assertion).
- Parameters passed into this script are:
- Application -
- The application object from the cloud storage.
- Use the Get method to get a property from the storage.
- For example, var url = Application.Get('Url');
- LoginUser -
- The login user object.
- - LoginUser.Username is set to the login username as configured
- in 'Account Mapping' in 'Application Settings'.
- - LoginUser.Get gets the user's attribute from the
- Active Directory, for example, LoginUser.Get('mail');
- - LoginUser.GroupNames is set to an array of group names that
- the user is directly a member of.
- - LoginUser.EffectiveGroupNames is set to an array of ALL group
- names that the user is a member of.
- - LoginUser.GroupDNs is set to an array of group DNs that the
- user is directly a member of.
- - LoginUser.EffectiveGroupDNs is set to an array of ALL group DNs
- that the user is a member of.
- Issuer -
- String value of the Issuer field in 'Application Settings'.
- This value is the same as Application.Get('Issuer');
- ServiceUrl -
- String value of the Assertion Consumer Service URL field in
- 'Application Settings'. This value is the same as Application.Get('Url');
- UserIdentifier -
- String value of the login username for this application as
- configured in 'Account Mapping' in 'Application Settings'.
- This is the same as LoginUser.Username;
- */
/* Set the version of SAML Response to generate.
- Possible values are 1 and 2. The default is 2. */
- setVersion('2');
/* Set the Issuer in the SAML Response. */
setIssuer(Issuer);
/* Set the Subject in the SAML Response. */
setSubjectName(LoginUser.Username);
/* Set the Audience (a.k.a. SP Issuer or SP Entity ID) in the SAML Response.
- The value is given by Service Provider, usually in SP Metadata. */
- setAudience('example-audience-value');
/* Set the Recipient in the SAML Response.,
- Typically, it is the same as the ACS URL. */
- setRecipient(ServiceUrl);
/* Set whether the assertion itself or the response
- should be signed. Possible values are 'Response' or
- 'Assertion'. The default is 'Response' */
- setSignatureType('Response');
/* Set the ACS URL to post the SAML Response to. */
setHttpDestination(ServiceUrl);
/* Some Service Provider require to use the SAML V2.0 Assertion Namespace, which writes the
- "saml:" prefix to relevant XML elements in SAML Response. Be default, it is not used.
- If you are required by Service Provider to use it, uncomment this line of script,
- or set the value to 'true'. */
- //useNamespaceSaml20Assertion('true');
/* Set a RelayState URL or string used in IdP-initiated SSO, if required
- by the Service Provider. */
- //setRelayState('/myapps-relay-state');
/* (SAML v1.x only) Set the value for the TARGET form field
- when posting the SAML Response. Typically it is the
- same as HttpDestination above. */
- //setServiceUrl(ServiceUrl);
/* Optionally set the DigestMethod Algorithm in the SAML Response
- Possible values are 'sha1' , 'sha256', 'sha384' or 'sha512'.
- The default value is same as certificate SignatureMethod Algorithm*/
- //setDigestMethodAlgorithm('Sha256');
/* Optionally set an attribute with name 'Full Name' in the SAML Response to the
- value of the user's 'cn' attribute in the AD if needed by the application */
- //setAttribute('Full Name', LoginUser.Get('cn'));
/* Optionally set an attribute with name 'Email' in the SAML Response to the
- value of the user's 'mail' attribute in the AD if needed by the application */
- //setAttribute('Email', LoginUser.Get('mail')); */
/* Optionally set an attribute with name 'Groups' in the SAML Response to
- an array of AD group names that the user is directly a member of.
- Warning: This could result in a very large SAML Assertion so set this
- only if it's really needed. */
- //setAttributeArray('Groups', LoginUser.GroupNames); */
/* Optionally set an attribute with name 'Groups' in the SAML Response to
- a filtered array of AD group names that the user is directly a member of.
- Filtering by either JavaScript RegEx object or C# style Regular Expression
- to filter out the desired group names.
- Warning: The incorrect reg-exp may result in an error or a very large SAML Assertion
- so set this only if it's really needed and make sure the reg-exp is correct.*/
- //setFilteredAttributeArray('Groups', LoginUser.GroupNames, <reg-exp>); */
/* Optionally set an attribute with name 'Groups' in the SAML Response to
- a filtered array of a customized JavaScript array.
- Filtering by either JavaScript RegEx object or C# style Regular Expression
- to filter out the desired group names.
- Warning: The incorrect reg-exp may result in an error or a very large SAML Assertion
- so set this only if it's really needed and make sure the reg-exp is correct.*/
- //var myArray = ["myAttribute1","myAttribute2"];
- //setFilteredAttributeArray('Groups', myArray, <reg-exp>); */
/* Optionally set an attribute with name 'AllGroups' in the SAML Response
- to an array of all AD group names that the user is a member of.
- Warning: This could result in a very large SAML Assertion so set this
- only if it's really needed. */
- //setAttributeArray('AllGroups', LoginUser.EffectiveGroupNames); */
/* Optionally set an attribute with name 'GroupDNs' in the SAML Response
- to an array of AD group DNs that the user is directly a member of.
- Warning: This could result in a very large SAML Assertion so set this
- only if it's really needed. */
- //setAttributeArray('GroupDNs', LoginUser.GroupDNs);
/* Optionally set an attribute with name 'AllGroupDNs' in the SAML Response
- to an array of all AD group DNs that the user is a member of.
- Warning: This could result in a very large SAML Assertion so set this
- only if it's really needed. */
- //setAttributeArray('AllGroupDNs', LoginUser.EffectiveGroupDNs);