List of usage examples for javax.servlet.http HttpServletRequest getSession
public HttpSession getSession();
From source file:io.muic.ooc.service.SecurityService.java
public static boolean authenticate(String username, String password, HttpServletRequest request) { if (!StringUtils.isBlank(username) && !StringUtils.isBlank(password) && DatabaseQueryService.authenticate(username, password)) { request.getSession().setAttribute("username", username); return true; } else {/* w w w.j av a 2 s .c o m*/ return false; } }
From source file:io.lavagna.web.helper.UserSession.java
public static int getUserId(HttpServletRequest req) { Object o = req.getSession().getAttribute(AUTH_USER_ID); Objects.requireNonNull(o);//www . j av a 2s .c o m return (int) o; }
From source file:com.qualogy.qafe.web.ContextLoaderHelper.java
/** * For now only used by GWT, but any other could easily follow * @param request// w ww.ja v a 2s . co m * @return */ public static boolean isReloadable(HttpServletRequest request) { String reloadable = request.getSession().getServletContext() .getInitParameter(ContextLoader.RELOADABLE_PARAM); boolean returnValue = false; if (reloadable != null && "true".equalsIgnoreCase(reloadable.trim())) { returnValue = true; } return returnValue; }
From source file:eionet.gdem.web.struts.qascript.QAScriptListLoader.java
private static QAScriptListHolder loadQAScriptList(HttpServletRequest httpServletRequest, boolean reload) throws DCMException { Object st = httpServletRequest.getSession().getServletContext().getAttribute(QASCRIPT_LIST_ATTR); if (st == null || !(st instanceof QAScriptListHolder) || reload) { st = new QAScriptListHolder(); try {/*from www . j av a2 s. c om*/ SchemaManager sm = new SchemaManager(); st = sm.getSchemasWithQAScripts(null); } catch (DCMException e) { e.printStackTrace(); LOGGER.error("Error getting QA scripts list", e); throw e; } httpServletRequest.getSession().getServletContext().setAttribute(QASCRIPT_LIST_ATTR, st); } Object permissions = httpServletRequest.getSession().getAttribute(QASCRIPT_PERMISSIONS_ATTR); if (permissions == null || !(permissions instanceof QAScriptListHolder)) { loadPermissions(httpServletRequest); } return (QAScriptListHolder) st; }
From source file:com.yahoo.dba.perf.myperf.springmvc.MyPerfBaseController.java
static protected AppUser retrieveAppUser(HttpServletRequest req) { return AppUser.class.cast(req.getSession().getAttribute(AppUser.SESSION_ATTRIBUTE)); }
From source file:com.vmware.appfactory.file.upload.ProgressReporter.java
/** * This method adds the ProgressListener to the session based on the keyPrefix as available. * This method can be invoked only by CustomMultipartResolverWithProgress and hence the limited visibility. * * @param request/*from www . j a v a 2 s . c o m*/ * @param progressListener */ static void addProgressListener(HttpServletRequest request, ProgressListener progressListener) { String uploadId = (String) request.getSession().getAttribute(UPLOAD_REQUEST_ID); if (StringUtils.isEmpty(uploadId)) { // If no key, we cant store the progressListener in session and hence no upload progress. _log.warn("No uploadId available, hence we do not track the ProgressListener"); return; } String sessionKey = createSessionKey(uploadId); // Add the progressListener onto the session for progress reporting. request.getSession().setAttribute(sessionKey, progressListener); // Remove this session variable(if exists), as its not needed anymore. request.getSession().removeAttribute(UPLOAD_REQUEST_ID); }
From source file:org.appverse.web.framework.backend.api.helpers.security.SecurityHelper.java
/** * * @param request// w w w .jav a 2 s. c o m * @throws Exception */ @SuppressWarnings("unused") public static void checkXSRFToken(final HttpServletRequest request) throws Exception { String requestValue = request.getHeader(XSRF_TOKEN_NAME); String sessionValue = (String) request.getSession().getAttribute(XSRF_TOKEN_NAME); if (requestValue == null || sessionValue == null || !sessionValue.equals(requestValue)) { throw new Exception("XSRF attribute not found in request or session or invalid."); } }
From source file:io.lavagna.web.helper.UserSession.java
public static boolean isUserAuthenticated(HttpServletRequest req) { return Boolean.TRUE.equals(req.getSession().getAttribute(AUTH_KEY)); }
From source file:io.lavagna.web.helper.UserSession.java
public static boolean isLocked(HttpServletRequest req) { return Boolean.TRUE.equals(req.getSession().getAttribute(AUTH_LOCKED)); }
From source file:io.lavagna.web.helper.UserSession.java
public static boolean isUserAnonymous(HttpServletRequest req) { return Boolean.TRUE.equals(req.getSession().getAttribute(AUTH_USER_IS_ANONYMOUS)); }