@Test public void shouldProcessCallbacksAndThrowInvalidStateException() throws LoginException { Callback[] callbacks = new Callback[0]; int state = 0; boolean exceptionCaught = false; AuthLoginException exception = null; try { persistentCookieAuthModule.process(callbacks, state); } catch (AuthLoginException e) { exceptionCaught = true; exception = e; } assertTrue(exceptionCaught); assertEquals(exception.getErrorCode(), "incorrectState"); }
@Override public int process(Callback[] callbacks, int state) throws LoginException { switch (state) { case ISAuthConstants.LOGIN_START: { setUserSessionProperty(JwtSessionModule.TOKEN_IDLE_TIME_CLAIM_KEY, tokenIdleTime.toString()); setUserSessionProperty(JwtSessionModule.MAX_TOKEN_LIFE_KEY, maxTokenLife.toString()); setUserSessionProperty(SECURE_COOKIE_KEY, Boolean.toString(secureCookie)); setUserSessionProperty(HTTP_ONLY_COOKIE_KEY, Boolean.toString(httpOnlyCookie)); final Subject clientSubject = new Subject(); MessageInfo messageInfo = prepareMessageInfo(getHttpServletRequest(), getHttpServletResponse()); if (process(messageInfo, clientSubject, callbacks)) { return ISAuthConstants.LOGIN_SUCCEED; } throw new AuthLoginException(AUTH_RESOURCE_BUNDLE_NAME, "cookieNotValid", null); } default: { throw new AuthLoginException(AUTH_RESOURCE_BUNDLE_NAME, "incorrectState", null); } } }
PersistentCookieAuthModule extends JaspiAuthModuleWrapper<JwtSessionModule> { @Override public int process(Callback[] callbacks, int state) throws LoginException { switch (state) { case ISAuthConstants.LOGIN_START: { setUserSessionProperty(JwtSessionModule.TOKEN_IDLE_TIME_CLAIM_KEY, tokenIdleTime.toString()); setUserSessionProperty(JwtSessionModule.MAX_TOKEN_LIFE_KEY, maxTokenLife.toString()); setUserSessionProperty(SECURE_COOKIE_KEY, Boolean.toString(secureCookie)); setUserSessionProperty(HTTP_ONLY_COOKIE_KEY, Boolean.toString(httpOnlyCookie)); final Subject clientSubject = new Subject(); MessageInfo messageInfo = prepareMessageInfo(getHttpServletRequest(), getHttpServletResponse()); if (process(messageInfo, clientSubject, callbacks)) { return ISAuthConstants.LOGIN_SUCCEED; } throw new AuthLoginException(AUTH_RESOURCE_BUNDLE_NAME, "cookieNotValid", null); } default: { throw new AuthLoginException(AUTH_RESOURCE_BUNDLE_NAME, "incorrectState", null); } } } }
PersistentCookieAuthModule extends JaspiAuthModuleWrapper<JwtSessionModule> { @Override public int process(Callback[] callbacks, int state) throws LoginException { switch (state) { case ISAuthConstants.LOGIN_START: { setUserSessionProperty(JwtSessionModule.TOKEN_IDLE_TIME_CLAIM_KEY, tokenIdleTime.toString()); setUserSessionProperty(JwtSessionModule.MAX_TOKEN_LIFE_KEY, maxTokenLife.toString()); setUserSessionProperty(SECURE_COOKIE_KEY, Boolean.toString(secureCookie)); setUserSessionProperty(HTTP_ONLY_COOKIE_KEY, Boolean.toString(httpOnlyCookie)); final Subject clientSubject = new Subject(); MessageInfo messageInfo = prepareMessageInfo(getHttpServletRequest(), getHttpServletResponse()); if (process(messageInfo, clientSubject, callbacks)) { return ISAuthConstants.LOGIN_SUCCEED; } throw new AuthLoginException(AUTH_RESOURCE_BUNDLE_NAME, "cookieNotValid", null); } default: { throw new AuthLoginException(AUTH_RESOURCE_BUNDLE_NAME, "incorrectState", null); } } } PersistentCookieAuthModule();  PersistentCookieAuthModule(JwtSessionModule jwtSessionModule, AMKeyProvider amKeyProvider); }
PersistentCookieAuthModule extends JaspiAuthModuleWrapper<JwtSessionModule> { @Override public int process(Callback[] callbacks, int state) throws LoginException { switch (state) { case ISAuthConstants.LOGIN_START: { setUserSessionProperty(JwtSessionModule.TOKEN_IDLE_TIME_CLAIM_KEY, tokenIdleTime.toString()); setUserSessionProperty(JwtSessionModule.MAX_TOKEN_LIFE_KEY, maxTokenLife.toString()); setUserSessionProperty(SECURE_COOKIE_KEY, Boolean.toString(secureCookie)); setUserSessionProperty(HTTP_ONLY_COOKIE_KEY, Boolean.toString(httpOnlyCookie)); final Subject clientSubject = new Subject(); MessageInfo messageInfo = prepareMessageInfo(getHttpServletRequest(), getHttpServletResponse()); if (process(messageInfo, clientSubject, callbacks)) { return ISAuthConstants.LOGIN_SUCCEED; } throw new AuthLoginException(AUTH_RESOURCE_BUNDLE_NAME, "cookieNotValid", null); } default: { throw new AuthLoginException(AUTH_RESOURCE_BUNDLE_NAME, "incorrectState", null); } } } PersistentCookieAuthModule();  PersistentCookieAuthModule(JwtSessionModule jwtSessionModule, AMKeyProvider amKeyProvider); @Override int process(Callback[] callbacks, int state); @Override Principal getPrincipal(); @Override void onLoginSuccess(MessageInfo messageInfo, Map requestParamsMap, HttpServletRequest request,
            HttpServletResponse response, SSOToken ssoToken); @Override void onLoginFailure(Map requestParamsMap, HttpServletRequest request, HttpServletResponse response); @Override void onLogout(HttpServletRequest request, HttpServletResponse response, SSOToken ssoToken); }
