Class SAML2FailoverUtils


  • public class SAML2FailoverUtils
    extends Object
    Provides helper methods specifically around using SAML2 Failover and the SAML2 Token Repository. Users of these methods much ensure that SAML2 Failover is enabled by checking the result of the isSAML2FailoverEnabled() call before accessing the token repository.
    • Method Detail

      • isSAML2FailoverEnabled

        public static boolean isSAML2FailoverEnabled()
        Checks whether SAML2 failover is enabled.
        Returns:
        true if SAML2 failover is enabled otherwise false.
      • saveSAML2TokenWithoutSecondaryKey

        public static void saveSAML2TokenWithoutSecondaryKey​(String primaryKey,
                                                             Object samlObj,
                                                             long expirationTime)
                                                      throws SAML2TokenRepositoryException
        Helper method for accessing the SAML2 Token Repository, should only be used when SAML2 failover is enabled.
        Parameters:
        primaryKey - The primary key of SAML2 object to save
        samlObj - The SAML2 object to save
        expirationTime - Expiration time in seconds from epoch.
        Throws:
        SAML2TokenRepositoryException - if there was a problem accessing the SAML2 Token Repository
      • saveSAML2Token

        public static void saveSAML2Token​(String primaryKey,
                                          String secondaryKey,
                                          Object samlObj,
                                          long expirationTime)
                                   throws SAML2TokenRepositoryException
        Helper method for accessing the SAML2 Token Repository, should only be used when SAML2 failover is enabled.
        Parameters:
        primaryKey - The primary key of the SAML2 object to save
        secondaryKey - Secondary key, can be null
        samlObj - The SAML2 object to save
        expirationTime - Expiration time in seconds from epoch.
        Throws:
        SAML2TokenRepositoryException - if there was a problem accessing the SAML2 Token Repository
      • retrieveSAML2Token

        public static Object retrieveSAML2Token​(String primaryKey)
                                         throws SAML2TokenRepositoryException
        Helper method for accessing the SAML2 Token Repository, should only be used when SAML2 failover is enabled.
        Parameters:
        primaryKey - The primary key of SAML2 object to retrieve
        Returns:
        An object representing the SAML2 object put into the repository using the key or null if not found.
        Throws:
        SAML2TokenRepositoryException - if there was a problem accessing the SAML2 Token Repository
      • retrieveSAML2TokensWithSecondaryKey

        public static List retrieveSAML2TokensWithSecondaryKey​(String secondaryKey)
                                                        throws SAML2TokenRepositoryException
        Helper method for accessing the SAML2 Token Repository, should only be used when SAML2 failover is enabled.
        Parameters:
        secondaryKey - Secondary key to use when searching for matching tokens
        Returns:
        A non null, but possibly empty collection of SAML2 objects.
        Throws:
        SAML2TokenRepositoryException - if there was a problem accessing the SAML2 Token Repository
      • deleteSAML2Token

        public static void deleteSAML2Token​(String primaryKey)
                                     throws SAML2TokenRepositoryException
        Helper method for accessing the SAML2 Token Repository, should only be used when SAML2 failover is enabled.
        Parameters:
        primaryKey - The primary key of SAML2 object to delete
        Throws:
        SAML2TokenRepositoryException - if there was a problem accessing the SAML2 Token Repository