Announcements

SecurID® Discussions

Browse the SecurID discussion board to get product help and collaborate with other SecurID users.
v_bhalajifis
New Contributor
New Contributor

Update token with DeviceSerialNumber through SDK API.

Jump to solution

We have a requirement to update the token with DeviceSerialNumber Attribute.( To restrict import of the token to a specific Apple mobile digital device, use the UDID of that device.)

I am trying to use below code from SDK API to update token. I am not sure what value to put for  

attrs[0].setAttrDefGUID("ims.XXX"); // What Value should go here.
attrs[0].setId("ims.XXX"); // What Value should go here


below is my code.

public static void updateToken(ClientSession session) {
String tokenGUID = getGUIDforTokenSerialNumber(session,"000xxxxxxxxx");
TokenDTO token = lookup.getToken();
if(token == null) {
System.out.println("Token not found or null for serial num 000xxxxxxxxx");
}
AMTokenAttributeValueDTO[] attrs = token.getSoftTokenProfileAttrValueDTOs();
System.out.println("attrs.size"+attrs.length);
if(attrs.length <1) {
attrs = new AMTokenAttributeValueDTO[1];
attrs[0] = new AMTokenAttributeValueDTO();
attrs[0].setTokenGUID(tokenGUID);
attrs[0].setValue("a232XX5fceXXXXXXXXX"); // Binding ID or UDID of Phone.
attrs[0].setAttrDefGUID("ims.XXX"); // What Value should go here.
attrs[0].setId("ims.XXX"); // What Value should go here
}
token.setSoftTokenProfileId("ims.5a9e74df554207XXXXX"); //IPHONE
token.setSoftTokenProfileAttrValueDTOs(attrs);
UpdateTokenCommand updateCmd = new UpdateTokenCommand();
updateCmd.setToken(token);
try {
updateCmd.execute(session);
System.out.println("update success");
} catch (CommandException e1) {
e1.printStackTrace();
} catch (SystemException e1) {
e1.printStackTrace();
}
}

trying to update below value through RSA SDK APIs.

v_bhalajifis_0-1663195893455.png

Thanks,

 

Labels (2)
0 Likes
1 Solution

Accepted Solutions
v_bhalajifis
New Contributor
New Contributor

 

Below are the changes I made in code to make it work.
AMTokenAttributeValueDTO[] attrs = token.getSoftTokenProfileAttrValueDTOs();
attrs[0] = new AMTokenAttributeValueDTO();
attrs[0].setTokenGUID(tokenGUID);
attrs[0].setValue(deviceSerialNum);
attrs[0].setAttrDefGUID("ims.XXXX"); //GUID of Device Serial # attribute. got this constant value from already existing Token.
//attrs[0].setId(""); //Optional field //removed this line.
attrs[0].setSecurityDomain("ims.XXXXXXXX"); //Added this line. GUID of security Domain.

// token.setSoftTokenProfileAttrValueDTOs(attrs); //Removed this line
token.setTokenExtAttrValueDTOs(attrs); //Added this line

UpdateTokenCommand updateCmd = new UpdateTokenCommand();

 

Thanks,

View solution in original post

2 Replies
EricaChalfin
Moderator Moderator
Moderator

@v_bhalajifis,

Thank you for posting your question to the community. I edited your post to remove your token serial number from our public forum. 

I did see that your coworker opened a case with our support team yesterday asking this same question but the case was closed because you figured out how to resolve the issue. If possible, please share your solution with the community! I am sure it will be of use to others.


Best regards,
Erica
0 Likes
v_bhalajifis
New Contributor
New Contributor

 

Below are the changes I made in code to make it work.
AMTokenAttributeValueDTO[] attrs = token.getSoftTokenProfileAttrValueDTOs();
attrs[0] = new AMTokenAttributeValueDTO();
attrs[0].setTokenGUID(tokenGUID);
attrs[0].setValue(deviceSerialNum);
attrs[0].setAttrDefGUID("ims.XXXX"); //GUID of Device Serial # attribute. got this constant value from already existing Token.
//attrs[0].setId(""); //Optional field //removed this line.
attrs[0].setSecurityDomain("ims.XXXXXXXX"); //Added this line. GUID of security Domain.

// token.setSoftTokenProfileAttrValueDTOs(attrs); //Removed this line
token.setTokenExtAttrValueDTOs(attrs); //Added this line

UpdateTokenCommand updateCmd = new UpdateTokenCommand();

 

Thanks,