public class PasswordUtil extends Object
AdminImpl
SecuritySystem
,
AdminImpl
Modifier and Type | Class and Description |
---|---|
static class |
PasswordUtil.METHOD |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ENCODING
The default encoding for converting plain text passwords to byte arrays
(UTF-8)
|
Constructor and Description |
---|
PasswordUtil(ome.util.SqlAction sql) |
PasswordUtil(ome.util.SqlAction sql,
boolean passwordRequired) |
PasswordUtil(ome.util.SqlAction sql,
boolean passwordRequired,
Charset encoding) |
PasswordUtil(ome.util.SqlAction sql,
Charset encoding) |
PasswordUtil(ome.util.SqlAction sql,
Roles roles,
boolean passwordRequired) |
PasswordUtil(ome.util.SqlAction sql,
Roles roles,
boolean passwordRequired,
Charset encoding) |
Modifier and Type | Method and Description |
---|---|
void |
changeUserPasswordById(Long id,
String password)
Calls {@link #changeUserPasswordById(Long, String, boolean) with
"false" as the value of the salt argument in order to provide backwards
compatibility.
|
void |
changeUserPasswordById(Long id,
String password,
PasswordUtil.METHOD meth)
Calls either
preparePassword(String) or
prepareSaltedPassword(Long, String) and passes the resulting
value to SqlAction.setUserPassword(Long, String) . |
String |
generateRandomPasswd() |
boolean |
getDnById(Long id) |
String |
getUserPasswordHash(Long id) |
boolean |
isPasswordRequired(Long id)
Returns a boolean based on the supplied user ID and system property
setting.
|
static void |
main(String[] args)
Main method which takes exactly one argument, passes it to
preparePassword(String) and prints the results on
System.out . |
protected String |
passwordDigest(Long userId,
String clearText,
boolean salt) |
String |
passwordDigest(String clearText)
Creates an MD5 hash of the given clear text and base64 encodes it.
|
protected String |
preparePassword(Long userId,
String newPassword,
boolean salt) |
String |
preparePassword(String newPassword) |
String |
prepareSaltedPassword(Long userId,
String newPassword) |
String |
saltedPasswordDigest(Long userId,
String clearText)
Creates an MD5 hash of the given clear text and base64 encodes it.
|
List<String> |
userGroups(String name) |
Long |
userId(String name)
Get the user's ID
|
String |
userName(long id)
Get the user's name
|
public static final String DEFAULT_ENCODING
public PasswordUtil(ome.util.SqlAction sql)
public PasswordUtil(ome.util.SqlAction sql, boolean passwordRequired)
public PasswordUtil(ome.util.SqlAction sql, Charset encoding)
public PasswordUtil(ome.util.SqlAction sql, boolean passwordRequired, Charset encoding)
public PasswordUtil(ome.util.SqlAction sql, Roles roles, boolean passwordRequired)
public static void main(String[] args)
preparePassword(String)
and prints the results on
System.out
. This is used by the build system to define the
"@ROOTPASS@" placeholder in data.sql.public String generateRandomPasswd()
public boolean getDnById(Long id)
public void changeUserPasswordById(Long id, String password)
public void changeUserPasswordById(Long id, String password, PasswordUtil.METHOD meth)
preparePassword(String)
or
prepareSaltedPassword(Long, String)
and passes the resulting
value to SqlAction.setUserPassword(Long, String)
.
An InternalException
is thrown if the modification is not
successful, which should only occur if the user has been deleted.public Long userId(String name)
name
- the user's namenull
if they cannot be foundpublic String userName(long id)
id
- the user's IDnull
if they cannot be foundpublic String passwordDigest(String clearText)
public String saltedPasswordDigest(Long userId, String clearText)
public boolean isPasswordRequired(Long id)
false
. In all other cases
this returns true
.id
- The user ID.true
or false
Version: 5.1.2-ice35-b45
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.