Package de.kosmos_lab.web.persistence
Interface IUserPersistence
-
- All Superinterfaces:
IPersistence
- All Known Implementing Classes:
JSONPersistence
public interface IUserPersistence extends IPersistence
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddJWT(String token)booleanaddUser(String username, String password, int level)add a user to the persistenceStringgetJWT(User user)get the jwt for a userorg.json.JSONObjectgetJWT(String jwtid)get the JWT with a specific jwtid back, if it is in the system and still validCollection<org.json.JSONObject>getMySessions(String username)UsergetUser(String username)get a user from persistenceUsergetUser(UUID uuid)intinitUsers()voidkillJWT(String jwtid)Userlogin(String username, String password)try to loginorg.json.JSONObjectverifyJWT(String token)verify the given jwt
-
-
-
Method Detail
-
addJWT
void addJWT(@Nonnull String token)
-
addUser
boolean addUser(@CheckForNull String username, @CheckForNull String password, int level)add a user to the persistence- Parameters:
username-password-- Returns:
-
getJWT
org.json.JSONObject getJWT(@Nonnull String jwtid)get the JWT with a specific jwtid back, if it is in the system and still valid- Parameters:
jwtid- the id to find- Returns:
-
getJWT
String getJWT(@Nonnull User user) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException
get the jwt for a user- Parameters:
user-- Returns:
- Throws:
UnsupportedEncodingExceptionNoSuchAlgorithmExceptionInvalidKeyException
-
getMySessions
Collection<org.json.JSONObject> getMySessions(String username)
-
getUser
User getUser(@CheckForNull String username) throws NotFoundInPersistenceException
get a user from persistence- Parameters:
username-- Returns:
- Throws:
NotFoundInPersistenceException
-
killJWT
void killJWT(String jwtid)
-
verifyJWT
org.json.JSONObject verifyJWT(@Nonnull String token)verify the given jwt- Parameters:
token-- Returns:
-
login
User login(@CheckForNull String username, @CheckForNull String password) throws LoginFailedException
try to login- Parameters:
username-password-- Returns:
- returns a jwt token on success
- Throws:
LoginFailedException
-
getUser
User getUser(@CheckForNull UUID uuid) throws NotFoundInPersistenceException
- Throws:
NotFoundInPersistenceException
-
initUsers
int initUsers()
-
-