Closed
Solved
Extending SAML v2 Metadata in Pega 7.4
Hi All,
Pega 7.4 has introduced a faster way to set up authentication service with a "no-code" approach.
We're looking at extending generated SAML v2 Message with additional xml tags such as ExtensionType with new attributes and elements.
We've tried extending existing Data-SAMLMetadata-ExtensionsType class with additional properties which were added to the XML Stream rule. It's not working so far.
Tracing the session doesn't help as no specific OOTB activity seems to be executed. Looks like all in java.
Any idea to achieve this extension will be helpful. Which rule to update to add the extension ?
Thanks,
Kind Regards,
Djibril Ndoye
To see attachments, please log in.
Adding extensions to SAML2 is not supported OOTB in 7.4 using authentication service.
Only way to achieve this requirement was to change the java code in the OOTB pySAMLWebSSOAuthenticationActivity in Step 13.
You need to use OpenSAML api to add the extension in the authrequest.
for POST binding signature is embedded inside authentication request.
Adding extensions the authrequest bean object may fail as signature is computed in createAuthenticationRequest method itself.
samlutils.createAuthenticationRequest(myStepPage)
But for Redirect binding it works as signature is computed in generateRedirectURL method.
We can get the authrequest bean object returned from createAuthenticationRequest method and add extensions after that calling generateRedirectURL method should help.
String redirectURL = samlutils.generateRedirectURL(endPointURL,samlutils.createAuthenticationRequest(myStepPage),myStepPage,relaystateID);
Below sample code used to achieve this requirement by updating step 13 of the activity pySAMLWebSSOAuthenticationActivity (Pega 7.4):
Adding extensions to SAML2 is not supported OOTB in 7.4 using authentication service.
Only way to achieve this requirement was to change the java code in the OOTB pySAMLWebSSOAuthenticationActivity in Step 13.
You need to use OpenSAML api to add the extension in the authrequest.
for POST binding signature is embedded inside authentication request.
Adding extensions the authrequest bean object may fail as signature is computed in createAuthenticationRequest method itself.
samlutils.createAuthenticationRequest(myStepPage)
But for Redirect binding it works as signature is computed in generateRedirectURL method.
We can get the authrequest bean object returned from createAuthenticationRequest method and add extensions after that calling generateRedirectURL method should help.
String redirectURL = samlutils.generateRedirectURL(endPointURL,samlutils.createAuthenticationRequest(myStepPage),myStepPage,relaystateID);
Below sample code used to achieve this requirement by updating step 13 of the activity pySAMLWebSSOAuthenticationActivity (Pega 7.4):
//SPECIFIC CODE : Define Extensions xml tag
org.opensaml.saml2.common.Extensions extensions = new org.opensaml.saml2.common.impl.ExtensionsBuilder().buildObject("urn:oasis:names:tc:SAML:2.0:protocol", "Extensions", "samlp");
org.opensaml.xml.schema.XSAny securityLevel = new org.opensaml.xml.schema.impl.XSAnyBuilder().buildObject(new javax.xml.namespace.QName("http://mynamespaceurl", "SecurityLevel","dacs"));
extensions.getUnknownXMLObjects().add(securityLevel);
securityLevel.setTextContent("0");
org.opensaml.saml2.core.AuthnRequest authnRequest = samlutils.createAuthenticationRequest(myStepPage);
authnRequest.setExtensions(extensions);
requestMessage = samlutils.getSAMLObjectASString( authnRequest);
if(oLog.isDebugEnabled())
oLog.debug("Generated authentication request : " + requestMessage);
}
} catch(Exception e) {
errorMessage = e.getMessage();
tools.putParamValue("ErrorMessage", errorMessage);
nextBlock = "ERR";
}