There are two kind of User in Cytomine: human user (User) and software user (UserJob). Each of them extends the SecUser class. Each user has some roles (SecRole) and some permissions on domain instances.
To have more details about permissions, check the permission guide.
Domain | Description | Main properties |
---|---|---|
SecUser | Generic user | String username |
User | Human user. Extend SecUser class | String firstname |
UserJob | Software user. Extend SecUser class | Job job |
SecRole | A user role (admin, user,...) | String authority |
SecUserSecRole | A link between a user and a role | SecUser secUser |
Group | A set of user | String name |
UserGroup | A user in a group | SecUser user |
User and UserJob extends SecUser. User and UserJob are able to login to Cytomine. When a user run a job, this will create a new UserJob with the same user role.
A human user connects to the server with a login/password form.
The form will POST data to the /j_spring_security_check service (from Spring Security plugin).
A software user (UserJob) will use a client and will log thanks to public and private keys by generating a signature.
The main code is located in APIAuthentificationFilters.tryAPIAuthentification(). This method will check if the signature is valid.
There are 4 kinds of user:
The service CurrentRoleService is session scope service containing some interresting methods:
//Active admin session for user def activeAdminSession(SecUser user) //Close admin session for user def closeAdminSession(SecUser user) //Get all active roles Set<SecRole> findCurrentRole(SecUser user) //Check if user is admin (with admin session opened) boolean isAdminByNow(SecUser user) //isUserByNow and isGuestByNow too //Check if user is admin (with admin session closed or opened) boolean isAdmin(SecUser user) //isUser and isGuest too |
A user with ROLE_ADMIN may open the Admin session on the web app.
This service calls the activeAdminSession method.
This user will now be logged as an admin. He may the close its admin session.
This service calls the closeAdminSession.
An admin user is able to be connected as another user.
This functionnality simply calls the /j_spring_security_switch_user service (with POST param: j_username:"xxx").