public ServerCallableFuture() { incomingMessage = RpcContext.getMessage(); }
/** * @return the HTTP session object associated with this {@link Thread} */ public static HttpSession getHttpSession() { final QueueSession qs = getQueueSession(); if (qs == null) { return null; } return qs.getAttribute(HttpSession.class, HttpSession.class.getName()); }
public String getPathRelativeToApp(final String path) { final String wbp = null != path ? (path.trim().length() == 0 || ".".equals(path) ? WEBINF_PATH : WEBINF_PATH + "/" + path) : WEBINF_PATH; return RpcContext.getServletRequest() .getServletContext() .getRealPath(wbp) .replaceAll("\\\\", "/"); }
@Override public void logout() { if (keycloakIsLoggedIn()) { keycloakLogout(); try { if (RpcContext.getMessage() != null) ((HttpServletRequest) RpcContext.getServletRequest()).logout(); } catch (ServletException e) { throw new AuthenticationException("An error occurred while attempting to log out of Keycloak."); } } else if (wrappedAuthService.isLoggedIn()) { wrappedAuthService.logout(); } }
@Override public void logout() { identity.logout(); RpcContext.getHttpSession().invalidate(); }
@Before public void setup() { when(authService.getUser()).thenThrow(new AssertionError("Should not call authentication service")); when(threadMessage.getResource(QueueSession.class, "Session")).thenReturn(threadQueueSession); when(threadQueueSession.getSessionId()).thenReturn(sessionUser.getIdentifier()); RpcContext.set(null); }
private String getSessionId() { return (getMessage() != null && getQueueSession() != null ? getQueueSession().getSessionId() : null); } }
public MessageReader() { this(() -> RpcContext.getServletRequest().getLocale()); }
@Override public void logout() { identity.logout(); RpcContext.getHttpSession().invalidate(); }
@Test public void returnAuthenticatedUserInSessionThread() { when(userInstance.isAmbiguous()).thenReturn(false); when(userInstance.isUnsatisfied()).thenReturn(false); when(userInstance.get()).thenReturn(defaultUser); reset(authService); when(authService.getUser()).thenReturn(sessionUser); RpcContext.set(threadMessage); SessionInfo sessionInfo = factory.getSessionInfo(authService); assertSame(sessionUser, sessionInfo.getIdentity()); }
private String getSessionId() { return (getMessage() != null && getQueueSession() != null ? getQueueSession().getSessionId() : null); } }
@AroundInvoke public Object bindUserContext(InvocationContext invocationContext) throws Exception { HttpServletRequest servletRequest = (HttpServletRequest) getServletRequest(); IUserContext.Holder.setPrincipal(servletRequest.getUserPrincipal()); try { return invocationContext.proceed(); } finally { IUserContext.Holder.removeSecurityContext(); } } }
@PostConstruct protected void init() { // By default, enable the register of data set definitions stored into the deployment folder. ServletContext servletContext = RpcContext.getHttpSession().getServletContext(); if (!dataSetDefDeployer.isRunning() && servletContext != null) { String dir = servletContext.getRealPath("WEB-INF/datasets"); if (dir != null && new File(dir).exists()) { dir = dir.replaceAll("\\\\", "/"); dataSetDefDeployer.deploy(dir); } } }
/** * @return the QueueSession associated with this {@link Thread} */ public static QueueSession getQueueSession() { final Message m = getMessage(); if (m == null) { return null; } return m.getResource(QueueSession.class, "Session"); }
@Before public void setup() { when(authService.getUser()).thenThrow(new AssertionError("Should not call authentication service")); when(threadMessage.getResource(QueueSession.class, "Session")).thenReturn(threadQueueSession); when(threadQueueSession.getSessionId()).thenReturn(sessionUser.getIdentifier()); RpcContext.set(null); }
/** * @return the HTTP session object associated with this {@link Thread} */ public static HttpSession getHttpSession() { final QueueSession qs = getQueueSession(); if (qs == null) { return null; } return qs.getAttribute(HttpSession.class, HttpSession.class.getName()); }
public BackendI18nHelper(I18nSettings settings) { super(settings); bundle = ResourceBundle.getBundle(settings.getBundle(), RpcContext.getServletRequest().getLocale()); }
@PostConstruct protected void init() { // By default, enable the register of data set definitions stored into the deployment folder. ServletContext servletContext = RpcContext.getHttpSession().getServletContext(); if (!dataSetDefDeployer.isRunning() && servletContext != null) { String dir = servletContext.getRealPath("WEB-INF/datasets"); if (dir != null && new File(dir).exists()) { dir = dir.replaceAll("\\\\", "/"); dataSetDefDeployer.deploy(dir); } } }