Source:
public RegisteredUser getUserFromSession(final HttpServletRequest request) { Validate.notNull(request); Map<String, String> currentSessionInformation; try { currentSessionInformation = this.getSegueSessionFromRequest(request); } catch (IOException e1) { log.error("Error parsing session information to retrieve user."); return null; } catch (InvalidSessionException e) { log.debug("We cannot read the session information. It probably doesn't exist"); return null; } if (properties.getProperty(Constants.SEGUE_APP_ENVIRONMENT).equals(EnvironmentType.PROD.name())) { String referrer = request.getHeader("Referer"); if (null == referrer) { log.warn("Authenticated request had no 'Referer' information set!"); } else if (!referrer.startsWith("https://" + Constants.HOST_NAME + "/")) { log.warn("Authenticated request had non-Isaac 'Referer': '" + referrer + "'"); } String origin = request.getHeader("Origin"); boolean expectOriginHeader = ORIGIN_HEADER_REQUEST_METHODS.contains(request.getMethod()); if (expectOriginHeader && null == origin) { log.warn("Authenticated request had no 'Origin' information!"); } else if (expectOriginHeader && !origin.startsWith("https://" + Constants.HOST_NAME)) { log.warn("Authenticated request had non-Isaac 'Origin': '" + origin + "'"); } } if (!this.isValidUsersSession(currentSessionInformation)) { log.debug("User session has failed validation. Assume they are not logged in. Session: " + currentSessionInformation); return null; } try { Long currentUserId = Long.parseLong(currentSessionInformation.get(SESSION_USER_ID)); Validate.notNull(currentUserId); return database.getById(currentUserId); } catch (SegueDatabaseException e) { log.error("Internal Database error. Failed to resolve current user.", e); return null; } catch (NumberFormatException e) { log.info("Invalid user id detected in session. " + currentSessionInformation.get(SESSION_USER_ID)); return null; } }

Target:
public RegisteredUser getUserFromSession(final HttpServletRequest request) { Validate.notNull(request); Map<String, String> currentSessionInformation; try { currentSessionInformation = this.getSegueSessionFromRequest(request); } catch (IOException e1) { log.error("Error parsing session information to retrieve user."); return null; } catch (InvalidSessionException e) { log.debug("We cannot read the session information. It probably doesn't exist"); return null; } if (properties.getProperty(Constants.SEGUE_APP_ENVIRONMENT).equals(EnvironmentType.PROD.name())) { String referrer = request.getHeader("Referer"); if (null == referrer) { log.warn("Authenticated request had no 'Referer' information set! Attempted to access: " + request.getPathInfo()); } else if (!referrer.startsWith("https://" + Constants.HOST_NAME + "/")) { log.warn("Authenticated request had unexpected Referer: '" + referrer + "'. Attempted to access: " + request.getPathInfo()); } String origin = request.getHeader("Origin"); boolean expectOriginHeader = ORIGIN_HEADER_REQUEST_METHODS.contains(request.getMethod()); if (expectOriginHeader && null == origin) { log.warn("Authenticated request had no 'Origin' information! Attempted to access: " + request.getPathInfo()); } else if (expectOriginHeader && !origin.startsWith("https://" + Constants.HOST_NAME)) { log.warn("Authenticated request had unexpected Origin: '" + origin + "'. Attempted to access: " + request.getPathInfo()); } } if (!this.isValidUsersSession(currentSessionInformation)) { log.debug("User session has failed validation. Assume they are not logged in. Session: " + currentSessionInformation); return null; } try { Long currentUserId = Long.parseLong(currentSessionInformation.get(SESSION_USER_ID)); Validate.notNull(currentUserId); return database.getById(currentUserId); } catch (SegueDatabaseException e) { log.error("Internal Database error. Failed to resolve current user.", e); return null; } catch (NumberFormatException e) { log.info("Invalid user id detected in session. " + currentSessionInformation.get(SESSION_USER_ID)); return null; } }