Send a SAML Response that Includes the "AudienceRestriction" Tag when api.access.deny() Is Called
Last Updated:
Overview
To redirect a user to the custom error page (URL) on Salesforce, Salesforce requires a SAML Response that includes the "AudienceRestriction" tag. Please check out this link for more details.
The desired use case for which this article applies:
- In Post Login Action, api.access.deny() is called if a user has a particular value in the app_metadata.
- If api.access.deny() is called, the user should be redirected to the custom error page (URL) on Salesforce.
Applies To
- Salesforce
- api.access.deny()
- Post Login Action
Solution
The only workaround would be not to call api.access.deny() and alter the value of the "AudienceRestriction" tag. Send the SAML Response with Assertion to Salesforce. Side effects for this cannot be thoroughly identified, but error handling should be implemented on Salesforce in order to block user access to the application.
To update the value of the "AudienceRestriction," api.samlResponse.setAudience() can be used.
Related References
- Actions Triggers: post-login - API Object