SP adapter
Use this script type to make application-specific changes during the processing of the
authentication request on the SP side, such as updating the SPNameQualifier
attribute.
The script provides hooks at the following points:
Processing phase | Description |
---|---|
|
Invoked before PingOne Advanced Identity Cloud sends the single sign-on request to the IDP. |
|
Invoked before single sign-on processing begins on the SP side, when PingOne Advanced Identity Cloud receives the response from the IDP. |
|
Invoked when single sign-on processing succeeds. |
|
Invoked when single sign-on processing fails. |
|
Invoked when the processing of a new name identifier succeeds. |
|
Invoked when the association of a name identifier between an SP and IDP is successfully terminated. |
|
Invoked before the single logout process starts on the SP side, while the user session is still valid. |
|
Invoked after the single logout process succeeds, when the user session has been invalidated. |
Learn about SP adapter scripts from the following resources:
|
Demonstrate an SP adapter
This task assumes your environment is already correctly configured for single sign-on using SAML v2.0, where PingOne Advanced Identity Cloud is the hosted SP.
Complete the following steps to implement an example SP adapter script that updates the SPNameQualifier
attribute in the authentication request:
Create the script
-
In the Advanced Identity Cloud admin UI, create a script of type SAML2 SP Adapter.
-
In the JavaScript field, paste the template saml2-sp-adapter.js script.
-
Copy the saml2-sp-adapter.js script and paste in the Script field.
-
Add code to the
preSingleSignOnRequest
function to change the value ofSPNameQualifier
in the authentication request. Optionally, add code to redirect a successful login in thepostSingleSignOnSuccess
function.For example:
function preSingleSignOnRequest() { logger.error("In preSingleSignOnRequest"); authnRequest.getNameIDPolicy().setSPNameQualifier("mySP-Updated"); } function postSingleSignOnSuccess() { logger.error("In postSingleSignOnSuccess"); response.sendRedirect("https://example.com"); return true; }
-
Save your changes and close the editor.