de.sekmi.li2b2.services.token.TokenManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of li2b2-server Show documentation
Show all versions of li2b2-server Show documentation
This project emulates the core components
of an i2b2 server backend. Basic functionality
of PM, CRC, ONT and WORK cells allows the
official i2b2 webclient to connect ot this
emulated server.
The newest version!
package de.sekmi.li2b2.services.token;
import java.security.Principal;
/**
* Simple token management interface
* used for the li2b2 server.
*
* @author R.W.Majeed
*
*/
public interface TokenManager {
/**
* Register a principal (user) and return a token
* @param name principal name
* @return token string
*/
String registerPrincipal(String name);
Token extends Principal> lookupToken(String uuid);
/**
* Renew the specified token. If it is not renewed,
* it will expire after the number of milliseconds
* specified by {@link #getExpirationMillis()}.
*
* The token can also be renewed via {@link Token#renew()}.
*
* @param uuid uuid of the token to renew
*/
void renew(String uuid);
int getTokenCount();
/**
* Get the number of milliseconds after which a token will expire
* if it is not renewed before.
*
* Override this method to change the expiration time
*
* @return expiration timeout in milliseconds
*/
long getExpirationMillis();
}