Support Article

SAML authentication failing: SAML token security failure



Sporadically in a staging production environment, a SAML authentication error is received in Pega 7.1.7. 

Error Messages

"Caught Exception while validating SAML2 Authentication response protocol : SAML token security failure"

Caused by: org.apache.wss4j.common.ext.WSSecurityException: SAML token security failure

at com.pega.pegarules.integration.engine.internal.sso.saml.SAMLv2ResponseProtocolValidator.validateAssertion(
at com.pega.pegarules.integration.engine.internal.sso.saml.SAMLv2ResponseProtocolValidator.validate(

Steps to Reproduce

When testing logins attempts, one out of every five attempts, results in the error.

Root Cause

When the login worked the SAMLResponse contained the X509 certificate XML node. When the login failed the SAMLResponse did not contains the X509 certificate. 

The environment has two IDP servers with a load balancer in front of them. One of the IDP servers was missing the configuration option to return the X509 certificate xml node within the SAMLResponse. 



A defect or configuration issue in the operating environment caused the problem.

Once both IDP servers were configured to return the X509 certificate xml node the issue gets resolved. 

Pega also provided two patches to client to reach to the latest PRPC SAML code for Pega 7.1.7:  Hfix-20958, Hfix-22795.

Suggest Edit

Published January 31, 2016 - Updated October 8, 2020

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.