Search in sources :

Example 1 with GluuFido2Device

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;
}
Also used : Filter(org.gluu.search.filter.Filter) GluuFido2Device(org.gluu.oxtrust.model.GluuFido2Device) EntryPersistenceException(org.gluu.persist.exception.EntryPersistenceException)

Example 2 with GluuFido2Device

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());
    }
}
Also used : GluuDeviceDataBean(org.gluu.oxtrust.model.fido.GluuDeviceDataBean) GluuFido2Device(org.gluu.oxtrust.model.GluuFido2Device) ValidatorException(javax.faces.validator.ValidatorException) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) DuplicateEmailException(org.gluu.oxtrust.exception.DuplicateEmailException) IOException(java.io.IOException)

Example 3 with GluuFido2Device

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;
}
Also used : Filter(org.gluu.search.filter.Filter) GluuFido2Device(org.gluu.oxtrust.model.GluuFido2Device) EntryPersistenceException(org.gluu.persist.exception.EntryPersistenceException)

Aggregations

GluuFido2Device (org.gluu.oxtrust.model.GluuFido2Device)3 EntryPersistenceException (org.gluu.persist.exception.EntryPersistenceException)2 Filter (org.gluu.search.filter.Filter)2 IOException (java.io.IOException)1 ValidatorException (javax.faces.validator.ValidatorException)1 DuplicateEmailException (org.gluu.oxtrust.exception.DuplicateEmailException)1 GluuDeviceDataBean (org.gluu.oxtrust.model.fido.GluuDeviceDataBean)1 BasePersistenceException (org.gluu.persist.exception.BasePersistenceException)1