Class SamlIoUtil

java.lang.Object
swiss.trustbroker.common.saml.util.SamlIoUtil

public class SamlIoUtil extends Object
  • Field Details

  • Method Details

    • unmarshallAuthnRequest

      public static org.opensaml.saml.saml2.core.AuthnRequest unmarshallAuthnRequest(InputStream stream)
      Unmarshalls a SAML AuthnRequest from stream resource into its SAMLObject. <saml2:AuthnRequest/> should result in org.opensaml.saml.saml2.core.impl.AssertionImpl
    • unmarshallResponse

      public static org.opensaml.saml.saml2.core.Response unmarshallResponse(InputStream stream)
      Unmarshalls a SAML Response from stream resource into its SAMLObject. <saml2:Response/> results in org.opensaml.saml.saml2.core.impl.ResponseImpl
    • unmarshallAssertion

      public static org.opensaml.saml.saml2.core.Assertion unmarshallAssertion(InputStream stream)
      Unmarshalls a SAML Assertion from stream resource into its SAMLObject. <saml2:Assertion/> results in org.opensaml.saml.saml2.core.impl.AssertionImpl
    • unmarshallRequestSecurityToken

      public static org.opensaml.soap.wstrust.RequestSecurityToken unmarshallRequestSecurityToken(InputStream stream)
      Unmarshalls a WSTrust token request from stream resource into its SAMLObject. <saml2:Assertion/> results in org.opensaml.soap.wstrust.impl.RequestSecurityTokenImpl
    • unmarshallAuthnRequest

      public static org.opensaml.saml.saml2.core.AuthnRequest unmarshallAuthnRequest(String mappingFile)
    • unmarshallLogoutRequest

      public static org.opensaml.saml.saml2.core.LogoutRequest unmarshallLogoutRequest(String mappingFile)
    • unmarshallRequest

      public static org.opensaml.saml.saml2.core.RequestAbstractType unmarshallRequest(String mappingFile)
    • unmarshallResponse

      public static org.opensaml.saml.saml2.core.Response unmarshallResponse(String mappingFile)
    • unmarshallLogoutResponse

      public static org.opensaml.saml.saml2.core.LogoutResponse unmarshallLogoutResponse(String mappingFile)
    • unmarshallStatusResponse

      public static org.opensaml.saml.saml2.core.StatusResponseType unmarshallStatusResponse(String mappingFile)
    • unmarshallXmlFile

      public static <T> T unmarshallXmlFile(String mappingFile, InputStream stream)
    • getXmlObjectFromFileOrClassPath

      public static org.opensaml.core.xml.XMLObject getXmlObjectFromFileOrClassPath(String fileName)
    • getInputStreamFromFile

      public static InputStream getInputStreamFromFile(String fileName)
    • getDomElementFromStream

      public static Element getDomElementFromStream(InputStream stream, String sourceName)
    • getXmlObjectFromStream

      public static org.opensaml.core.xml.XMLObject getXmlObjectFromStream(InputStream stream, String sourceName)
    • decodeSamlPostData

      public static org.opensaml.core.xml.XMLObject decodeSamlPostData(String samlPostData) throws IOException
      Throws:
      IOException
    • decodeSamlPostDataToString

      public static String decodeSamlPostDataToString(String samlPostData, boolean prettyPrint) throws IOException
      Throws:
      IOException
    • decodeSamlRedirectDataToString

      public static String decodeSamlRedirectDataToString(String sankRedirectData, boolean prettyPrint)
    • encodeSamlRedirectData

      public static String encodeSamlRedirectData(org.opensaml.saml.common.SAMLObject message)
    • decodeSamlRedirectData

      public static org.opensaml.core.xml.XMLObject decodeSamlRedirectData(String message)
    • generateRedirectUrl

      public static String generateRedirectUrl(org.opensaml.messaging.context.MessageContext messageContext, String message, String url) throws org.opensaml.messaging.encoder.MessageEncodingException
      Throws:
      org.opensaml.messaging.encoder.MessageEncodingException
    • encodeSamlArtifactData

      public static String encodeSamlArtifactData(org.apache.velocity.app.VelocityEngine velocityEngine, org.opensaml.saml.common.binding.artifact.SAMLArtifactMap artifactMap, org.opensaml.saml.saml2.core.RequestAbstractType message, ArtifactResolutionParameters artifactResolutionParameters, String relayState)
    • encodeSamlArtifactData

      public static String encodeSamlArtifactData(org.apache.velocity.app.VelocityEngine velocityEngine, org.opensaml.saml.common.binding.artifact.SAMLArtifactMap artifactMap, org.opensaml.saml.saml2.core.StatusResponseType message, ArtifactResolutionParameters artifactResolutionParameters, String relayState)
    • xmlObjectToString

      public static String xmlObjectToString(org.opensaml.core.xml.XMLObject xmlObject, boolean prettyPrint)
    • xmlObjectToString

      public static String xmlObjectToString(org.opensaml.core.xml.XMLObject xmlObject)
    • writeXmlObjectToSteam

      public static void writeXmlObjectToSteam(org.opensaml.core.xml.XMLObject xmlObject, OutputStream out)
    • getXmlObjectFromString

      public static org.opensaml.core.xml.XMLObject getXmlObjectFromString(String data)
    • getXmlObjectFromString

      public static <T extends org.opensaml.core.xml.XMLObject> T getXmlObjectFromString(Class<? extends T> expected, String data, String sourceName)
    • marshalXmlObjectToString

      public static <T extends org.opensaml.core.xml.XMLObject> String marshalXmlObjectToString(T xmlObject)
    • marshalXmlObject

      public static <T extends org.opensaml.core.xml.XMLObject> String marshalXmlObject(T xmlObject)
    • marshalXmlObjectToBytes

      public static <T extends org.opensaml.core.xml.XMLObject> byte[] marshalXmlObjectToBytes(T xmlObject)
    • getSamlPostDataFromHttpProtocol

      public static String getSamlPostDataFromHttpProtocol(jakarta.servlet.http.HttpServletRequest request, boolean pretty)
    • getSamlRedirectDataFromHttpProtocol

      public static String getSamlRedirectDataFromHttpProtocol(jakarta.servlet.http.HttpServletRequest request, boolean pretty)
    • getSamlArtifactDataFromHttpProtocol

      public static String getSamlArtifactDataFromHttpProtocol(jakarta.servlet.http.HttpServletRequest request)
    • getSamlDataFromHttpProtocol

      public static String getSamlDataFromHttpProtocol(jakarta.servlet.http.HttpServletRequest request)
    • buildSamlRedirectQueryString

      public static String buildSamlRedirectQueryString(String sigAlg, boolean request, String encodedSamlMessage, String relayState, String signature)
    • buildSignedSamlRedirectQueryString

      public static String buildSignedSamlRedirectQueryString(org.opensaml.saml.common.SAMLObject message, org.opensaml.security.credential.Credential credential, String sigAlg, String relayState)
    • getSamlRedirectSignatureAlgorithmWithDefault

      public static String getSamlRedirectSignatureAlgorithmWithDefault(String sigAlg)
    • buildEncodedSamlRedirectSignature

      public static String buildEncodedSamlRedirectSignature(org.opensaml.saml.common.SAMLObject message, org.opensaml.security.credential.Credential credential, String sigAlg, String relayState, String encodedSamlMessage)
    • overrideUnmarshaller

      public static void overrideUnmarshaller(QName qname, org.opensaml.core.xml.io.Unmarshaller unmarshaller)
    • getAssertionFromSubjectToken

      public static org.opensaml.saml.saml2.core.Assertion getAssertionFromSubjectToken(String subjectToken)