Creating a SAML 2.0 Token

To generate a SAML 2.0 token, access the following URL to generate a SAML token:

http://<identity_provider_host>:<identity_provider_port>/p6ws/downloadtoken

Note: The URL should be configured as a protected resource in Oracle Access Manager. For more information about protecting P6 EPPM resources, refer to the Primavera Oracle Access Manager Configuration Guide.

After you access the URL, you will be redirected to an IdP page in which you will need to enter your username and password. Upon successfully logging in to the IdP, you will be prompted to download samlassertion.xml.

Including SAML Tokens in SOAP Requests

Use the SAML 2.0 token that you generated above in SOAP WS-Security headers.

For example:

public static Element addSAMLAssertion(WSSecurity sec, WSSOAPEnvelope wsEnvelope)

throws Exception

{

Document aDoc = wsEnvelope.getOwnerDocument();

Document samlxml = getSAMLXML();

NodeList assrtList =

samlxml.getElementsByTagNameNS(SAML2URI.ns_saml, "Assertion");

Element element = (Element)assrtList.item(0);

Node importedNode = aDoc.importNode(element, true);

sec.appendChild(importedNode);

return samlxml.getDocumentElement();

}

private static Document getSAMLXML() throws Exception

{

return parseDomContent(new FileInputStream(new File("c:\\samlassertion.xml")));

}

public static Document parseDomContent(InputStream is) throws ParserConfigurationException, SAXException, IOException

{

DocumentBuilderFactory docbf = DocumentBuilderFactory.newInstance();

docbf.setNamespaceAware(true);

DocumentBuilder docBuilder = docbf.newDocumentBuilder();

return docBuilder.parse(is);

}



Last Published Thursday, May 2, 2024