@Test public void shouldInitialisePostAuthProcess() throws SSOException, AuthenticationException { Map requestParamsMap = new HashMap(); HttpServletRequest request = mock(HttpServletRequest.class); HttpServletResponse response = mock(HttpServletResponse.class); SSOToken ssoToken = mock(SSOToken.class); given(ssoToken.getProperty(JwtSessionModule.TOKEN_IDLE_TIME_CLAIM_KEY)).willReturn("TOKEN_IDLE_TIME"); given(ssoToken.getProperty(JwtSessionModule.MAX_TOKEN_LIFE_KEY)).willReturn("TOKEN_MAX_LIFE"); given(ssoToken.getProperty("openam-auth-persistent-cookie-domains")).willReturn(""); Map<String, Object> config = persistentCookieAuthModule.initialize(requestParamsMap, request, response, ssoToken); assertEquals(config.size(), 9); assertEquals(config.get(JwtSessionModule.KEY_ALIAS_KEY), "KEY_ALIAS"); assertEquals(config.get(JwtSessionModule.PRIVATE_KEY_PASSWORD_KEY), "PRIVATE_KEY_PASS"); assertEquals(config.get(JwtSessionModule.KEYSTORE_TYPE_KEY), "KEYSTORE_TYPE"); assertEquals(config.get(JwtSessionModule.KEYSTORE_FILE_KEY), "KEYSTORE_FILE_PATH"); assertEquals(config.get(JwtSessionModule.KEYSTORE_PASSWORD_KEY), "KEYSTORE_PASS"); assertEquals(config.get(JwtSessionModule.TOKEN_IDLE_TIME_CLAIM_KEY), "TOKEN_IDLE_TIME"); assertEquals(config.get(JwtSessionModule.MAX_TOKEN_LIFE_KEY), "TOKEN_MAX_LIFE"); }
@Override protected Map<String, Object> initialize(Subject subject, Map sharedState, Map options) { String idleTimeString = CollectionHelper.getMapAttr(options, COOKIE_IDLE_TIMEOUT_SETTING_KEY); String maxLifeString = CollectionHelper.getMapAttr(options, COOKIE_MAX_LIFE_SETTING_KEY); if (StringUtils.isEmpty(idleTimeString)) { DEBUG.warning("Cookie Idle Timeout not set. Defaulting to 0"); idleTimeString = "0"; } if (StringUtils.isEmpty(maxLifeString)) { DEBUG.warning("Cookie Max Life not set. Defaulting to 0"); maxLifeString = "0"; } tokenIdleTime = Integer.parseInt(idleTimeString) * MINUTES_IN_HOUR; maxTokenLife = Integer.parseInt(maxLifeString) * MINUTES_IN_HOUR; secureCookie = CollectionHelper.getBooleanMapAttr(options, SECURE_COOKIE_KEY, true); httpOnlyCookie = CollectionHelper.getBooleanMapAttr(options, HTTP_ONLY_COOKIE_KEY, true); try { return initialize(tokenIdleTime.toString(), maxTokenLife.toString(), getRequestOrg(), secureCookie, httpOnlyCookie); } catch (SMSException e) { DEBUG.error("Error initialising Authentication Module", e); return null; } catch (SSOException e) { DEBUG.error("Error initialising Authentication Module", e); return null; } }
PersistentCookieAuthModule extends JaspiAuthModuleWrapper<JwtSessionModule> { @Override protected Map<String, Object> initialize(Subject subject, Map sharedState, Map options) { String idleTimeString = CollectionHelper.getMapAttr(options, COOKIE_IDLE_TIMEOUT_SETTING_KEY); String maxLifeString = CollectionHelper.getMapAttr(options, COOKIE_MAX_LIFE_SETTING_KEY); if (StringUtils.isEmpty(idleTimeString)) { DEBUG.warning("Cookie Idle Timeout not set. Defaulting to 0"); idleTimeString = "0"; } if (StringUtils.isEmpty(maxLifeString)) { DEBUG.warning("Cookie Max Life not set. Defaulting to 0"); maxLifeString = "0"; } tokenIdleTime = Integer.parseInt(idleTimeString) * MINUTES_IN_HOUR; maxTokenLife = Integer.parseInt(maxLifeString) * MINUTES_IN_HOUR; secureCookie = CollectionHelper.getBooleanMapAttr(options, SECURE_COOKIE_KEY, true); httpOnlyCookie = CollectionHelper.getBooleanMapAttr(options, HTTP_ONLY_COOKIE_KEY, true); try { return initialize(tokenIdleTime.toString(), maxTokenLife.toString(), getRequestOrg(), secureCookie, httpOnlyCookie); } catch (SMSException e) { DEBUG.error("Error initialising Authentication Module", e); return null; } catch (SSOException e) { DEBUG.error("Error initialising Authentication Module", e); return null; } } }
PersistentCookieAuthModule extends JaspiAuthModuleWrapper<JwtSessionModule> { @Override protected Map<String, Object> initialize(Subject subject, Map sharedState, Map options) { String idleTimeString = CollectionHelper.getMapAttr(options, COOKIE_IDLE_TIMEOUT_SETTING_KEY); String maxLifeString = CollectionHelper.getMapAttr(options, COOKIE_MAX_LIFE_SETTING_KEY); if (StringUtils.isEmpty(idleTimeString)) { DEBUG.warning("Cookie Idle Timeout not set. Defaulting to 0"); idleTimeString = "0"; } if (StringUtils.isEmpty(maxLifeString)) { DEBUG.warning("Cookie Max Life not set. Defaulting to 0"); maxLifeString = "0"; } tokenIdleTime = Integer.parseInt(idleTimeString) * MINUTES_IN_HOUR; maxTokenLife = Integer.parseInt(maxLifeString) * MINUTES_IN_HOUR; secureCookie = CollectionHelper.getBooleanMapAttr(options, SECURE_COOKIE_KEY, true); httpOnlyCookie = CollectionHelper.getBooleanMapAttr(options, HTTP_ONLY_COOKIE_KEY, true); try { return initialize(tokenIdleTime.toString(), maxTokenLife.toString(), getRequestOrg(), secureCookie, httpOnlyCookie); } catch (SMSException e) { DEBUG.error("Error initialising Authentication Module", e); return null; } catch (SSOException e) { DEBUG.error("Error initialising Authentication Module", e); return null; } } PersistentCookieAuthModule();  PersistentCookieAuthModule(JwtSessionModule jwtSessionModule, AMKeyProvider amKeyProvider); }
PersistentCookieAuthModule extends JaspiAuthModuleWrapper<JwtSessionModule> { @Override protected Map<String, Object> initialize(Subject subject, Map sharedState, Map options) { String idleTimeString = CollectionHelper.getMapAttr(options, COOKIE_IDLE_TIMEOUT_SETTING_KEY); String maxLifeString = CollectionHelper.getMapAttr(options, COOKIE_MAX_LIFE_SETTING_KEY); if (StringUtils.isEmpty(idleTimeString)) { DEBUG.warning("Cookie Idle Timeout not set. Defaulting to 0"); idleTimeString = "0"; } if (StringUtils.isEmpty(maxLifeString)) { DEBUG.warning("Cookie Max Life not set. Defaulting to 0"); maxLifeString = "0"; } tokenIdleTime = Integer.parseInt(idleTimeString) * MINUTES_IN_HOUR; maxTokenLife = Integer.parseInt(maxLifeString) * MINUTES_IN_HOUR; secureCookie = CollectionHelper.getBooleanMapAttr(options, SECURE_COOKIE_KEY, true); httpOnlyCookie = CollectionHelper.getBooleanMapAttr(options, HTTP_ONLY_COOKIE_KEY, true); try { return initialize(tokenIdleTime.toString(), maxTokenLife.toString(), getRequestOrg(), secureCookie, httpOnlyCookie); } catch (SMSException e) { DEBUG.error("Error initialising Authentication Module", e); return null; } catch (SSOException e) { DEBUG.error("Error initialising Authentication Module", e); return 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 protected Map<String, Object> initialize(Subject subject, Map sharedState, Map options) { String idleTimeString = CollectionHelper.getMapAttr(options, COOKIE_IDLE_TIMEOUT_SETTING_KEY); String maxLifeString = CollectionHelper.getMapAttr(options, COOKIE_MAX_LIFE_SETTING_KEY); if (StringUtils.isEmpty(idleTimeString)) { DEBUG.warning("Cookie Idle Timeout not set. Defaulting to 0"); idleTimeString = "0"; } if (StringUtils.isEmpty(maxLifeString)) { DEBUG.warning("Cookie Max Life not set. Defaulting to 0"); maxLifeString = "0"; } tokenIdleTime = Integer.parseInt(idleTimeString) * MINUTES_IN_HOUR; maxTokenLife = Integer.parseInt(maxLifeString) * MINUTES_IN_HOUR; secureCookie = CollectionHelper.getBooleanMapAttr(options, SECURE_COOKIE_KEY, true); httpOnlyCookie = CollectionHelper.getBooleanMapAttr(options, HTTP_ONLY_COOKIE_KEY, true); try { return initialize(tokenIdleTime.toString(), maxTokenLife.toString(), getRequestOrg(), secureCookie, httpOnlyCookie); } catch (SMSException e) { DEBUG.error("Error initialising Authentication Module", e); return null; } catch (SSOException e) { DEBUG.error("Error initialising Authentication Module", e); return 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);  }