use of org.gluu.oxtrust.model.fido.GluuDeviceDataBean in project oxTrust by GluuFederation.
the class UpdatePersonAction method update.
/**
* Initializes attributes for updating person
*
* @return String describing success of the operation
* @throws Exception
*/
public String update() {
if (this.person != null) {
return OxTrustConstants.RESULT_SUCCESS;
}
this.update = true;
try {
this.person = personService.getPersonByInum(inum);
} catch (BaseMappingException ex) {
log.error("Failed to find person {}", inum, ex);
facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to find person");
conversationService.endConversation();
return OxTrustConstants.RESULT_FAILURE;
}
initAttributes(false);
try {
this.gluuStatus = this.person.getStatus();
List<String> oxexternal = this.person.getOxExternalUid();
externalAuthCustomAttributes = new ArrayList<String>();
if (oxexternal != null && oxexternal.size() > 0) {
for (String oxexternalStr : oxexternal) {
String[] args = oxexternalStr.split(":");
externalAuthCustomAttributes.add(args[0]);
}
}
List<GluuCustomFidoDevice> gluuCustomFidoDevices = fidoDeviceService.searchFidoDevices(this.person.getInum(), null);
deviceDataMap = new ArrayList<GluuDeviceDataBean>();
if (gluuCustomFidoDevices != null) {
for (GluuCustomFidoDevice gluuCustomFidoDevice : gluuCustomFidoDevices) {
GluuDeviceDataBean gluuDeviceDataBean = new GluuDeviceDataBean();
gluuDeviceDataBean.setCreationDate(ldapEntryManager.decodeGeneralizedTime(gluuCustomFidoDevice.getCreationDate()).toGMTString());
gluuDeviceDataBean.setId(gluuCustomFidoDevice.getId());
String devicedata = gluuCustomFidoDevice.getDeviceData();
String modality = "";
String nickName = "";
if (devicedata != null) {
DeviceData deviceData = getDeviceata(devicedata);
// nickName = deviceData.getName();
nickName = gluuCustomFidoDevice.getNickname();
modality = "Super-Gluu Device";
} else {
// nickName = "U2F";
nickName = gluuCustomFidoDevice.getNickname();
modality = "U2F device";
}
gluuDeviceDataBean.setNickName(nickName);
gluuDeviceDataBean.setModality(modality);
deviceDataMap.add(gluuDeviceDataBean);
}
}
if (oxexternal != null && oxexternal.size() > 0) {
for (String oxexternalStr : oxexternal) {
String[] args = oxexternalStr.split(":");
GluuDeviceDataBean gluuDeviceDataBean = new GluuDeviceDataBean();
gluuDeviceDataBean.setNickName(args[0]);
gluuDeviceDataBean.setModality(args[0]);
gluuDeviceDataBean.setId(oxexternalStr);
deviceDataMap.add(gluuDeviceDataBean);
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
userPasswordAction.setPerson(this.person);
return OxTrustConstants.RESULT_SUCCESS;
}
Aggregations