Class WSSUtils


  • public class WSSUtils
    extends org.apache.xml.security.stax.ext.XMLSecurityUtils
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected WSSUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void createBinarySecurityTokenStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain, String referenceId, X509Certificate[] x509Certificates, boolean useSingleCertificate)  
      static void createBSTReferenceStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain, String referenceId, String valueType, boolean includedInMessage)  
      static void createEmbeddedKeyIdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain, org.apache.xml.security.stax.securityToken.SecurityTokenConstants.TokenType tokenType, String referenceId)  
      static void createEncryptedDataStructureForAttachments​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain)  
      static void createEncryptedKeySha1IdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain, String identifier)  
      static void createEncryptedKeySha1IdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain, Key key)  
      static void createKerberosSha1IdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain, String identifier)  
      static void createReferenceListStructureForEncryption​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain)  
      static void createSAMLKeyIdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain, org.apache.xml.security.stax.securityToken.SecurityTokenConstants.TokenType tokenType, String referenceId)  
      static void createThumbprintKeyIdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain, X509Certificate[] x509Certificates)  
      static org.apache.xml.security.stax.securityEvent.TokenSecurityEvent<? extends org.apache.xml.security.stax.securityToken.InboundSecurityToken> createTokenSecurityEvent​(org.apache.xml.security.stax.securityToken.InboundSecurityToken inboundSecurityToken, String correlationID)  
      static void createUsernameTokenReferenceStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain, String tokenId)  
      static void createX509KeyIdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain, X509Certificate[] x509Certificates)  
      static void createX509SubjectKeyIdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor, org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain, X509Certificate[] x509Certificates)  
      static void doPasswordCallback​(CallbackHandler callbackHandler, Callback callback)
      Executes the Callback handling.
      static void doSecretKeyCallback​(CallbackHandler callbackHandler, Callback callback, String id)
      Try to get the secret key from a CallbackHandler implementation
      static <T extends org.apache.xml.security.stax.securityToken.SecurityToken>
      T
      getRootToken​(T securityToken)  
      static String getSOAPMessageVersionNamespace​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent)  
      static boolean isInSecurityHeader​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent, String actorOrRole)  
      static boolean isInSecurityHeader​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent, List<QName> elementPath, String actorOrRole)  
      static boolean isInSOAPBody​(List<QName> elementPath)  
      static boolean isInSOAPBody​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent)  
      static boolean isInSOAPHeader​(List<QName> elementPath)  
      static boolean isInSOAPHeader​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent)  
      static boolean isResponsibleActorOrRole​(org.apache.xml.security.stax.ext.stax.XMLSecStartElement xmlSecStartElement, String responsibleActor)  
      static boolean isSecurityHeaderElement​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent, String actorOrRole)  
      static String pathAsString​(List<QName> path)  
      static boolean pathMatches​(List<QName> path1, List<QName> path2)  
      static boolean pathMatches​(List<QName> path1, List<QName> path2, boolean lastElementWildCard)  
      • Methods inherited from class org.apache.xml.security.stax.ext.XMLSecurityUtils

        copy, createKeyNameTokenStructure, createKeyValueTokenStructure, createKeyValueTokenStructure, createX509CertificateStructure, createX509CertificateStructure, createX509IssuerSerialStructure, createX509IssuerSerialStructure, createX509SubjectKeyIdentifierStructure, createX509SubjectNameStructure, createX509SubjectNameStructure, dropReferenceMarker, getExcC14NInclusiveNamespacePrefixes, getQNameAttribute, getQNameType, getTransformer, getXMLEventAsString, loadXMLSecuritySchemas, prepareSecretKey
    • Constructor Detail

      • WSSUtils

        protected WSSUtils()
    • Method Detail

      • doPasswordCallback

        public static void doPasswordCallback​(CallbackHandler callbackHandler,
                                              Callback callback)
                                       throws WSSecurityException
        Executes the Callback handling. Typically used to fetch passwords
        Parameters:
        callbackHandler -
        callback -
        Throws:
        WSSecurityException - if the callback couldn't be executed
      • getSOAPMessageVersionNamespace

        public static String getSOAPMessageVersionNamespace​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent)
      • isInSOAPHeader

        public static boolean isInSOAPHeader​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent)
      • isInSOAPHeader

        public static boolean isInSOAPHeader​(List<QName> elementPath)
      • isInSOAPBody

        public static boolean isInSOAPBody​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent)
      • isInSOAPBody

        public static boolean isInSOAPBody​(List<QName> elementPath)
      • isInSecurityHeader

        public static boolean isInSecurityHeader​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent,
                                                 String actorOrRole)
      • isInSecurityHeader

        public static boolean isInSecurityHeader​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent,
                                                 List<QName> elementPath,
                                                 String actorOrRole)
      • isSecurityHeaderElement

        public static boolean isSecurityHeaderElement​(org.apache.xml.security.stax.ext.stax.XMLSecEvent xmlSecEvent,
                                                      String actorOrRole)
      • isResponsibleActorOrRole

        public static boolean isResponsibleActorOrRole​(org.apache.xml.security.stax.ext.stax.XMLSecStartElement xmlSecStartElement,
                                                       String responsibleActor)
      • createBinarySecurityTokenStructure

        public static void createBinarySecurityTokenStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                              org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain,
                                                              String referenceId,
                                                              X509Certificate[] x509Certificates,
                                                              boolean useSingleCertificate)
                                                       throws XMLStreamException,
                                                              org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createX509SubjectKeyIdentifierStructure

        public static void createX509SubjectKeyIdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                                   org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain,
                                                                   X509Certificate[] x509Certificates)
                                                            throws org.apache.xml.security.exceptions.XMLSecurityException,
                                                                   XMLStreamException
        Throws:
        org.apache.xml.security.exceptions.XMLSecurityException
        XMLStreamException
      • createX509KeyIdentifierStructure

        public static void createX509KeyIdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                            org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain,
                                                            X509Certificate[] x509Certificates)
                                                     throws XMLStreamException,
                                                            org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createThumbprintKeyIdentifierStructure

        public static void createThumbprintKeyIdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                                  org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain,
                                                                  X509Certificate[] x509Certificates)
                                                           throws XMLStreamException,
                                                                  org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createEncryptedKeySha1IdentifierStructure

        public static void createEncryptedKeySha1IdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                                     org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain,
                                                                     Key key)
                                                              throws XMLStreamException,
                                                                     org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createEncryptedKeySha1IdentifierStructure

        public static void createEncryptedKeySha1IdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                                     org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain,
                                                                     String identifier)
                                                              throws XMLStreamException,
                                                                     org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createKerberosSha1IdentifierStructure

        public static void createKerberosSha1IdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                                 org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain,
                                                                 String identifier)
                                                          throws XMLStreamException,
                                                                 org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createBSTReferenceStructure

        public static void createBSTReferenceStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                       org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain,
                                                       String referenceId,
                                                       String valueType,
                                                       boolean includedInMessage)
                                                throws XMLStreamException,
                                                       org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createEmbeddedKeyIdentifierStructure

        public static void createEmbeddedKeyIdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                                org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain,
                                                                org.apache.xml.security.stax.securityToken.SecurityTokenConstants.TokenType tokenType,
                                                                String referenceId)
                                                         throws XMLStreamException,
                                                                org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createSAMLKeyIdentifierStructure

        public static void createSAMLKeyIdentifierStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                            org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain,
                                                            org.apache.xml.security.stax.securityToken.SecurityTokenConstants.TokenType tokenType,
                                                            String referenceId)
                                                     throws XMLStreamException,
                                                            org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createUsernameTokenReferenceStructure

        public static void createUsernameTokenReferenceStructure​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                                 org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain,
                                                                 String tokenId)
                                                          throws XMLStreamException,
                                                                 org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createReferenceListStructureForEncryption

        public static void createReferenceListStructureForEncryption​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                                     org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain)
                                                              throws XMLStreamException,
                                                                     org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createEncryptedDataStructureForAttachments

        public static void createEncryptedDataStructureForAttachments​(org.apache.xml.security.stax.ext.AbstractOutputProcessor abstractOutputProcessor,
                                                                      org.apache.xml.security.stax.ext.OutputProcessorChain outputProcessorChain)
                                                               throws XMLStreamException,
                                                                      org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        XMLStreamException
        org.apache.xml.security.exceptions.XMLSecurityException
      • createTokenSecurityEvent

        public static org.apache.xml.security.stax.securityEvent.TokenSecurityEvent<? extends org.apache.xml.security.stax.securityToken.InboundSecurityToken> createTokenSecurityEvent​(org.apache.xml.security.stax.securityToken.InboundSecurityToken inboundSecurityToken,
                                                                                                                                                                                        String correlationID)
                                                                                                                                                                                 throws WSSecurityException
        Throws:
        WSSecurityException
      • pathMatches

        public static boolean pathMatches​(List<QName> path1,
                                          List<QName> path2)
      • pathMatches

        public static boolean pathMatches​(List<QName> path1,
                                          List<QName> path2,
                                          boolean lastElementWildCard)
      • getRootToken

        public static <T extends org.apache.xml.security.stax.securityToken.SecurityToken> T getRootToken​(T securityToken)
                                                                                                   throws org.apache.xml.security.exceptions.XMLSecurityException
        Throws:
        org.apache.xml.security.exceptions.XMLSecurityException