use of org.gluu.oxauth.model.common.SessionId in project oxAuth by GluuFederation.
the class SessionIdServiceTest method testUpdateLastUsedDate.
@Parameters({ "userInum" })
@Test
public void testUpdateLastUsedDate(String userInum) {
SessionId m_sessionId = generateSession(userInum);
final SessionId fromLdap1 = m_service.getSessionId(m_sessionId.getId());
final Date createdDate = m_sessionId.getLastUsedAt();
System.out.println("Created date = " + createdDate);
Assert.assertEquals(createdDate, fromLdap1.getLastUsedAt());
sleepSeconds(1);
m_service.updateSessionId(m_sessionId);
final SessionId fromLdap2 = m_service.getSessionId(m_sessionId.getId());
System.out.println("Updated date = " + fromLdap2.getLastUsedAt());
Assert.assertTrue(createdDate.before(fromLdap2.getLastUsedAt()));
}
use of org.gluu.oxauth.model.common.SessionId in project oxAuth by GluuFederation.
the class SessionIdServiceTest method testUpdateAttributes.
@Parameters({ "userInum" })
@Test
public void testUpdateAttributes(String userInum) {
SessionId m_sessionId = generateSession(userInum);
final String clientId = "testClientId";
final SessionId fromLdap1 = m_service.getSessionId(m_sessionId.getId());
final Date createdDate = m_sessionId.getLastUsedAt();
assertEquals(createdDate, fromLdap1.getLastUsedAt());
assertFalse(fromLdap1.isPermissionGrantedForClient(clientId));
sleepSeconds(1);
m_sessionId.setAuthenticationTime(new Date());
m_sessionId.addPermission(clientId, true);
m_service.updateSessionId(m_sessionId);
final SessionId fromLdap2 = m_service.getSessionId(m_sessionId.getId());
assertTrue(createdDate.before(fromLdap2.getLastUsedAt()));
assertNotNull(fromLdap2.getAuthenticationTime());
assertTrue(fromLdap2.isPermissionGrantedForClient(clientId));
}
Aggregations