0

我正在开发一个系统来为用户分配下一个可用的软件令牌,使用 RSA Authentication Manager 7.1 Developer's Guide 和相应的这个 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();
        }

    }
4

1 回答 1

0

更好地使用 AM 8.1SP1 或 AM 8.2 它具有内置以基于 url 或基于文件分发令牌。

于 2016-07-27T12:42:51.993 回答