public abstract class AbstractUserTokenService<E extends de.terrestris.shogun2.model.token.UserToken> extends AbstractCrudService<E>
dao| Constructor and Description |
|---|
AbstractUserTokenService() |
| Modifier and Type | Method and Description |
|---|---|
E |
findByTokenValue(String token) |
E |
findByUser(de.terrestris.shogun2.model.User user) |
protected E |
getValidTokenForUser(de.terrestris.shogun2.model.User user,
Integer expirationTimeInMinutes)
Returns a valid (i.e. non-expired)
UserToken for the given user. |
protected void |
validateToken(de.terrestris.shogun2.model.token.UserToken userToken)
If the passed token is null or expired or if there is no user associated
with the token, this method will throw an
Exception. |
delete, findAll, findById, loadById, saveOrUpdatepublic E findByUser(de.terrestris.shogun2.model.User user)
user - protected void validateToken(de.terrestris.shogun2.model.token.UserToken userToken)
throws Exception
Exception.userToken - Exception - if the token is not valid (e.g. because it is expired)protected E getValidTokenForUser(de.terrestris.shogun2.model.User user, Integer expirationTimeInMinutes) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
UserToken for the given user.
If the user already owns a valid token, it will be returned. If the user
has an invalid/expired token, it will be deleted and a new one will be
generated and returned by this method.
An expiration time in minutes can also be passed. If this value is null,
the default value will be used.user - The user that needs a token.expirationTimeInMinutes - The expiration time in minutes. If null, the default value
will be used.SecurityExceptionNoSuchMethodExceptionInvocationTargetExceptionIllegalArgumentExceptionIllegalAccessExceptionInstantiationExceptionCopyright © 2016 terrestris GmbH & Co. KG. All rights reserved.