ServletContext ctx = request.getSession(true).getServletContext(); ServiceFactory factory = (ServiceFactory) ctx.getAttribute("APP_SERVICE_FACTORY"); return factory.createSecurityService();