Note
This documentation is for the new OMERO 5.1. version. See the latest OMERO 5.0.x version or the previous versions page to find documentation for the OMERO version you are using if you have not upgraded yet.
Beginning with OMERO-3.0-Beta3, the OMERO server has unified the handling of login sessions among both the JBoss and the OMERO.blitz servers. Previously JBoss logins were handled via the standard JAAS mechanisms, using a modified DatabaseLoginModule. This proved problematic for several reasons:
Blitz did not suffer from these problems, but the login functionality was largely outside of the core server code and sessions were more volatile: a loss of an Ice connection caused all resources to be lost. With OMERO sessions, both login systems have been brought together and simplified.
In short:
All services other than ISession, assume that a user is logging in with a username equal to session uuid. Whereas previously one logged in with:
ome.system.Principal p = new ome.system.Principal("josh","user","User");
behind the scenes, now the “josh” value is replaced by the UUID of a ome.model.meta.Session instance.
The session is acquired by a call to:
ome.api.ISession.createSession(Principal princpal, String credentials);
and carries information related to the current user’s session.
Session session;
session.getUuid(); // Unique identifier; functions as a temporary password. DO NOT SHARE IT.
session.getTimeToIdle(); // Number of milliseconds which the user can idle without session timeout
session.getTimeToLive(); // Total number of milliseconds for which the session can live
session.getStarted(); // Start of session
session.getClosed(); // if != null, then session is closed
These properties cannot be modified.
Other properties are for use by clients:
session.getMessage(); // General purpose message statement
session.getAgent(); // Can be used to specify which program the user is using
session.getDefaultEventType(); // Default event type (the third argument "User" to Principal above)
session.getDefaultPermissions(); // String representation of umask (e.g. "rw----")
After changing a property on the session returned by createSession() it is possible to save them to the server via:
ome.api.ISession.updateSession(Session);
Finally, when finished, to conserve resources it is possible to destroy the session via:
ome.api.ISession.closeSession(Session);
In OMERO.blitz, once the connection to a ServiceFactoryPrx (a Glacier2.Session subclass) was lost, it was not possible to reconnect to any of the services created using that connection. Now it is possible to reacquire the session if it is still active, by passing the previous session UUID as your password (User principal is ignored).
client = omero.client()
servicefactory = client.createSession()
iadmin = servicefactory.getAdminService()
olduuid = iadmin.getEventContext().sessionUuid
// lose connection
client = omero.client()
servicefactory = client.createSession(omero.sys.Principal(), olduuid)
// now reattached
In the short-term, there is no need for any change to client code to make use of the new sessions.
ome.system.ServiceFactory has been modified to automatically acquire a session before the first service call is made. Eventually, clients will want to make use of the session API and catch session exceptions to have a finer control of the client lifecycle.
Similarly, no changes are needed in OMERO.blitz client code since Glacier2 sessions now delegate to OMERO sessions. Clients can access the ISession service when necessary. Exceptions thrown are still Ice-based.
See also