use of com.zimbra.cs.account.ZimbraAuthToken in project zm-mailbox by Zimbra.
the class TestCookieReuse method testOldClientSupport.
/**
* Test old behavior: tokens appear to be registered even when they are not registered when lowest
* supported auth version is set to 1
* @throws Exception
*/
@Test
public void testOldClientSupport() throws Exception {
Account a = TestUtil.getAccount(USER_NAME);
ZimbraAuthToken at = new ZimbraAuthToken(a, System.currentTimeMillis() - 1000);
Assert.assertTrue("token should be registered", at.isRegistered());
at.deRegister();
Assert.assertFalse("token should not be registered", at.isRegistered());
// lowering supported auth version should allow unregistered cookies
Provisioning.getInstance().getLocalServer().setLowestSupportedAuthVersion(1);
Assert.assertTrue("token should appear to be registered", at.isRegistered());
// raising supported auth version should not allow unregistered cookies
Provisioning.getInstance().getLocalServer().setLowestSupportedAuthVersion(2);
Assert.assertFalse("token should not be registered", at.isRegistered());
}
Aggregations