Files
bflows-bandi-be/src/main/java/net/gepafin/tendermanagement/config/SamlRequestLogger.java
2024-09-23 21:37:03 -07:00

23 lines
755 B
Java

package net.gepafin.tendermanagement.config;
import org.opensaml.core.xml.io.MarshallingException;
import org.opensaml.core.xml.util.XMLObjectSupport;
import org.opensaml.saml.saml2.core.AuthnRequest;
import org.w3c.dom.Element;
import net.shibboleth.utilities.java.support.xml.SerializeSupport;
public class SamlRequestLogger {
public static String convertSAMLObjectToString(AuthnRequest authnRequest) {
try {
Element element = XMLObjectSupport.marshall(authnRequest);
return SerializeSupport.prettyPrintXML(element); // Pretty print XML using SerializeSupport
} catch (MarshallingException e) {
e.printStackTrace();
return "Error converting SAML object to XML";
}
}
}