v_bhalajifis (Customer) to rsaSFDCadmin (RSA): asked a question.

Update token with DeviceSerialNumber through SDK API.
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](
https://community.rsa.com/t5/image/serverpage/image-
id/415652iBDF2F274E72BF973/image-size/medium?v=v2&px=400)

Thanks,

  • v_bhalajifis (Customer)

    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,
    Expand Post
    Selected as Best
  • v_bhalajifis (Customer)

    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,
    Expand Post
    Selected as Best