Class SecurityManager

java.lang.Object
net.i2p.i2pcontrol.security.SecurityManager

public class SecurityManager extends Object
Manage the password storing for I2PControl.
  • Field Details

  • Constructor Details

  • Method Details

    • stopTimedEvents

      public void stopTimedEvents()
    • getPasswdHash

      public String getPasswdHash(String pwd)
      Hash pwd with using BCrypt with the default salt.
      Parameters:
      pwd -
      Returns:
      BCrypt hash of salt and input string
    • getHash

      public String getHash(String string)
      Hash input one time with SHA-256, return Base64 encdoded string.
      Parameters:
      string -
      Returns:
      Base64 encoded string
    • isValid

      public boolean isValid(String pwd)
      Is this password correct?
      Returns:
      true if password is valid.
      Since:
      0.12
    • isDefaultPasswordValid

      public boolean isDefaultPasswordValid()
      Is this password correct?
      Returns:
      true if password is valid.
      Since:
      0.12
    • validatePasswd

      public AuthToken validatePasswd(String pwd)
      Add a Authentication Token if the provided password is valid. The token will be valid for one day.
      Returns:
      AuthToken if password is valid. If password is invalid null will be returned.
    • setPasswd

      public boolean setPasswd(String newPasswd)
      Set new password. Old tokens will NOT remain valid, to encourage the new password being tested.
      Parameters:
      newPasswd -
      Returns:
      Returns true if a new password was set.
    • verifyToken

      public void verifyToken(String tokenID) throws InvalidAuthTokenException, ExpiredAuthTokenException
      Checks whether the AuthToken with the given ID exists and if it does whether is has expired.
      Parameters:
      tokenID - - The token to validate
      Throws:
      InvalidAuthTokenException
      ExpiredAuthTokenException