public class AccountHelper extends Object
| Constructor and Description |
|---|
AccountHelper() |
| Modifier and Type | Method and Description |
|---|---|
static net.enilink.komma.core.IEntity |
createUser(net.enilink.komma.core.IEntityManager em,
String username,
String emailAddress)
Creates a new user resource.
|
static net.enilink.komma.core.IEntity |
createUser(net.enilink.komma.core.IEntityManager em,
String username,
String emailAddress,
String encodedPassword)
Creates a new user resources.
|
static String |
encodePassword(String password)
Encode a password for secure storage within a persistent database,
sessions, etc.
|
static net.enilink.komma.core.IEntity |
findUser(net.enilink.komma.core.IEntityManager em,
List<net.enilink.komma.core.URI> externalIds)
Checks if a user with the given external IDs exists within the system.
|
static net.enilink.komma.core.IEntity |
findUser(net.enilink.komma.core.IEntityManager em,
String username,
String encodedPassword)
Checks if a user with the given username and password exists within the
system.
|
static List<net.enilink.komma.core.URI> |
getExternalIds(Subject subject)
Returns external IDs from the given subject.
|
static net.enilink.komma.core.URI |
getMailboxURI(String emailAddress)
Returns a URI for an email address.
|
static net.enilink.komma.core.URI |
getUserURI(String username)
Returns the user's URI for the given user name.
|
static boolean |
hasUserWithEmail(net.enilink.komma.core.IEntityManager em,
String emailAddress)
Checks if a user with the given -mail address already exists within the
system.
|
static boolean |
hasUserWithName(net.enilink.komma.core.IEntityManager em,
String username)
Checks if a user with the given username already exists within the
system.
|
static void |
linkExternalIds(net.enilink.komma.core.IEntityManager em,
net.enilink.komma.core.IReference userId,
List<net.enilink.komma.core.URI> externalIds)
Associates a user ID with one ore more external IDs.
|
public static net.enilink.komma.core.IEntity createUser(net.enilink.komma.core.IEntityManager em,
String username,
String emailAddress)
throws IllegalArgumentException
em - The entity manager to useusername - The name of the user (nickname)emailAddress - The user's email addressIllegalArgumentException - If the user with the given id already exists in the database.public static net.enilink.komma.core.IEntity createUser(net.enilink.komma.core.IEntityManager em,
String username,
String emailAddress,
String encodedPassword)
throws IllegalArgumentException
em - The entity manager to useusername - The name of the user (nickname)emailAddress - The user's email addressencodedPassword - The already encoded passwordIllegalArgumentException - If the user with the given id already exists in the database.public static String encodePassword(String password)
password - The password to encodepublic static net.enilink.komma.core.IEntity findUser(net.enilink.komma.core.IEntityManager em,
String username,
String encodedPassword)
em - The entity manager to useusername - The user's name.encodedPassword - The encoded passwordnull if the user was not
found.public static net.enilink.komma.core.IEntity findUser(net.enilink.komma.core.IEntityManager em,
List<net.enilink.komma.core.URI> externalIds)
em - The entity manager to useexternalIds - The user's external IDs.null if the user was not
found.public static List<net.enilink.komma.core.URI> getExternalIds(Subject subject)
subject - The subject with principals for external IDs.public static net.enilink.komma.core.URI getMailboxURI(String emailAddress)
emailAddress - An email addresspublic static net.enilink.komma.core.URI getUserURI(String username)
username - The user's name.public static boolean hasUserWithEmail(net.enilink.komma.core.IEntityManager em,
String emailAddress)
em - The entity manager to useemailAddress - The user's email addresstrue if a user with the given email address already
exists, else false.public static boolean hasUserWithName(net.enilink.komma.core.IEntityManager em,
String username)
em - The entity manager to useusername - The user's name.true if a user with the given name already exists,
else false.public static void linkExternalIds(net.enilink.komma.core.IEntityManager em,
net.enilink.komma.core.IReference userId,
List<net.enilink.komma.core.URI> externalIds)
em - The entity manager for storing the datauserId - The user IDexternalIds - List of external IDsCopyright © 2020 Fraunhofer IWU. All rights reserved.