Class STRParserUtil


  • public final class STRParserUtil
    extends Object
    Some utilities for the STRParsers.
    • Method Detail

      • getAssertionFromKeyIdentifier

        public static org.apache.wss4j.common.saml.SamlAssertionWrapper getAssertionFromKeyIdentifier​(org.apache.wss4j.common.token.SecurityTokenReference secRef,
                                                                                                      Element strElement,
                                                                                                      RequestData request)
                                                                                               throws org.apache.wss4j.common.ext.WSSecurityException
        Get an SamlAssertionWrapper object from parsing a SecurityTokenReference that uses a KeyIdentifier that points to a SAML Assertion.
        Parameters:
        secRef - the SecurityTokenReference to the SAML Assertion
        strElement - The SecurityTokenReference DOM element
        request - The RequestData instance used to obtain configuration
        Returns:
        an SamlAssertionWrapper object
        Throws:
        org.apache.wss4j.common.ext.WSSecurityException
      • checkBinarySecurityBSPCompliance

        public static void checkBinarySecurityBSPCompliance​(org.apache.wss4j.common.token.SecurityTokenReference secRef,
                                                            org.apache.wss4j.common.token.BinarySecurity token,
                                                            org.apache.wss4j.common.bsp.BSPEnforcer bspEnforcer)
                                                     throws org.apache.wss4j.common.ext.WSSecurityException
        Check that the BinarySecurityToken referenced by the SecurityTokenReference argument is BSP compliant.
        Parameters:
        secRef - The SecurityTokenReference to the BinarySecurityToken
        token - The BinarySecurityToken
        bspEnforcer - a BSPEnforcer instance to enforce BSP rules
        Throws:
        org.apache.wss4j.common.ext.WSSecurityException
      • checkEncryptedKeyBSPCompliance

        public static void checkEncryptedKeyBSPCompliance​(org.apache.wss4j.common.token.SecurityTokenReference secRef,
                                                          org.apache.wss4j.common.bsp.BSPEnforcer bspEnforcer)
                                                   throws org.apache.wss4j.common.ext.WSSecurityException
        Check that the EncryptedKey referenced by the SecurityTokenReference argument is BSP compliant.
        Parameters:
        secRef - The SecurityTokenReference to the BinarySecurityToken
        bspEnforcer - a BSPEnforcer instance to enforce BSP rules
        Throws:
        org.apache.wss4j.common.ext.WSSecurityException
      • checkSamlTokenBSPCompliance

        public static void checkSamlTokenBSPCompliance​(org.apache.wss4j.common.token.SecurityTokenReference secRef,
                                                       org.apache.wss4j.common.saml.SamlAssertionWrapper samlAssertion,
                                                       org.apache.wss4j.common.bsp.BSPEnforcer bspEnforcer)
                                                throws org.apache.wss4j.common.ext.WSSecurityException
        Check that the SAML token referenced by the SecurityTokenReference argument is BSP compliant.
        Parameters:
        secRef - The SecurityTokenReference to the SAML token
        samlAssertion - The SAML Token SamlAssertionWrapper object
        bspEnforcer - a BSPEnforcer instance to enforce BSP rules
        Throws:
        org.apache.wss4j.common.ext.WSSecurityException
      • checkUsernameTokenBSPCompliance

        public static void checkUsernameTokenBSPCompliance​(org.apache.wss4j.common.token.SecurityTokenReference secRef,
                                                           org.apache.wss4j.common.bsp.BSPEnforcer bspEnforcer)
                                                    throws org.apache.wss4j.common.ext.WSSecurityException
        Check that the Username token referenced by the SecurityTokenReference argument is BSP compliant.
        Parameters:
        secRef - The SecurityTokenReference to the Username token
        bspEnforcer - a BSPEnforcer instance to enforce BSP rules
        Throws:
        org.apache.wss4j.common.ext.WSSecurityException
      • getSecretKeyFromToken

        public static byte[] getSecretKeyFromToken​(String id,
                                                   String type,
                                                   int identifier,
                                                   RequestData data)
                                            throws org.apache.wss4j.common.ext.WSSecurityException
        Get the Secret Key from a CallbackHandler
        Parameters:
        id - The id of the element
        type - The type of the element (may be null)
        identifier - The WSPasswordCallback usage identifier
        Returns:
        A Secret Key
        Throws:
        org.apache.wss4j.common.ext.WSSecurityException
      • getTokenElement

        public static Element getTokenElement​(Document doc,
                                              WSDocInfo docInfo,
                                              CallbackHandler cb,
                                              String uri,
                                              String valueType)
                                       throws org.apache.wss4j.common.ext.WSSecurityException
        Throws:
        org.apache.wss4j.common.ext.WSSecurityException
      • findUnprocessedTokenElement

        public static Element findUnprocessedTokenElement​(Document doc,
                                                          WSDocInfo docInfo,
                                                          String uri,
                                                          String type)
                                                   throws org.apache.wss4j.common.ext.WSSecurityException
        Find a token that has not been processed already - in other words, it searches for the element, rather than trying to access previous results to find the element
        Parameters:
        doc - Parent Document
        docInfo - WSDocInfo instance
        uri - URI of the element
        type - Type of the element
        Returns:
        A DOM element
        Throws:
        org.apache.wss4j.common.ext.WSSecurityException
      • findProcessedTokenElement

        public static Element findProcessedTokenElement​(Document doc,
                                                        WSDocInfo docInfo,
                                                        CallbackHandler cb,
                                                        String uri,
                                                        String type)
                                                 throws org.apache.wss4j.common.ext.WSSecurityException
        Find a token that has been processed already - in other words, it access previous results to find the element, rather than conducting a general search
        Parameters:
        doc - Parent Document
        docInfo - WSDocInfo instance
        cb - CallbackHandler instance
        uri - URI of the element
        type - Type of the element
        Returns:
        A DOM element
        Throws:
        org.apache.wss4j.common.ext.WSSecurityException