use of org.xdi.oxauth.model.fido.u2f.RequestMessageLdap in project oxAuth by GluuFederation.
the class RegistrationService method storeRegisterRequestMessage.
public void storeRegisterRequestMessage(RegisterRequestMessage requestMessage, String userInum, String sessionState) {
Date now = new GregorianCalendar(TimeZone.getTimeZone("UTC")).getTime();
final String registerRequestMessageId = UUID.randomUUID().toString();
RequestMessageLdap registerRequestMessageLdap = new RegisterRequestMessageLdap(getDnForRegisterRequestMessage(registerRequestMessageId), registerRequestMessageId, now, sessionState, userInum, requestMessage);
ldapEntryManager.persist(registerRequestMessageLdap);
}
use of org.xdi.oxauth.model.fido.u2f.RequestMessageLdap in project oxAuth by GluuFederation.
the class RequestService method getExpiredRequestMessages.
public List<RequestMessageLdap> getExpiredRequestMessages(BatchOperation<RequestMessageLdap> batchOperation, Date expirationDate) {
// ou=u2f,o=@!1111,o=gluu
final String u2fBaseDn = staticConfiguration.getBaseDn().getU2fBase();
Filter expirationFilter = Filter.createLessOrEqualFilter("creationDate", ldapEntryManager.encodeGeneralizedTime(expirationDate));
List<RequestMessageLdap> requestMessageLdap = ldapEntryManager.findEntries(u2fBaseDn, RequestMessageLdap.class, expirationFilter, SearchScope.SUB, null, batchOperation, 0, CleanerTimer.BATCH_SIZE, CleanerTimer.BATCH_SIZE);
return requestMessageLdap;
}
use of org.xdi.oxauth.model.fido.u2f.RequestMessageLdap in project oxAuth by GluuFederation.
the class CleanerTimer method processU2fRequests.
private void processU2fRequests() {
log.debug("Start U2F request clean up");
Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
calendar.add(Calendar.SECOND, -90);
final Date expirationDate = calendar.getTime();
BatchOperation<RequestMessageLdap> requestMessageLdapBatchService = new BatchOperation<RequestMessageLdap>(ldapEntryManager) {
@Override
protected List<RequestMessageLdap> getChunkOrNull(int chunkSize) {
return u2fRequestService.getExpiredRequestMessages(this, expirationDate);
}
@Override
protected void performAction(List<RequestMessageLdap> entries) {
for (RequestMessageLdap requestMessageLdap : entries) {
try {
log.debug("Removing RequestMessageLdap: {}, Creation date: {}", requestMessageLdap.getRequestId(), requestMessageLdap.getCreationDate());
u2fRequestService.removeRequestMessage(requestMessageLdap);
} catch (Exception e) {
log.error("Failed to remove entry", e);
}
}
}
};
requestMessageLdapBatchService.iterateAllByChunks(BATCH_SIZE);
log.debug("End U2F request clean up");
}
Aggregations