use of org.gluu.oxtrust.model.GluuFido2Device in project oxTrust by GluuFederation.
the class Fido2DeviceService method getGluuCustomFidoDeviceById.
public GluuFido2Device getGluuCustomFidoDeviceById(String id, String userId) {
GluuFido2Device gluuCustomFidoDevice = null;
try {
String dn = getDnForFido2Device(id, userId);
if (StringUtils.isNotEmpty(userId))
gluuCustomFidoDevice = ldapEntryManager.find(GluuFido2Device.class, dn);
else {
Filter filter = Filter.createEqualityFilter("oxId", id);
gluuCustomFidoDevice = ldapEntryManager.findEntries(dn, GluuFido2Device.class, filter).get(0);
}
} catch (Exception e) {
log.error("Failed to find device by id " + id, e);
}
return gluuCustomFidoDevice;
}
use of org.gluu.oxtrust.model.GluuFido2Device in project oxTrust by GluuFederation.
the class UpdatePersonAction method addFido2Devices.
@SuppressWarnings("deprecation")
private void addFido2Devices() {
try {
List<GluuFido2Device> fido2Devices = fido2DeviceService.findAllFido2Devices(this.person);
if (fido2Devices != null && fido2Devices.size() > 0) {
for (GluuFido2Device entry : fido2Devices) {
GluuDeviceDataBean gluuDeviceDataBean = new GluuDeviceDataBean();
gluuDeviceDataBean.setId(entry.getId());
String convertedDate = ldapEntryManager.decodeTime(null, ldapEntryManager.encodeTime(null, entry.getCreationDate())).toGMTString();
gluuDeviceDataBean.setCreationDate(convertedDate.toString());
gluuDeviceDataBean.setModality("FIDO2");
gluuDeviceDataBean.setNickName(entry.getDisplayName() != null ? entry.getDisplayName() : DASH);
deviceDataMap.add(gluuDeviceDataBean);
}
}
} catch (Exception e) {
log.warn("No fido2 devices enrolled for " + this.person.getDisplayName());
}
}
use of org.gluu.oxtrust.model.GluuFido2Device in project oxTrust by GluuFederation.
the class Fido2DeviceService method getFido2DeviceById.
public GluuFido2Device getFido2DeviceById(String userId, String id) {
GluuFido2Device f2d = null;
try {
String dn = getDnForFido2Device(id, userId);
if (StringUtils.isNotEmpty(userId)) {
f2d = ldapEntryManager.find(GluuFido2Device.class, dn);
} else {
Filter filter = Filter.createEqualityFilter("oxId", id);
f2d = ldapEntryManager.findEntries(dn, GluuFido2Device.class, filter).get(0);
}
} catch (Exception e) {
log.error("Failed to find Fido 2 device with id " + id, e);
}
return f2d;
}
Aggregations