使用RSA SecurID API/SDK for JAVA分发软件令牌

使用RSA SecurID API/SDK for JAVA分发软件令牌,java,api,securid,Java,Api,Securid,我正在开发一个系统,为用户分配下一个可用的软件令牌,使用RSA Authentication Manager 7.1开发者指南和相应的JAVA API参考发布和分发它 问题是,关于生成的软件令牌的子类型和要导出的文件格式,我不清楚一些要点 下面是我制作的源代码,我的怀疑依赖于评论 private void assignNextAvailableTokenToUser(String userGuid, String admGuid) throws CommandException,

我正在开发一个系统,为用户分配下一个可用的软件令牌,使用RSA Authentication Manager 7.1开发者指南和相应的JAVA API参考发布和分发它

问题是,关于生成的软件令牌的子类型和要导出的文件格式,我不清楚一些要点

下面是我制作的源代码,我的怀疑依赖于评论

private void assignNextAvailableTokenToUser(String userGuid, String admGuid)
        throws CommandException, IOException {
        GetNextAvailableTokenCommand cmd = new GetNextAvailableTokenCommand();

        try {
            cmd.execute();  
        } catch (DataNotFoundException e) {
            System.out.println("ERROR: No tokens available");
            return;
        }

        String[] tokens = new String[] { cmd.getToken().getId() };
        // how can I guarantee that only software tokens will be assign to the user ???
        LinkTokensWithPrincipalCommand cmd2 = new LinkTokensWithPrincipalCommand(tokens, userGuid);
        cmd2.execute();
        System.out.println("Assigned next available SecurID token to user " + USER_NAME);

        IssueSoftwareTokensCommand issueCmd = new IssueSoftwareTokensCommand();

        DistributeSoftTokenRequest  disToken = new DistributeSoftTokenRequest();

        SoftTokenDeviceInfoDTO  softwareTokenDeviceDTO = new SoftTokenDeviceInfoDTO();

        softwareTokenDeviceDTO.setAlgorithm(SoftTokenDeviceInfoDTO.ST_FILE_FORMAT_SDTID3);
        softwareTokenDeviceDTO.setMaxTokensPerFile(SoftTokenDeviceInfoDTO.ST_MAX_PER_FILE_UNLIMITED);        
        softwareTokenDeviceDTO.setFileFormat(SoftTokenDeviceInfoDTO.ST_FILE_FORMAT_SDTID3);
        // how to link the information above with IssueSoftwareTokensCommand ??

        String[] tokensGuid = new String[]{cmd.getToken().getId()};

        disToken.setTokenGuids(tokensGuid);
        disToken.setProtectedMethod(DistributeSoftTokenRequest.ST_PROTECTED_BY_PASSWORD);
        disToken.setPassword("xpto");
        disToken.setCopyProtected(true);
        disToken.setDeviceType("?????????"); //how to fill this parameter for android or ios ??        
        disToken.setDeviceTypePluginModuleName("???????"); //how to fill this parameter for android or ios ?? 
        disToken.setOutputMethod(DistributeSoftTokenRequest.ST_OUTPUT_ONE_PER_FILE);
        disToken.setRegenerateSeed(true);        
        disToken.setPinAdded(true);
        disToken.setOtpAlgorithm(DistributeSoftTokenRequest.OTPAlgorithm.EVENT);
        disToken.setOtpInterval(DistributeSoftTokenRequest.OTPInterval.SIXTY_SECONDS);
        disToken.setOtpLength(DistributeSoftTokenRequest.OTPLength.SIX_DIGITS);

        issueCmd.setRequest(disToken);

        ConnectionFactory.executeCommand(admGuid, issueCmd);

        String fileName = issueCmd.getFileId();

        GetSoftwareTokenFileCommand getSoftwareTokenFileCommand = new GetSoftwareTokenFileCommand(fileName);

        getSoftwareTokenFileCommand.execute();

        byte[] fileContent = getSoftwareTokenFileCommand.getFileContent();

        FileOutputStream stream = new FileOutputStream("C:\\tokens\\" + fileName);
        try {
            stream.write(fileContent);
        } finally {
            stream.close();
        }

    }

最好使用内置的AM 8.1SP1或AM 8.2来分发基于url或基于文件的令牌