SimpleTokenManager implements TokenManager { @Override public Cookie createSecureTokenCookie(SignedJWT token) { Cookie cookie = new Cookie(TOKEN_NAME, token.serialize()); cookie.setSecure(true); cookie.setPath("/"); cookie.setMaxAge((int) (tokenDuration / 1000)); return cookie; }  @Activate void start(Map<String, Object> props); @Modified void modified(Map<String, Object> props); @Override Optional<SignedJWT> verifyToken(String tokenString); @Override SignedJWT generateUnauthToken(); @Override SignedJWT generateAuthToken(String username); @Override String getTokenString(ContainerRequestContext requestContext); @Override String getTokenString(HttpServletRequest servletRequest); @Override Cookie createSecureTokenCookie(SignedJWT token); @Override NewCookie createSecureTokenNewCookie(SignedJWT token);  }
@Test public void createSecureTokenCookieTest() { Cookie result = manager.createSecureTokenCookie(jwt); assertEquals(SimpleTokenManager.TOKEN_NAME, result.getName()); assertEquals(MOBI_TOKEN, result.getValue()); assertTrue(result.getSecure()); assertEquals("/", result.getPath()); }