Source:
public SSession login(final Map<String, Serializable> credentials) throws SLoginException { debugLog("Loging in"); if (credentials == null) { throw new SLoginException("invalid credentials, map is null"); } final Long tenantId = NumberUtils.toLong(String.valueOf(credentials.get(AuthenticationConstants.BASIC_TENANT_ID)), -1); sessionAccessor.setSessionInfo(-1, tenantId); long userId = 0; boolean isTechnicalUser = false; String userName = null; try { final TechnicalUser technicalUser = getTechnicalUser(tenantId); if (credentials.containsKey(AuthenticationConstants.BASIC_USERNAME) && credentials.get(AuthenticationConstants.BASIC_USERNAME) != null) { userName = String.valueOf(credentials.get(AuthenticationConstants.BASIC_USERNAME)); } if (technicalUser.getUserName().equals(userName) && technicalUser.getPassword().equals(String.valueOf(credentials.get(AuthenticationConstants.BASIC_PASSWORD)))) { debugLog("Authenticated as technical user"); isTechnicalUser = true; userId = -1; } else { userName = loginChoosingAppropriateAuthenticationService(credentials); if (StringUtils.isNotBlank(userName)) { debugLog("Authenticated as regular user"); final SUser user = identityService.getUserByUserName(userName); userId = user.getId(); } else { debugLog("Authentication failed"); authenticationFailed(); } } } catch (final AuthenticationException ae) { throw new SLoginException(ae); } catch (final SUserNotFoundException e) { warningLog("Unable to find user with username " + userName + " in database."); throw new SLoginException("Unable to find user " + userName); } finally { sessionAccessor.deleteSessionId(); } try { debugLog("Session creation"); return sessionService.createSession(tenantId, userId, userName, isTechnicalUser); } catch (final SSessionException e) { throw new SLoginException(e); } }

Target:
public SSession login(final Map<String, Serializable> credentials) throws SLoginException, SUserNotFoundException { debugLog("Loging in"); if (credentials == null) { throw new SLoginException("invalid credentials, map is null"); } final Long tenantId = NumberUtils.toLong(String.valueOf(credentials.get(AuthenticationConstants.BASIC_TENANT_ID)), -1); sessionAccessor.setSessionInfo(-1, tenantId); long userId = 0; boolean isTechnicalUser = false; String userName = null; try { final TechnicalUser technicalUser = getTechnicalUser(tenantId); if (credentials.containsKey(AuthenticationConstants.BASIC_USERNAME) && credentials.get(AuthenticationConstants.BASIC_USERNAME) != null) { userName = String.valueOf(credentials.get(AuthenticationConstants.BASIC_USERNAME)); } if (technicalUser.getUserName().equals(userName) && technicalUser.getPassword().equals(String.valueOf(credentials.get(AuthenticationConstants.BASIC_PASSWORD)))) { debugLog("Authenticated as technical user"); isTechnicalUser = true; userId = -1; } else { userName = loginChoosingAppropriateAuthenticationService(credentials); if (StringUtils.isNotBlank(userName)) { debugLog("Authenticated as regular user"); final SUser user = identityService.getUserByUserName(userName); userId = user.getId(); } else { debugLog("Authentication failed"); authenticationFailed(); } } } catch (final AuthenticationException ae) { debugLog("Unable to authenticate user with username " + userName); throw new SLoginException(ae); } catch (final SUserNotFoundException e) { debugLog("Unable to find user with username " + userName + " in database."); throw e; } finally { sessionAccessor.deleteSessionId(); } try { debugLog("Session creation"); return sessionService.createSession(tenantId, userId, userName, isTechnicalUser); } catch (final SSessionException e) { throw new SLoginException(e); } }