AnsweredAssumed Answered

How to distribute an assigned software token in Java using the RSA AM 8.1 API

Question asked by Ran Yohai on Oct 9, 2017
Latest reply on Oct 26, 2017 by Daniel Oderbolz

Hi,

 

I have to have the ability in Java to distribute a software token (SecureID token), which has already been assigned to a user, using the RSA Authentication Manager 8.1 API.

 

Here are two of my attempts to do so, without any success:

 

First attempt


LookupTokenCommand tokenCmd = new LookupTokenCommand();
tokenCmd.setSerialNumber(tokenSerialNumber);
tokenCmd.execute();
String tokenGuid = tokenCmd.getToken().getId();

String[] tokensGuids = new String[1];
tokensGuids[0] = tokenGuid;

AMTokenAttributeValueDTO[] attributes = new AMTokenAttributeValueDTO[2];
attributes[0] = new AMTokenAttributeValueDTO();
attributes[0].setTokenGUID(tokenGuid);
attributes[0].setId("DeviceSerialNumber");
attributes[0].setValue("blablabla");
attributes[1] = new AMTokenAttributeValueDTO();
attributes[1].setTokenGUID(tokenGuid);
attributes[1].setId("Nickname");
attributes[1].setValue("ran test");

DistributeSoftTokenRequest request = new DistributeSoftTokenRequest();
request.setSoftTokenProfileGuid(requiredProfile.getGuid());
request.setTokenGuids(tokensGuids);
request.setProtectedMethod(DistributeSoftTokenRequest.ST_PROTECTED_NONE);
request.setOutputMethod(DistributeSoftTokenRequest.ST_OUTPUT_ONE_PER_FILE);
request.setCopyProtected(true);
request.setRegenerateSeed(true);
request.setDeviceTypeGuid(requiredDeviceType.getGuid());
request.setDeviceType("Android");
request.setTokenAttrValueDTOs(attributes);

IssueSoftwareTokensCommand issueCmd = new IssueSoftwareTokensCommand(request);
issueCmd.execute(); // <- Here I get an error

Error message:

com.rsa.command.exception.InvalidArgumentException: Missing device type

 

Second attempt


LookupTokenCommand tokenCmd = new LookupTokenCommand();
tokenCmd.setSerialNumber(tokenSerialNumber);
tokenCmd.execute();
String tokenGuid = tokenCmd.getToken().getId();

String[] tokensGuids = new String[1];
tokensGuids[0] = tokenGuid;

IssueSoftwareTokensCommand issueCmd = new IssueSoftwareTokensCommand();
IssueSoftTokenRequest req = new IssueSoftTokenRequest();
req.setTokenGuids(tokensGuids);
req.setProtectedMethod(IssueSoftTokenRequestBase.ST_PROTECTED_NONE);
issueCmd.setRequest(req);
issueCmd.execute(); // <- Here I get an error

Error message:

com.rsa.command.exception.InvalidArgumentException: Missing device type

 

Thanks in advance for any help!

 

Ran

Outcomes