public class SAMLXmlUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatDate(java.util.Date d)
Convert a java.util.Date to the correct format for SAML e.g., yyy-mm-ddThh:min:sec:msZ
|
static java.security.PrivateKey |
getPrivateKey(java.lang.String privpem)
Convert key text to Key object
|
static java.security.PublicKey |
getPublicKey(java.lang.String pubpem)
sanitize the provided public key and load
|
static java.security.cert.X509Certificate |
getX509Certificate(java.lang.String x509pem)
Format a .pem cert
|
static java.lang.String |
outputXMLNode(org.w3c.dom.Element node)
used for debug only
|
static org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.String> |
parseRequestFields(org.w3c.dom.Document requestDoc)
Find the ID and reply URL from the request
|
static void |
signAssertion(org.w3c.dom.Element assertionTag,
org.w3c.dom.Document doc,
java.lang.String szPrivateKey,
java.lang.String szPublicKey,
java.lang.String szX509,
java.lang.String szAssertTagIDAttr)
Sign the Assertion tag in-place in the DOM Copied mainly from: https://stackoverflow.com/questions/33769655/how-to-sign-just-a-part-of-xml-file-java-xmlsignature
|
public static org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.String> parseRequestFields(org.w3c.dom.Document requestDoc)
Find the ID and reply URL from the request
requestDoc
- xml Document to parsepublic static java.lang.String formatDate(java.util.Date d)
Convert a java.util.Date to the correct format for SAML e.g., yyy-mm-ddThh:min:sec:msZ
d
- Java datepublic static java.security.cert.X509Certificate getX509Certificate(java.lang.String x509pem)
Format a .pem cert
x509pem
- formatted .pempublic static java.security.PublicKey getPublicKey(java.lang.String pubpem)
sanitize the provided public key and load
pubpem
- formatted .pempublic static java.security.PrivateKey getPrivateKey(java.lang.String privpem)
Convert key text to Key object
privpem
- formatted keypublic static void signAssertion(org.w3c.dom.Element assertionTag, org.w3c.dom.Document doc, java.lang.String szPrivateKey, java.lang.String szPublicKey, java.lang.String szX509, java.lang.String szAssertTagIDAttr)
Sign the Assertion tag in-place in the DOM Copied mainly from: https://stackoverflow.com/questions/33769655/how-to-sign-just-a-part-of-xml-file-java-xmlsignature
assertionTag
- doc
- xml document rootszPrivateKey
- private key to useszPublicKey
- public key to useszX509
- public cert to useszAssertTagIDAttr
- ID attribute of the public static java.lang.String outputXMLNode(org.w3c.dom.Element node)
used for debug only
node
- xml Element to output