Class OpenSamlUtil

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

public class OpenSamlUtil extends Object
  • Field Details

  • Method Details

    • buildAssertionObject

      public static org.opensaml.saml.saml2.core.Assertion buildAssertionObject()
    • buildAssertionObject

      public static org.opensaml.saml.saml2.core.Assertion buildAssertionObject(String skinnyXmlns)
    • buildSamlObject

      public static <T> T buildSamlObject(Class<T> clazz)
    • buildSamlObject

      public static <T> T buildSamlObject(Class<T> clazz, QName elementName)
    • getMessageIssuerId

      public static String getMessageIssuerId(org.opensaml.saml.common.SAMLObject samlObject)
    • generateSecureRandomId

      public static String generateSecureRandomId()
    • samlObjectToString

      public static String samlObjectToString(org.opensaml.core.xml.XMLObject object)
    • samlObjectToString

      public static String samlObjectToString(org.opensaml.core.xml.XMLObject object, boolean secure)
    • samlObjectToString

      public static String samlObjectToString(org.opensaml.core.xml.XMLObject object, boolean secure, boolean prettyPrint)
    • domObjectToString

      public static String domObjectToString(Element element)
    • domObjectToString

      public static String domObjectToString(Element element, boolean secure, boolean prettyPrint)
    • findChildObjectByQname

      public static <T extends org.opensaml.core.xml.XMLObject> T findChildObjectByQname(List<org.opensaml.core.xml.XMLObject> childObjects, QName qName)
    • encodeSamlPostMessage

      public static void encodeSamlPostMessage(jakarta.servlet.http.HttpServletResponse httpServletResponse, org.opensaml.messaging.context.MessageContext context, org.apache.velocity.app.VelocityEngine velocityEngine, org.opensaml.saml.saml2.binding.encoding.impl.HTTPPostEncoder encoder)
    • encodeSamlRedirectMessage

      public static <T extends org.opensaml.saml.saml2.binding.encoding.impl.BaseSAML2MessageEncoder> void encodeSamlRedirectMessage(jakarta.servlet.http.HttpServletResponse httpServletResponse, org.opensaml.messaging.context.MessageContext context, T encoder)
    • encodeSamlSoapMessage

      public static void encodeSamlSoapMessage(jakarta.servlet.http.HttpServletResponse httpServletResponse, org.opensaml.messaging.context.MessageContext context)
    • configureSamlRedirectEncoder

      public static <T extends org.opensaml.saml.saml2.binding.encoding.impl.BaseSAML2MessageEncoder> T configureSamlRedirectEncoder(jakarta.servlet.http.HttpServletResponse httpServletResponse, org.opensaml.messaging.context.MessageContext context, T encoder)
    • configureSamlPostEncoder

      public static <T extends org.opensaml.saml.saml2.binding.encoding.impl.HTTPPostEncoder> T configureSamlPostEncoder(jakarta.servlet.http.HttpServletResponse httpServletResponse, org.opensaml.messaging.context.MessageContext context, org.apache.velocity.app.VelocityEngine velocityEngine, T encoder)
    • createSamlArtifactEncoder

      public static org.opensaml.saml.saml2.binding.encoding.impl.HTTPArtifactEncoder createSamlArtifactEncoder(jakarta.servlet.http.HttpServletResponse httpServletResponse, org.opensaml.messaging.context.MessageContext context, org.apache.velocity.app.VelocityEngine velocityEngine, org.opensaml.saml.common.binding.artifact.SAMLArtifactMap artifactMap)
    • createSamlSoapEncoder

      public static org.opensaml.saml.saml2.binding.encoding.impl.HTTPSOAP11Encoder createSamlSoapEncoder(jakarta.servlet.http.HttpServletResponse httpServletResponse, org.opensaml.messaging.context.MessageContext context)
    • initAndEncodeSamlArtifactMessage

      public static void initAndEncodeSamlArtifactMessage(jakarta.servlet.http.HttpServletResponse httpServletResponse, org.opensaml.messaging.context.MessageContext context, String issuerId, org.apache.velocity.app.VelocityEngine velocityEngine, ArtifactResolutionParameters artifactResolutionParameters, org.opensaml.saml.common.binding.artifact.SAMLArtifactMap artifactMap)
    • encodeSamlArtifactMessage

      public static void encodeSamlArtifactMessage(jakarta.servlet.http.HttpServletResponse httpServletResponse, org.opensaml.messaging.context.MessageContext context, org.apache.velocity.app.VelocityEngine velocityEngine, org.opensaml.saml.common.binding.artifact.SAMLArtifactMap artifactMap)
    • isSamlArtifactRequest

      public static boolean isSamlArtifactRequest(jakarta.servlet.http.HttpServletRequest httpServletRequest)
    • isSamlRedirectRequest

      public static boolean isSamlRedirectRequest(jakarta.servlet.http.HttpServletRequest httpServletRequest)
    • isSamlPostRequest

      public static boolean isSamlPostRequest(jakarta.servlet.http.HttpServletRequest httpServletRequest)
    • decodeSamlPostMessage

      public static org.opensaml.messaging.context.MessageContext decodeSamlPostMessage(jakarta.servlet.http.HttpServletRequest request)
    • decodeSamlRedirectMessage

      public static org.opensaml.messaging.context.MessageContext decodeSamlRedirectMessage(jakarta.servlet.http.HttpServletRequest request)
    • decodeSamlSoapMessage

      public static org.opensaml.messaging.context.MessageContext decodeSamlSoapMessage(jakarta.servlet.http.HttpServletRequest request)
    • decodeSamlArtifactMessage

      public static org.opensaml.messaging.context.MessageContext decodeSamlArtifactMessage(jakarta.servlet.http.HttpServletRequest request, String issuerId, ArtifactPeer peer, Optional<SignatureParameters> signatureParameters, SignatureValidationParameters signatureValidationParameters, Optional<org.apache.hc.client5.http.classic.HttpClient> httpClientOpt)
    • extractSourceIdFromArtifactMessage

      public static String extractSourceIdFromArtifactMessage(jakarta.servlet.http.HttpServletRequest request)
    • calculateArtifactSourceIdFromIssuerId

      public static String calculateArtifactSourceIdFromIssuerId(String issuerId)
    • extractSourceIdFromArtifactId

      public static String extractSourceIdFromArtifactId(String artifactId)
    • setIssuer

      public static void setIssuer(org.opensaml.messaging.context.MessageContext context, String issuer)
    • createArtifactMap

      public static org.opensaml.saml.common.binding.artifact.SAMLArtifactMap createArtifactMap()
    • createArtifactMap

      public static org.opensaml.saml.common.binding.artifact.SAMLArtifactMap createArtifactMap(Optional<org.opensaml.storage.StorageService> storageService, Duration artifactLifetime, Duration cleanupInterval)
    • setEndpoint

      public static void setEndpoint(org.opensaml.messaging.context.MessageContext context, org.opensaml.saml.saml2.metadata.Endpoint endpoint)
    • setEndpoint

      public static void setEndpoint(org.opensaml.messaging.context.MessageContext context, String idpSsoDestination)
    • getEndpoint

      public static org.opensaml.saml.saml2.metadata.Endpoint getEndpoint(org.opensaml.messaging.context.MessageContext context)
    • replaceSensitiveData

      public static String replaceSensitiveData(String xmlString)
    • replaceSensitiveData

      public static String replaceSensitiveData(String xmlString, List<String> xmlTags)
    • defaultXmlTagsToReplace

      public static List<String> defaultXmlTagsToReplace()
    • checkAssertionsLimitations

      public static void checkAssertionsLimitations(List<org.opensaml.saml.saml2.core.Assertion> assertions, List<org.opensaml.saml.saml2.core.EncryptedAssertion> encryptedAssertions, String purpose)
    • checkResponsePresent

      public static void checkResponsePresent(org.opensaml.saml.saml2.core.Response response, String purpose)
    • checkResponseLimitations

      public static void checkResponseLimitations(org.opensaml.saml.saml2.core.Response response, String purpose)
    • extractAuthnRequestContextClasses

      public static List<String> extractAuthnRequestContextClasses(org.opensaml.saml.saml2.core.AuthnRequest authnRequest, Boolean replaceInbound, Optional<List<String>> confClasses)
    • extractAuthnRequestContextClasses

      public static List<String> extractAuthnRequestContextClasses(org.opensaml.saml.saml2.core.AuthnRequest authnRequest)
    • extractAuthnRequestComparison

      public static org.opensaml.saml.saml2.core.AuthnContextComparisonTypeEnumeration extractAuthnRequestComparison(org.opensaml.saml.saml2.core.AuthnRequest authnRequest)
    • extractAuthnStatementContextClass

      public static String extractAuthnStatementContextClass(org.opensaml.saml.saml2.core.AuthnStatement authnStatement)
    • isForceAuthnRequest

      public static boolean isForceAuthnRequest(org.opensaml.saml.saml2.core.AuthnRequest authnRequest)
    • sendSamlRequest

      public static <T extends org.opensaml.saml.saml2.core.RequestAbstractType> void sendSamlRequest(org.apache.velocity.app.VelocityEngine velocityEngine, org.opensaml.saml.common.binding.artifact.SAMLArtifactMap artifactMap, SamlBinding binding, ArtifactResolutionParameters artifactResolutionParameters, T samlRequest, jakarta.servlet.http.HttpServletResponse httpServletResponse, org.opensaml.security.credential.Credential credential, String endpoint, String relayState, String destinationAlias)
    • sendSamlSoapMessage

      public static <T extends org.opensaml.saml.common.SAMLObject> void sendSamlSoapMessage(org.opensaml.messaging.context.MessageContext context, T samlObject, jakarta.servlet.http.HttpServletResponse httpServletResponse, String destinationAlias)
    • createMessageContext

      public static <T extends org.opensaml.saml.common.SAMLObject> org.opensaml.messaging.context.MessageContext createMessageContext(T samlObject, org.opensaml.security.credential.Credential credential, String endpoint, String relayState)
    • initiateArtifactBindingContext

      public static void initiateArtifactBindingContext(org.opensaml.messaging.context.MessageContext context, String issuerId, ArtifactResolutionParameters artifactResolutionParameters)
    • setSignatureParameter

      public static void setSignatureParameter(org.opensaml.messaging.context.MessageContext context, org.opensaml.security.credential.Credential credential)
    • createVelocityEngine

      public static org.apache.velocity.app.VelocityEngine createVelocityEngine(String velocityTemplatePath)
    • extractRelayStateAsSessionId

      public static String extractRelayStateAsSessionId(org.opensaml.messaging.context.MessageContext messageContext)
    • getStatusMessage

      public static String getStatusMessage(org.opensaml.saml.saml2.core.StatusResponseType response)
    • getStatusCode

      public static String getStatusCode(org.opensaml.saml.saml2.core.StatusResponseType response)
    • getNestedStatusCode

      public static String getNestedStatusCode(org.opensaml.saml.saml2.core.StatusResponseType response)
    • constructIdpScoping

      public static org.opensaml.saml.saml2.core.Scoping constructIdpScoping(String idpId)
    • extractIdpScoping

      public static String extractIdpScoping(org.opensaml.saml.saml2.core.AuthnRequest authnRequest)