Class DefaultTokenService
- java.lang.Object
-
- org.silverpeas.core.security.token.persistent.service.DefaultTokenService
-
- All Implemented Interfaces:
PersistentResourceTokenService
@Service @Singleton public class DefaultTokenService extends Object implements PersistentResourceTokenService
The default implementation of thePersistentResourceTokenService
interface.- Author:
- Yohann Chastagnier
-
-
Constructor Summary
Constructors Constructor Description DefaultTokenService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PersistentResourceToken
get(String token)
Gets the token with the specified value from the data source.PersistentResourceToken
get(EntityReference resource)
Gets the token of the resource referred by the specifiedEntityReference
.PersistentResourceToken
initialize(EntityReference resource)
Initializes the token of the resource referred by the specifiedEntityReference
.void
remove(String token)
Removes quietly the specified token.void
remove(EntityReference resource)
Removes quietly the token of the resource referred by the specified entity reference.
-
-
-
Method Detail
-
initialize
public PersistentResourceToken initialize(EntityReference resource) throws TokenException
Description copied from interface:PersistentResourceTokenService
Initializes the token of the resource referred by the specifiedEntityReference
. If the resource has already a token, this token is then renewed.- Specified by:
initialize
in interfacePersistentResourceTokenService
- Parameters:
resource
- a reference to the resource for which a token will be initialized.- Returns:
- a token persisted for the specified resource.
- Throws:
TokenException
- if an error occurs while initializing a token.- See Also:
PersistentResourceTokenService.initialize(EntityReference)
-
get
public PersistentResourceToken get(EntityReference resource)
Description copied from interface:PersistentResourceTokenService
Gets the token of the resource referred by the specifiedEntityReference
. If no token exists for the resource, thenPersistentResourceToken.NoneToken
is returned.- Specified by:
get
in interfacePersistentResourceTokenService
- Parameters:
resource
- a reference to the resource for which a token will be initialized.- Returns:
- either the token associated with the specified resource or NoneToken if no such token exists.
- See Also:
PersistentResourceTokenService.get(EntityReference)
-
get
public PersistentResourceToken get(String token)
Description copied from interface:PersistentResourceTokenService
Gets the token with the specified value from the data source. If no token exists with a such value, thenPersistentResourceToken.NoneToken
is returned.- Specified by:
get
in interfacePersistentResourceTokenService
- Parameters:
token
- the value of the token to get.- Returns:
- either the token with the specified value or NoneToken if no such token exists.
- See Also:
PersistentResourceTokenService.get(java.lang.String)
-
remove
public void remove(EntityReference resource)
Description copied from interface:PersistentResourceTokenService
Removes quietly the token of the resource referred by the specified entity reference.- Specified by:
remove
in interfacePersistentResourceTokenService
- Parameters:
resource
- the resource for which the token has to be removed.- See Also:
PersistentResourceTokenService.remove(EntityReference)
-
remove
public void remove(String token)
Description copied from interface:PersistentResourceTokenService
Removes quietly the specified token.- Specified by:
remove
in interfacePersistentResourceTokenService
- Parameters:
token
- the String representation of the token to remove.- See Also:
PersistentResourceTokenService.remove(java.lang.String)
-
-