Package org.molgenis.security.token
Class DataServiceTokenService
- java.lang.Object
-
- org.molgenis.security.token.DataServiceTokenService
-
- All Implemented Interfaces:
TokenService
public class DataServiceTokenService extends Object implements TokenService
TokensService implementation that uses the DataService
-
-
Constructor Summary
Constructors Constructor Description DataServiceTokenService(TokenGenerator tokenGenerator, DataService dataService, org.springframework.security.core.userdetails.UserDetailsService userDetailsService, TokenFactory tokenFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.security.core.userdetails.UserDetailsfindUserByToken(String token)Find a user by a security tokenStringgenerateAndStoreToken(String username, String description)Generates a token and associates it with a user.voidremoveToken(String token)
-
-
-
Constructor Detail
-
DataServiceTokenService
public DataServiceTokenService(TokenGenerator tokenGenerator, DataService dataService, org.springframework.security.core.userdetails.UserDetailsService userDetailsService, TokenFactory tokenFactory)
-
-
Method Detail
-
findUserByToken
@Transactional(readOnly=true) public org.springframework.security.core.userdetails.UserDetails findUserByToken(String token)
Find a user by a security token- Specified by:
findUserByTokenin interfaceTokenService- Parameters:
token- security token- Returns:
- the user or null if not found or token is expired
-
generateAndStoreToken
@Transactional public String generateAndStoreToken(String username, String description)
Generates a token and associates it with a user.Token expires in 2 hours
- Specified by:
generateAndStoreTokenin interfaceTokenService- Parameters:
username- usernamedescription- token description- Returns:
- token
-
removeToken
@Transactional public void removeToken(String token)
- Specified by:
removeTokenin interfaceTokenService
-
-