Class SaltedPasswordEncoder

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String calculateHash​(java.lang.String plain)  
      boolean check​(java.lang.String uid, java.lang.String encoded, java.lang.String plain)
      Checks if the encoded password (from the user, from the database) and the plain password (from the login screen) matches.
      java.lang.String decode​(java.lang.String encoded)
      Decode the given encoded password.
      java.lang.String encode​(java.lang.String uid, java.lang.String password)
      This implementation will build a string with the following pattern
      ::::
      The value for SYSTEM_SPECIFC_SALT will be generated by getSystemSpecificSalt()
      The Value for USER_SPECIFIC_SALT will be generated by generateUserSpecificSalt(String)
      ...
      protected java.lang.String generateUserSpecificSalt​(java.lang.String uid)
      This implementation will still return the assigned user id.
      java.lang.String getAlgorithmn()  
      java.lang.String getSalt()
      Returns the configured SALT (see core-spring-xml).
      protected java.lang.String getSystemSpecificSalt()
      This implementation will still return the value of the corresponding spring property
      void setAlgorithmn​(java.lang.String algorithmn)  
      void setSalt​(java.lang.String salt)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SaltedPasswordEncoder

        public SaltedPasswordEncoder()
    • Method Detail

      • calculateHash

        protected java.lang.String calculateHash​(java.lang.String plain)
      • encode

        public java.lang.String encode​(java.lang.String uid,
                                       java.lang.String password)
        This implementation will build a string with the following pattern
        ::::
        The value for SYSTEM_SPECIFC_SALT will be generated by getSystemSpecificSalt()
        The Value for USER_SPECIFIC_SALT will be generated by generateUserSpecificSalt(String)
        ... and will return the hash of this constructed string.
        Specified by:
        encode in interface PasswordEncoder
        Parameters:
        uid - the user id
        password - the user password
        Returns:
        the hashed value of the constructed string expression
        See Also:
        SaltedMD5PasswordEncoder, PlainTextPasswordEncoder
      • check

        public boolean check​(java.lang.String uid,
                             java.lang.String encoded,
                             java.lang.String plain)
        Description copied from interface: PasswordEncoder
        Checks if the encoded password (from the user, from the database) and the plain password (from the login screen) matches.
        Specified by:
        check in interface PasswordEncoder
        Parameters:
        uid - mostly the user ID and mostly not used. For MD5 used as salt.
        encoded - the encoded password
        plain - the plain text password
        Returns:
        true if they match, false otherwise.
        See Also:
        MD5PasswordEncoder
      • generateUserSpecificSalt

        protected java.lang.String generateUserSpecificSalt​(java.lang.String uid)
        This implementation will still return the assigned user id.
        Parameters:
        uid - the suer id
        Returns:
        uid the user id as assigned
      • getSystemSpecificSalt

        protected java.lang.String getSystemSpecificSalt()
        This implementation will still return the value of the corresponding spring property
        Returns:
        systemSpecificSalt the value of the corresponding spring property
      • getSalt

        public java.lang.String getSalt()
        Returns the configured SALT (see core-spring-xml).
         
                
         
        
         
        Returns:
        the configured SALT
      • setSalt

        public void setSalt​(java.lang.String salt)
      • getAlgorithmn

        public java.lang.String getAlgorithmn()
        Returns:
        the algorithmn
      • setAlgorithmn

        public void setAlgorithmn​(java.lang.String algorithmn)
        Parameters:
        algorithmn - the algorithmn to set