Package org.apache.wss4j.dom.str
Class STRParserUtil
- java.lang.Object
-
- org.apache.wss4j.dom.str.STRParserUtil
-
public final class STRParserUtil extends Object
Some utilities for the STRParsers.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkBinarySecurityBSPCompliance(SecurityTokenReference secRef, BinarySecurity token, BSPEnforcer bspEnforcer)
Check that the BinarySecurityToken referenced by the SecurityTokenReference argument is BSP compliant.static void
checkEncryptedKeyBSPCompliance(SecurityTokenReference secRef, BSPEnforcer bspEnforcer)
Check that the EncryptedKey referenced by the SecurityTokenReference argument is BSP compliant.static void
checkSamlTokenBSPCompliance(SecurityTokenReference secRef, SamlAssertionWrapper samlAssertion, BSPEnforcer bspEnforcer)
Check that the SAML token referenced by the SecurityTokenReference argument is BSP compliant.static void
checkUsernameTokenBSPCompliance(SecurityTokenReference secRef, BSPEnforcer bspEnforcer)
Check that the Username token referenced by the SecurityTokenReference argument is BSP compliant.static Element
findProcessedTokenElement(Document doc, WSDocInfo docInfo, CallbackHandler cb, String uri, String type)
Find a token that has been processed already - in other words, it access previous results to find the element, rather than conducting a general searchstatic Element
findUnprocessedTokenElement(Document doc, WSDocInfo docInfo, CallbackHandler cb, String uri, String type)
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 elementstatic SamlAssertionWrapper
getAssertionFromKeyIdentifier(SecurityTokenReference secRef, Element strElement, RequestData request)
Get an SamlAssertionWrapper object from parsing a SecurityTokenReference that uses a KeyIdentifier that points to a SAML Assertion.static byte[]
getSecretKeyFromToken(String id, String type, int identifier, RequestData data)
Get the Secret Key from a CallbackHandlerstatic Element
getTokenElement(Document doc, WSDocInfo docInfo, CallbackHandler cb, String uri, String valueType)
-
-
-
Method Detail
-
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 AssertionstrElement
- The SecurityTokenReference DOM elementrequest
- 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 BinarySecurityTokentoken
- The BinarySecurityTokenbspEnforcer
- 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 BinarySecurityTokenbspEnforcer
- 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 tokensamlAssertion
- The SAML Token SamlAssertionWrapper objectbspEnforcer
- 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 tokenbspEnforcer
- 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 elementtype
- 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, CallbackHandler cb, 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 DocumentdocInfo
- WSDocInfo instancecb
- CallbackHandler instanceuri
- URI of the elementtype
- 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 DocumentdocInfo
- WSDocInfo instancecb
- CallbackHandler instanceuri
- URI of the elementtype
- Type of the element- Returns:
- A DOM element
- Throws:
WSSecurityException
-
-