public class SecurityManager extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_AUTH_PASSWORD |
Constructor and Description |
---|
SecurityManager(I2PAppContext ctx,
KeyStoreProvider ksp,
ConfigurationManager conf) |
Modifier and Type | Method and Description |
---|---|
String |
getHash(String string)
Hash input one time with SHA-256, return Base64 encdoded string.
|
String |
getPasswdHash(String pwd)
Hash pwd with using BCrypt with the default salt.
|
boolean |
isDefaultPasswordValid()
Is this password correct?
|
boolean |
isValid(String pwd)
Is this password correct?
|
boolean |
setPasswd(String newPasswd)
Set new password.
|
void |
stopTimedEvents() |
AuthToken |
validatePasswd(String pwd)
Add a Authentication Token if the provided password is valid.
|
void |
verifyToken(String tokenID)
Checks whether the AuthToken with the given ID exists and if it does whether is has expired.
|
public static final String DEFAULT_AUTH_PASSWORD
public SecurityManager(I2PAppContext ctx, KeyStoreProvider ksp, ConfigurationManager conf)
ksp
- may be null (if webapp)public void stopTimedEvents()
public String getPasswdHash(String pwd)
pwd
- public String getHash(String string)
string
- public boolean isValid(String pwd)
public boolean isDefaultPasswordValid()
public AuthToken validatePasswd(String pwd)
public boolean setPasswd(String newPasswd)
newPasswd
- public void verifyToken(String tokenID) throws InvalidAuthTokenException, ExpiredAuthTokenException
tokenID
- - The token to validateInvalidAuthTokenException
ExpiredAuthTokenException