Package net.i2p.i2pcontrol.security
Class SecurityManager
java.lang.Object
net.i2p.i2pcontrol.security.SecurityManager
Manage the password storing for I2PControl.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSecurityManager(I2PAppContext ctx, KeyStoreProvider ksp, ConfigurationManager conf) -
Method Summary
Modifier and TypeMethodDescriptionHash input one time with SHA-256, return Base64 encdoded string.getPasswdHash(String pwd) Hash pwd with using BCrypt with the default salt.booleanIs this password correct?booleanIs this password correct?booleanSet new password.voidvalidatePasswd(String pwd) Add a Authentication Token if the provided password is valid.voidverifyToken(String tokenID) Checks whether the AuthToken with the given ID exists and if it does whether is has expired.
-
Field Details
-
DEFAULT_AUTH_PASSWORD
- See Also:
-
-
Constructor Details
-
SecurityManager
- Parameters:
ksp- may be null (if webapp)
-
-
Method Details
-
stopTimedEvents
public void stopTimedEvents() -
getPasswdHash
Hash pwd with using BCrypt with the default salt.- Parameters:
pwd-- Returns:
- BCrypt hash of salt and input string
-
getHash
Hash input one time with SHA-256, return Base64 encdoded string.- Parameters:
string-- Returns:
- Base64 encoded string
-
isValid
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
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
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
Checks whether the AuthToken with the given ID exists and if it does whether is has expired.- Parameters:
tokenID- - The token to validate- Throws:
InvalidAuthTokenExceptionExpiredAuthTokenException
-