Interface TokensManagement
-
public interface TokensManagementTokens API allows for manipulating generic tokens. Token is a piece of information which is:- bound to an entity
- has unique identifier
- has type (e.g. OAuth access token)
- can have expiration time, when it is removed
- can contain additional, type specific data
As this is a low level interface it allows for external transaction steering. All methods will join an existing transaction if it is present.
- Author:
- K. Benedyczak
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceTokensManagement.TokenExpirationListenerReceives notifications about expired tokens.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddToken(java.lang.String type, java.lang.String value, byte[] contents, java.util.Date created, java.util.Date expires)Adds a new token without ownervoidaddToken(java.lang.String type, java.lang.String value, pl.edu.icm.unity.types.basic.EntityParam owner, byte[] contents, java.util.Date created, java.util.Date expires)Adds a new tokenvoidaddTokenExpirationListener(TokensManagement.TokenExpirationListener listener, java.lang.String type)Adds a new listenr which is notified about expired tokens of a specified typejava.util.List<pl.edu.icm.unity.base.token.Token>getAllTokens()java.util.List<pl.edu.icm.unity.base.token.Token>getAllTokens(java.lang.String type)java.util.List<pl.edu.icm.unity.base.token.Token>getOwnedTokens(java.lang.String type, pl.edu.icm.unity.types.basic.EntityParam entity)Returns all tokens of the entitypl.edu.icm.unity.base.token.TokengetTokenById(java.lang.String type, java.lang.String value)Returns a specified tokenvoidremoveToken(java.lang.String type, java.lang.String value)Removes the tokenvoidupdateToken(java.lang.String type, java.lang.String value, java.util.Date expires, byte[] contents)Update the token.
-
-
-
Method Detail
-
addToken
void addToken(java.lang.String type, java.lang.String value, pl.edu.icm.unity.types.basic.EntityParam owner, byte[] contents, java.util.Date created, java.util.Date expires) throws pl.edu.icm.unity.exceptions.IllegalIdentityValueException, pl.edu.icm.unity.exceptions.IllegalTypeExceptionAdds a new token- Parameters:
type- type or category of the tokencreated- creation timestamp. It is guaranteed to be stored with second precision, though implementation might also store the full time.expires- precision as in created case.- Throws:
pl.edu.icm.unity.exceptions.IllegalIdentityValueExceptionpl.edu.icm.unity.exceptions.IllegalTypeException
-
addToken
void addToken(java.lang.String type, java.lang.String value, byte[] contents, java.util.Date created, java.util.Date expires) throws pl.edu.icm.unity.exceptions.IllegalTypeExceptionAdds a new token without owner- Parameters:
type- type or category of the tokencreated- creation timestamp. It is guaranteed to be stored with second precision, though implementation might also store the full time.expires- precision as in created case.- Throws:
pl.edu.icm.unity.exceptions.IllegalTypeException
-
removeToken
void removeToken(java.lang.String type, java.lang.String value)Removes the token
-
updateToken
void updateToken(java.lang.String type, java.lang.String value, java.util.Date expires, byte[] contents)Update the token. Only contents and expiration time can be updated - the type and value are used to look up a token for update.- Parameters:
expires- if null -> leave unchangedcontents- if null -> leave unchanged
-
getTokenById
pl.edu.icm.unity.base.token.Token getTokenById(java.lang.String type, java.lang.String value)Returns a specified token
-
getOwnedTokens
java.util.List<pl.edu.icm.unity.base.token.Token> getOwnedTokens(java.lang.String type, pl.edu.icm.unity.types.basic.EntityParam entity) throws pl.edu.icm.unity.exceptions.IllegalIdentityValueException, pl.edu.icm.unity.exceptions.IllegalTypeExceptionReturns all tokens of the entity- Throws:
pl.edu.icm.unity.exceptions.IllegalIdentityValueExceptionpl.edu.icm.unity.exceptions.IllegalTypeException
-
getAllTokens
java.util.List<pl.edu.icm.unity.base.token.Token> getAllTokens(java.lang.String type)
- Returns:
- all tokens of a given type
-
getAllTokens
java.util.List<pl.edu.icm.unity.base.token.Token> getAllTokens()
- Returns:
- all tokens
-
addTokenExpirationListener
void addTokenExpirationListener(TokensManagement.TokenExpirationListener listener, java.lang.String type)
Adds a new listenr which is notified about expired tokens of a specified type
-
-