List of usage examples for org.apache.wicket Session isSessionInvalidated
public final boolean isSessionInvalidated()
From source file:de.inren.frontend.application.ApplicationStatus.java
License:Apache License
public int getActiveSessions() { int activeSessions = 0; for (Session session : sessions) { if (!session.isSessionInvalidated() && !session.isSessionInvalidated()) { activeSessions++;// w w w. j av a2 s . co m } } return activeSessions; }
From source file:de.inren.frontend.application.ApplicationStatus.java
License:Apache License
public int getInvalidSessions() { int invalidSessions = 0; for (Session session : sessions) { if (session.isSessionInvalidated()) { invalidSessions++;/*from ww w . j ava 2s.c om*/ } } return invalidSessions; }
From source file:org.wicketstuff.security.SessionInvalidationTest.java
License:Apache License
/** * make sure the session is invalidated after a logoff *///from w w w.j a v a2 s.com @Test public void testSessionInvalidationWithSingleLogin() { doLogin(); Session session = Session.get(); assertNotNull(session); assertEquals(session, mock.getSession()); assertTrue(((WaspSession) mock.getSession()).logoff(null)); mock.processRequest(); assertTrue(session.isSessionInvalidated()); assertFalse( ((WaspAuthorizationStrategy) mock.getSession().getAuthorizationStrategy()).isUserAuthenticated()); }
From source file:org.wicketstuff.security.SessionInvalidationTest.java
License:Apache License
/** * make sure the session is invalidated after a logoff *//* w w w. j a v a2 s. c om*/ @Test public void testSessionInvalidationWithMultiLogin() { doLogin(); Session session = Session.get(); assertNotNull(session); assertEquals(session, mock.getSession()); Map<String, WaspAction> authorized = new HashMap<String, WaspAction>(); authorized.put(SecureComponentHelper.alias(SecureForm.class), application.getActionFactory().getAction("access render")); login(authorized); mock.processRequest(); assertTrue( ((WaspAuthorizationStrategy) mock.getSession().getAuthorizationStrategy()).isUserAuthenticated()); assertEquals(session, mock.getSession()); logoff(authorized); mock.processRequest(); assertTrue( ((WaspAuthorizationStrategy) mock.getSession().getAuthorizationStrategy()).isUserAuthenticated()); assertEquals(session, mock.getSession()); ((WaspSession) mock.getSession()).logoff(null); mock.processRequest(); assertTrue(session.isSessionInvalidated()); assertFalse( ((WaspAuthorizationStrategy) mock.getSession().getAuthorizationStrategy()).isUserAuthenticated()); }