public abstract class AbstractUserTokenService<E extends UserToken,D extends AbstractUserTokenDao<E>> extends AbstractTokenService<E,D>
permissionCollectionServicedao, logger| Modifier | Constructor and Description |
|---|---|
|
AbstractUserTokenService()
Default constructor, which calls the type-constructor
|
protected |
AbstractUserTokenService(Class<E> entityClass)
Constructor that sets the concrete entity class for the service.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract E |
buildConcreteInstance(User user,
Integer expirationTimeInMinutes)
Has to be implemented by subclasses to return a concrete instance for the
given values.
|
E |
findByUser(User user) |
protected E |
getValidTokenForUser(User user,
Integer expirationTimeInMinutes)
Returns a valid (i.e. non-expired)
UserToken for the given user. |
void |
validateToken(E 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. |
findByTokenValueaddAndSaveGroupPermissions, addAndSaveUserPermissions, findAllUserGroupPermissionsOfUserGroup, findAllUserPermissionsOfUser, getPermissionCollectionService, removeAndSaveGroupPermissions, removeAndSaveUserPermissions, setDao, setPermissionCollectionServicedelete, findAll, findAllRestricted, findAllWhereFieldEquals, findAllWithCollectionContaining, findById, findBySimpleFilter, loadById, saveOrUpdate, updatePartialWithJsonNodegetDao, getEntityClasspublic AbstractUserTokenService()
protected abstract E buildConcreteInstance(User user, Integer expirationTimeInMinutes)
user - expirationTimeInMinutes - @Transactional(readOnly=true) public void validateToken(E userToken) throws Exception
Exception.validateToken in class AbstractTokenService<E extends UserToken,D extends AbstractUserTokenDao<E>>userToken - Exception - if the token is not valid (e.g. because it is expired)protected E getValidTokenForUser(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 © 2020 terrestris GmbH & Co. KG. All rights reserved.