public class UserController<T extends IUser> extends StandardModelController<T>
Modifier and Type | Class and Description |
---|---|
class |
UserController.ResetEmailEmailer |
static class |
UserController.SessionInfo |
static class |
UserController.UserValetResult |
class |
UserController.VerifyEmailEmailer |
Modifier and Type | Field and Description |
---|---|
static String |
USER_COOKIE_NAME |
Constructor and Description |
---|
UserController() |
Modifier and Type | Method and Description |
---|---|
T |
addSessionCookieForUser(T user,
Boolean rememberMe)
Add a session cookie to the current request response for this user.
|
T |
addSessionCookieForUser(T user,
Boolean rememberMe,
T valetUser)
Add a session cookie to the current request response for this user.
|
T |
changePassword(String email,
String token,
String newPassword,
String confirmNewPassword) |
T |
changePassword(T user,
String token,
String newPassword,
String confirmNewPassword) |
boolean |
changePrimaryEmail(T user,
String newPrimaryEmail)
Change the primary email of this user to an already validated and verified
that is alaread an alias for the user id.
|
boolean |
checkCookieAndAuthorizeForRequest(StRequest request)
Checks the standard Stallion auth cookie, loads and validates the user,
and hydrates the current request Context user, and returns true.
|
T |
checkUserLoginValid(String username,
String password)
Returns a user if the login information is valid, throws a ClientException exception otherwise.
|
UserController.UserValetResult |
cookieStringToUser(String cookie) |
T |
createUser(T user) |
T |
forEmail(String email) |
T |
forUsername(String username) |
void |
hydratePassword(T user,
String password,
String passwordConfirm)
Hydrates the bycryptedPassword field, validiating the password for minimum length and matching confirmation.
|
static <Y extends IUser> |
instance() |
static void |
load() |
T |
loginUser(String username,
String password,
Boolean rememberMe)
Checks the user information represents a valid login, adds the user to the context,
and adds a cookie to the current request response.
|
void |
logoff()
Void out the authentication cookie
|
void |
logoutCurrentUser() |
String |
makeEncryptedToken(T user,
String type,
String value) |
String |
makeVerifyEmailToken(T user) |
void |
markEmailVerified(String email,
String token) |
void |
markEmailVerified(T user,
String token) |
void |
markFailed(String username)
Mark a login failure in the local cache, too many failures and the user or IP address will be locked out.
|
void |
onPreCreatePrepare(T user)
Override this to prepare the object with any default values before it is
saved to the datastore for the first time.
|
String |
readEncryptedToken(T user,
String expectedType,
String encrypted,
int expiresMinutes) |
boolean |
sendEmailVerifyEmail(String email) |
boolean |
sendEmailVerifyEmail(String email,
String returnUrl) |
boolean |
sendEmailVerifyEmail(T user) |
boolean |
sendEmailVerifyEmail(T user,
String returnUrl) |
boolean |
sendPasswordResetEmail(String email) |
boolean |
sendPasswordResetEmail(String email,
String returnUrl) |
boolean |
sendPasswordResetEmail(T user,
String returnUrl) |
String |
userToCookieString(T user,
Boolean rememberMe) |
String |
userToCookieString(T user,
Boolean rememberMe,
Long valetId) |
T |
valetLoginIfAllowed(Long userId) |
T |
valetLoginIfAllowed(String email) |
T |
valetLoginIfAllowed(T user) |
boolean |
verifyEmailVerifyToken(String email,
String encryptedToken) |
boolean |
verifyEmailVerifyToken(T user,
String encryptedToken) |
boolean |
verifyPasswordResetToken(String email,
String encryptedToken) |
boolean |
verifyPasswordResetToken(T user,
String encryptedToken) |
all, countForKey, detach, filter, filter, filterBy, filterByKey, filterChain, forId, forIdWithDeleted, forUniqueKey, getBucket, getKeyFields, getModelClass, getPersister, getReadonlyWrapper, getStash, getUniqueFields, hardDelete, init, isWritable, listForKey, newModel, newModel, newModel, onPostCreate, onPostLoadItem, onPostSave, onPreCreateValidate, onPreRead, onPreSavePrepare, onPreSaveValidate, originalForId, originalForId, postInitialize, preInitialize, reset, save, setPersister, setWritable, softDelete
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
anyOf, anyOf, find, forIdOrNotFound, forUniqueKeyOrNotFound, onPostSaveAuditTrailLog, search, update, updateValues
public static String USER_COOKIE_NAME
public UserController()
public static <Y extends IUser> UserController<Y> instance()
public static void load()
public T forUsername(String username)
public T createUser(T user)
public void hydratePassword(T user, String password, String passwordConfirm)
user
- password
- passwordConfirm
- public void onPreCreatePrepare(T user)
ModelController
onPreCreatePrepare
in interface ModelController<T extends IUser>
onPreCreatePrepare
in class StandardModelController<T extends IUser>
public boolean checkCookieAndAuthorizeForRequest(StRequest request)
request
- public void logoff()
public T loginUser(String username, String password, Boolean rememberMe)
username
- password
- rememberMe
- public T valetLoginIfAllowed(String email)
public T valetLoginIfAllowed(Long userId)
public T valetLoginIfAllowed(T user)
public void logoutCurrentUser()
public T checkUserLoginValid(String username, String password) throws ClientException
username
- password
- ClientException
public void markFailed(String username)
username
- public T addSessionCookieForUser(T user, Boolean rememberMe)
user
- rememberMe
- public T addSessionCookieForUser(T user, Boolean rememberMe, T valetUser)
user
- rememberMe
- public boolean changePrimaryEmail(T user, String newPrimaryEmail)
user
- newPrimaryEmail
- public boolean sendEmailVerifyEmail(String email)
public boolean sendEmailVerifyEmail(String email, String returnUrl)
public boolean sendEmailVerifyEmail(T user)
public boolean sendEmailVerifyEmail(T user, String returnUrl)
public String makeVerifyEmailToken(T user)
public String makeEncryptedToken(T user, String type, String value)
public String readEncryptedToken(T user, String expectedType, String encrypted, int expiresMinutes)
public boolean verifyEmailVerifyToken(String email, String encryptedToken)
public boolean verifyEmailVerifyToken(T user, String encryptedToken)
public void markEmailVerified(String email, String token)
public void markEmailVerified(T user, String token)
public boolean sendPasswordResetEmail(String email)
public boolean sendPasswordResetEmail(String email, String returnUrl)
public boolean sendPasswordResetEmail(T user, String returnUrl)
public boolean verifyPasswordResetToken(String email, String encryptedToken)
public boolean verifyPasswordResetToken(T user, String encryptedToken)
public T changePassword(String email, String token, String newPassword, String confirmNewPassword)
public T changePassword(T user, String token, String newPassword, String confirmNewPassword)
public String userToCookieString(T user, Boolean rememberMe)
public String userToCookieString(T user, Boolean rememberMe, Long valetId)
public UserController.UserValetResult cookieStringToUser(String cookie)
Copyright © 2016. All rights reserved.