Class EncodeAction

  • All Implemented Interfaces:
    PrivilegedAction<String>

    @SupportedAll
    public class EncodeAction
    extends Object
    implements PrivilegedAction<String>
    The class is used to perform privileged operation with AccessController.doPrivileged() when using com.iplanet.services.util.Crypt to encode passwords. Ths class implements the interface PrivilegedAction with a non-default constructor. This class should be used in order to perform the privileged operation of com.iplanet.services.util.Crypt.encode/encrypt(str).
     
     This line of code: String encStr =
     com.iplanet.services.util.Crypt.encode(str) should be replaced with: String
     encStr = (String) AccessController.doPrivileged( new EncodeAction(str)); If
     this is not done and Java security permissions check is enabled, then the
     operation will fail and return a null every time.
     
     Note: Java security permissions check for OpenAM can be enabled by
     setting the property com.sun.identity.security.checkcaller to
     true in AMConfig properties file.
     
     
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.iplanet.services.util.AMEncryption encr  
      protected boolean useSpecifiedKey  
      protected byte[] value  
    • Constructor Summary

      Constructors 
      Constructor Description
      EncodeAction​(byte[] svalue)
      Non default constructor to be used when a doPrivileged() is performed for the encryption operations.
      EncodeAction​(byte[] svalue, com.iplanet.services.util.AMEncryption encrKey)
      Non default constructor to be used when a doPrivileged() is performed.
      EncodeAction​(String svalue)
      Non default constructor to be used when a doPrivileged() is performed for the encryption operations.
      EncodeAction​(String svalue, com.iplanet.services.util.AMEncryption encrKey)
      Non default constructor to be used when a doPrivileged() is performed.
    • Field Detail

      • value

        protected byte[] value
      • useSpecifiedKey

        protected boolean useSpecifiedKey
      • encr

        protected com.iplanet.services.util.AMEncryption encr
    • Constructor Detail

      • EncodeAction

        public EncodeAction​(String svalue)
        Non default constructor to be used when a doPrivileged() is performed for the encryption operations.
        Parameters:
        svalue - Value of string to be encoded/decoded
      • EncodeAction

        public EncodeAction​(String svalue,
                            com.iplanet.services.util.AMEncryption encrKey)
        Non default constructor to be used when a doPrivileged() is performed.
        Parameters:
        svalue - Value to be encoded
        encrKey - AMEncryption Object to be used
      • EncodeAction

        public EncodeAction​(byte[] svalue)
        Non default constructor to be used when a doPrivileged() is performed for the encryption operations.
        Parameters:
        svalue - Value of bytes to be encoded/decoded
      • EncodeAction

        public EncodeAction​(byte[] svalue,
                            com.iplanet.services.util.AMEncryption encrKey)
        Non default constructor to be used when a doPrivileged() is performed.
        Parameters:
        svalue - Value to be encoded
        encrKey - AMEncryption Object to be used