use of org.gluu.oxauth.model.fido.u2f.RequestMessageLdap in project oxAuth by GluuFederation.
the class CleanerTimerTest method u2fRequest_whichIsExpiredAndDeletable_MustBeRemoved.
@Test
public void u2fRequest_whichIsExpiredAndDeletable_MustBeRemoved() throws StringEncrypter.EncryptionException {
final Client client = createClient();
clientService.persist(client);
// 1. create token
String userInum = "";
String appId = "https://testapp.com";
final RequestMessageLdap request = u2fRegistrationService.storeRegisterRequestMessage(u2fRegistrationService.builRegisterRequestMessage(appId, userInum), userInum, userInum);
// 2. request exists
assertNotNull(u2fRegistrationService.getRegisterRequestMessage(request.getId()));
// 3. clean up
cleanerTimer.processImpl();
cacheService.clear();
// 4. request exists
assertNotNull(u2fRegistrationService.getRegisterRequestMessage(request.getId()));
final Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MINUTE, -10);
request.setExpirationDate(calendar.getTime());
u2fRegistrationService.merge(request);
// 5. clean up
cleanerTimer.processImpl();
cacheService.clear();
// 6. no request in persistence
try {
u2fRegistrationService.getRegisterRequestMessage(request.getId());
throw new AssertionError("No exception, expected EntryPersistenceException on find request.");
} catch (EntryPersistenceException e) {
// ignore
}
}
use of org.gluu.oxauth.model.fido.u2f.RequestMessageLdap in project oxAuth by GluuFederation.
the class RequestService method getExpiredRequestMessages.
public List<RequestMessageLdap> getExpiredRequestMessages(BatchOperation<RequestMessageLdap> batchOperation, Date expirationDate, String[] returnAttributes, int sizeLimit, int chunkSize) {
// ou=u2f,o=gluu
final String u2fBaseDn = staticConfiguration.getBaseDn().getU2fBase();
Filter expirationFilter = Filter.createLessOrEqualFilter("creationDate", ldapEntryManager.encodeTime(u2fBaseDn, expirationDate));
List<RequestMessageLdap> requestMessageLdap = ldapEntryManager.findEntries(u2fBaseDn, RequestMessageLdap.class, expirationFilter, SearchScope.SUB, returnAttributes, batchOperation, 0, sizeLimit, chunkSize);
return requestMessageLdap;
}
Aggregations