Class TokenStoreUtils

java.lang.Object
org.apache.cxf.ws.security.tokenstore.TokenStoreUtils

public final class TokenStoreUtils extends Object
Some common functionality
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    getCacheKey(org.apache.wss4j.common.saml.SamlAssertionWrapper assertion)
    Get a cache key for a signed SAML Assertion, that can be used to store and retrieve the (validated) Assertion in/from a TokenStore.
    static String
    getCacheKey(org.apache.wss4j.common.saml.SamlAssertionWrapper assertion, boolean validateSignatureProfile)
    Get a cache key for a signed SAML Assertion - see getCacheKey(SamlAssertionWrapper).
    static String
    getCacheKey(org.apache.wss4j.common.token.BinarySecurity binarySecurity)
    Get a cache key for a BinarySecurityToken, that can be used to store and retrieve the (validated) BinarySecurityToken in/from a TokenStore.
    static String
    getCacheKey(org.apache.wss4j.dom.message.token.SecurityContextToken securityContextToken)
    Get a cache key for a SecurityContextToken, that can be used to store and retrieve the (validated) SecurityContextToken in/from a TokenStore.
    static String
    getCacheKey(org.apache.wss4j.dom.message.token.UsernameToken usernameToken)
    Get a cache key for a UsernameToken, that can be used to store and retrieve the (validated) UsernameToken in/from a TokenStore.
    static TokenStore
    getTokenStore(org.apache.cxf.message.Message message)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getTokenStore

      public static TokenStore getTokenStore(org.apache.cxf.message.Message message) throws TokenStoreException
      Throws:
      TokenStoreException
    • getCacheKey

      public static String getCacheKey(org.apache.wss4j.common.saml.SamlAssertionWrapper assertion) throws org.apache.wss4j.common.ext.WSSecurityException
      Get a cache key for a signed SAML Assertion, that can be used to store and retrieve the (validated) Assertion in/from a TokenStore. The key is a SHA-256 digest over the canonicalized SignedInfo (which binds the signed content of the Assertion) and the SignatureValue. It returns null if the Assertion is not signed, or if the signature does not conform to the SAML signature profile (in which case the signature might not cover the Assertion itself, and so the Assertion must not be cached). This method must be used to look up a received Assertion in a TokenStore.
      Throws:
      org.apache.wss4j.common.ext.WSSecurityException
    • getCacheKey

      public static String getCacheKey(org.apache.wss4j.common.saml.SamlAssertionWrapper assertion, boolean validateSignatureProfile) throws org.apache.wss4j.common.ext.WSSecurityException
      Get a cache key for a signed SAML Assertion - see getCacheKey(SamlAssertionWrapper).
      Parameters:
      validateSignatureProfile - whether to check that the signature conforms to the SAML signature profile first, returning null if it doesn't. This must be true when looking up a received Assertion. It can be false when storing an Assertion that was just signed by the STS, as its DOM Element might not be attached to a Document, which the profile validation requires.
      Throws:
      org.apache.wss4j.common.ext.WSSecurityException
    • getCacheKey

      public static String getCacheKey(org.apache.wss4j.dom.message.token.UsernameToken usernameToken) throws org.apache.wss4j.common.ext.WSSecurityException
      Get a cache key for a UsernameToken, that can be used to store and retrieve the (validated) UsernameToken in/from a TokenStore. The key is a SHA-256 digest over the UsernameToken values.
      Throws:
      org.apache.wss4j.common.ext.WSSecurityException
    • getCacheKey

      public static String getCacheKey(org.apache.wss4j.common.token.BinarySecurity binarySecurity)
      Get a cache key for a BinarySecurityToken, that can be used to store and retrieve the (validated) BinarySecurityToken in/from a TokenStore. The key is a SHA-256 digest over the token values.
    • getCacheKey

      public static String getCacheKey(org.apache.wss4j.dom.message.token.SecurityContextToken securityContextToken)
      Get a cache key for a SecurityContextToken, that can be used to store and retrieve the (validated) SecurityContextToken in/from a TokenStore. The key is a SHA-256 digest over the token identifier.