Class STRParserUtil

java.lang.Object
org.apache.wss4j.dom.str.STRParserUtil

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

    • getAssertionFromKeyIdentifier

      public static SamlAssertionWrapper getAssertionFromKeyIdentifier(SecurityTokenReference secRef, Element strElement, RequestData request) throws 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:
      WSSecurityException
    • checkBinarySecurityBSPCompliance

      public static void checkBinarySecurityBSPCompliance(SecurityTokenReference secRef, BinarySecurity token, BSPEnforcer bspEnforcer) throws 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:
      WSSecurityException
    • checkEncryptedKeyBSPCompliance

      public static void checkEncryptedKeyBSPCompliance(SecurityTokenReference secRef, BSPEnforcer bspEnforcer) throws 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:
      WSSecurityException
    • checkSamlTokenBSPCompliance

      public static void checkSamlTokenBSPCompliance(SecurityTokenReference secRef, SamlAssertionWrapper samlAssertion, BSPEnforcer bspEnforcer) throws 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:
      WSSecurityException
    • checkUsernameTokenBSPCompliance

      public static void checkUsernameTokenBSPCompliance(SecurityTokenReference secRef, BSPEnforcer bspEnforcer) throws 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:
      WSSecurityException
    • getSecretKeyFromToken

      public static byte[] getSecretKeyFromToken(String id, String type, int identifier, RequestData data) throws 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:
      WSSecurityException
    • getTokenElement

      public static Element getTokenElement(Document doc, WSDocInfo docInfo, CallbackHandler cb, String uri, String valueType) throws WSSecurityException
      Throws:
      WSSecurityException
    • findUnprocessedTokenElement

      public static Element findUnprocessedTokenElement(Document doc, WSDocInfo docInfo, String uri, String type) throws 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:
      WSSecurityException
    • findProcessedTokenElement

      public static Element findProcessedTokenElement(Document doc, WSDocInfo docInfo, CallbackHandler cb, String uri, String type) throws 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:
      WSSecurityException