Does anyone have the sample code that used to show up in the Custom Logic of the SAML Response page? It's also partially visible here:https://docs.cyberark.com/Product-Doc/OnlineHelp/Idaptive/Latest/en/Content/Applications/AppsScriptRef/SAMLCustScript.ht

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Welcome Idira to LIVEcommunity!

Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.

Meet Idira

Does anyone have the sample code that used to show up in the Custom Logic of the SAML Response page? It's also partially visible here:https://docs.cyberark.com/Product-Doc/OnlineHelp/Idaptive/Latest/en/Content/Applications/AppsScriptRef/SAMLCustScript.ht

L1 Bithead

Field_Content_versions_oct20__0682J00000CXDXVQA5.pngWe need it to add an extra role and I tested this in the past. Using the sample code was very easy (uncomment some lines) but now it just says "enter code here"

4 REPLIES 4

L2 Linker

Hi Jessica,

 

May I know which application you are using? We could help check if we can provide the scripts for you.

 

You could also click the "Reset Script" button to reset the scripts to the default one.

 

Thank you.

 

Best Regards,

Jason

Hello Jason! It would be for Web + SAML Provisioning. The sample code appended roles to existing roles. I tried the 'reset script' option but it just says 'enter code here'. It was about a year ago when I remember testing with it. Thanks!! Jessica

L4 Transporter

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);

 

Yes, that is it!! Thanks very much!! :-) JESSICA HART TECH OPS ENGINEER | TECHNICAL OPERATIONS CORELIGHT, INC (M) 6143480288 (E) [email protected]
  • 531 Views
  • 4 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!