public class SessionManager extends Object
Constructor and Description |
---|
SessionManager() |
SessionManager(byte[] sessionKey) |
SessionManager(CredentialStore userStore) |
SessionManager(CredentialStore userStore,
byte[] sessionKey) |
Modifier and Type | Method and Description |
---|---|
void |
addLoginObserver(org.openbase.jul.pattern.Observer<String> observer) |
boolean |
canClientLoginAgain()
determines if a client can login again.
|
boolean |
canUserLoginAgain()
determines if a user can login again.
|
void |
changeCredentials(String clientId,
String oldCredentials,
String newCredentials)
Changes the login credentials for a given user.
|
void |
completeLogout()
This method performs a complete logout by also clearing the previous client id.
|
String |
getClientId() |
static SessionManager |
getInstance() |
byte[] |
getSessionKey() |
rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper |
getTicketAuthenticatorWrapper() |
String |
getUserAtClientId()
If a user and/or client is logged in, this returns the concatenation of both IDs.
|
String |
getUserId() |
boolean |
hasCredentialsForId(String id) |
rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper |
initializeServiceServerRequest() |
void |
initStore() |
boolean |
isAdmin()
Determines whether the currently logged in user is an admin.
|
boolean |
isAuthenticated()
determines if a user is authenticated.
|
boolean |
isLoggedIn()
determines if a user is logged in.
|
boolean |
login(String clientId)
Perform a login for a given clientId.
|
boolean |
login(String userId,
String userPassword)
TODO: Save Login data, if keepUserLoggedIn set to true
Perform a login for a given userId and password.
|
boolean |
login(String userId,
String userPassword,
boolean rememberPassword) |
void |
logout()
Logs a user out by setting CST and session key to null
|
void |
registerClient(String clientId)
Registers a client.
|
void |
registerUser(String userId,
String password,
boolean isAdmin)
Registers a user.
|
boolean |
relog()
Perform a relog for the client registered in the credentialStore.
|
void |
removeLoginObserver(org.openbase.jul.pattern.Observer<String> observer) |
void |
removeUser(String id) |
void |
setAdministrator(String id,
boolean isAdmin) |
void |
setTicketAuthenticatorWrapper(rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper ticketAuthenticatorWrapper) |
public SessionManager()
public SessionManager(byte[] sessionKey)
public SessionManager(CredentialStore userStore)
public SessionManager(CredentialStore userStore, byte[] sessionKey)
public static SessionManager getInstance()
public void initStore() throws org.openbase.jul.exception.InitializationException
org.openbase.jul.exception.InitializationException
public rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper getTicketAuthenticatorWrapper()
public void setTicketAuthenticatorWrapper(rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper ticketAuthenticatorWrapper) throws IOException, BadPaddingException
IOException
BadPaddingException
public byte[] getSessionKey()
public rst.domotic.authentication.TicketAuthenticatorWrapperType.TicketAuthenticatorWrapper initializeServiceServerRequest() throws org.openbase.jul.exception.RejectedException
org.openbase.jul.exception.RejectedException
public boolean login(String userId, String userPassword) throws org.openbase.jul.exception.CouldNotPerformException, org.openbase.jul.exception.NotAvailableException
userId
- Identifier of the useruserPassword
- Password of the userorg.openbase.jul.exception.NotAvailableException
- If the entered clientId could not be found.org.openbase.jul.exception.CouldNotPerformException
- In case of a communication error between client and server.public boolean login(String userId, String userPassword, boolean rememberPassword) throws org.openbase.jul.exception.CouldNotPerformException, org.openbase.jul.exception.NotAvailableException
org.openbase.jul.exception.CouldNotPerformException
org.openbase.jul.exception.NotAvailableException
public boolean login(String clientId) throws org.openbase.jul.exception.CouldNotPerformException, org.openbase.jul.exception.NotAvailableException
clientId
- Identifier of the userorg.openbase.jul.exception.NotAvailableException
- If the entered clientId could not be found.org.openbase.jul.exception.CouldNotPerformException
- In case of a communication error between client and server.public boolean relog() throws org.openbase.jul.exception.CouldNotPerformException, org.openbase.jul.exception.NotAvailableException
org.openbase.jul.exception.NotAvailableException
- If the entered clientId could not be found. Or if the clientId was not set in the beginning.org.openbase.jul.exception.CouldNotPerformException
- In case of a communication error between client and server.public void logout()
public void completeLogout()
public boolean isLoggedIn()
public boolean isAdmin()
public boolean canUserLoginAgain()
public boolean canClientLoginAgain()
public boolean isAuthenticated() throws org.openbase.jul.exception.CouldNotPerformException
org.openbase.jul.exception.CouldNotPerformException
- In case of a communication error between client and server.public void changeCredentials(String clientId, String oldCredentials, String newCredentials) throws org.openbase.jul.exception.CouldNotPerformException
clientId
- ID of the user / client whose credentials should be changed.oldCredentials
- Old credentials, needed for verification.newCredentials
- New credentials to be set.org.openbase.jul.exception.CouldNotPerformException
- In case of a communication error between client and server.public void registerClient(String clientId) throws org.openbase.jul.exception.CouldNotPerformException
clientId
- the id of the clientorg.openbase.jul.exception.CouldNotPerformException
public boolean hasCredentialsForId(String id)
public void registerUser(String userId, String password, boolean isAdmin) throws org.openbase.jul.exception.CouldNotPerformException
userId
- the id of the userpassword
- the password of the userisAdmin
- flag if user should be an administratororg.openbase.jul.exception.CouldNotPerformException
public void removeUser(String id) throws org.openbase.jul.exception.CouldNotPerformException
org.openbase.jul.exception.CouldNotPerformException
public void setAdministrator(String id, boolean isAdmin) throws org.openbase.jul.exception.CouldNotPerformException
org.openbase.jul.exception.CouldNotPerformException
public String getUserAtClientId()
public String getUserId()
public void addLoginObserver(org.openbase.jul.pattern.Observer<String> observer)
public void removeLoginObserver(org.openbase.jul.pattern.Observer<String> observer)
public String getClientId()
Copyright © 2017–2018 openbase.org. All rights reserved.