PersistentCookieAuthModule extends JaspiAuthModuleWrapper<JwtSessionModule> { @Override public int process(Callback[] callbacks, int state) throws LoginException { switch (state) { case ISAuthConstants.LOGIN_START: { setUserSessionProperty(JwtSessionModule.TOKEN_IDLE_TIME_CLAIM_KEY, tokenIdleTime.toString()); setUserSessionProperty(JwtSessionModule.MAX_TOKEN_LIFE_KEY, maxTokenLife.toString()); setUserSessionProperty(SECURE_COOKIE_KEY, Boolean.toString(secureCookie)); setUserSessionProperty(HTTP_ONLY_COOKIE_KEY, Boolean.toString(httpOnlyCookie)); final Subject clientSubject = new Subject(); MessageInfo messageInfo = prepareMessageInfo(getHttpServletRequest(), getHttpServletResponse()); if (process(messageInfo, clientSubject, callbacks)) { return ISAuthConstants.LOGIN_SUCCEED; } throw new AuthLoginException(AUTH_RESOURCE_BUNDLE_NAME, "cookieNotValid", null); } default: { throw new AuthLoginException(AUTH_RESOURCE_BUNDLE_NAME, "incorrectState", null); } } } PersistentCookieAuthModule();  PersistentCookieAuthModule(JwtSessionModule jwtSessionModule, AMKeyProvider amKeyProvider); @Override int process(Callback[] callbacks, int state); @Override Principal getPrincipal(); @Override void onLoginSuccess(MessageInfo messageInfo, Map requestParamsMap, HttpServletRequest request,
            HttpServletResponse response, SSOToken ssoToken); @Override void onLoginFailure(Map requestParamsMap, HttpServletRequest request, HttpServletResponse response); @Override void onLogout(HttpServletRequest request, HttpServletResponse response, SSOToken ssoToken);  }