RememberMeTokenUtil { public static LoginSessionToken getLoginSession(String token) { JWTClaimsSet claimSet = EncryptedTokenSerializer.deserialize(token, getSecretKey()); try { return new LoginSessionToken(claimSet.getStringClaim("loginSession")); } catch (ParseException e) { throw new OAuthException("expected valid loginSession in cookie", null); } }  static String serialize(LoginSessionToken loginSession, String callerPrincipal, List<String> roles); static LoginSessionToken getLoginSession(String token); static Collection<Principal> deserialize(String token); static boolean isEnabled();  }
@Test public void testGetLoginSession() { LoginSessionToken loginSession = new LoginSessionToken(); String tokenString = RememberMeTokenUtil.serialize(loginSession, "kilgrave", Arrays.asList("role1", "role2")); LoginSessionToken loginSessionExtracted = RememberMeTokenUtil.getLoginSession(tokenString); assertThat(loginSession, Matchers.is(loginSessionExtracted)); }