Skip to content
Snippets Groups Projects
Commit a0583c4d authored by Ndèye Anna Ndiaye's avatar Ndèye Anna Ndiaye Committed by Adrien Béraud
Browse files

Display Name shown for enrolled device

Change-Id: Ib4d4802550ab4bcf0f1c5a42032a8f17f58d9850
parent 9aef10f3
No related branches found
No related tags found
No related merge requests found
......@@ -48,13 +48,17 @@ public class RegisterDeviceFlow {
StatementList statementList = new StatementList();
statementList.addStatement(new StatementElement("username", "=", username, ""));
User user = dataStore.getUserDao().getObjects(statementList).get(0);
UserProfile userProfile = userAuthenticationModule.getAuthSources()
.get(new AuthModuleKey(user.getRealm(),user.getUserType()))
.getUserProfile(username,"LOGON_NAME")[0];
if (user == null) {
log.error("Tried to enroll a device, but could not find a user, this is impossible!");
}
Device device = new Device();
device.setCertificationRequest(registrationRequest.getCsr());
device.setOwner(username);
device.setDisplayName(registrationRequest.getDeviceName());
device.setDisplayName(userProfile.getFirstName()+" "+userProfile.getLastName());
  • Developer

    Okay so we need to be careful here, this does temporarily fix the issue, but I see several very rough moments here:

    1. If somehow the first name or last name are null, this will throw an NPE.
    2. The "displayName" was originally the used for this and this is correct, however we still need to have the deviceName, I think the issue here is the displayName is actually what you want to send out...

    Did you test these with Jami and did you check that this does generate the correct result?

  • Yes it does send the correct result. I don't understand what you mean in point 2. We still need the device name so what do you suggest ? Should we put it somewhere esle or change the Device Model Object.

  • Please register or sign in to reply
device = certificateAuthority.getSignedCertificate(user, device);
if(device == null){
log.error("Could not succesfully create a device certificate!");
......@@ -71,10 +75,6 @@ public class RegisterDeviceFlow {
response.setDisplayName(device.getDisplayName());
//We need to set
response.setNameServer(nameServer.getURI());
UserProfile userProfile = userAuthenticationModule.getAuthSources()
.get(new AuthModuleKey(user.getRealm(),user.getUserType()))
.getUserProfile(username,"LOGON_NAME")[0];
if(userProfile.getProfilePicture() != null) response.setUserPhoto(userProfile.getProfilePicture());
//Finally we set the certificate chain.
response.setCertificateChain(new X509Certificate[]{certificateAuthority.getCA(),user.getCertificate(),device.getCertificate()});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment