@Override
    public Integer save(UserRequest request, String currentUser) {
        String username = request.getName();
        UserEntity userExists = userMapper.selectByName(username);
        String password = request.getPassword();
        Preconditions.expectNull(userExists, "username [" + username + "] already exists");
        Preconditions.expectTrue(StringUtils.isNotBlank(password), "password cannot be blank");

        UserEntity entity = new UserEntity();
        entity.setName(username);
        entity.setPassword(SHAUtils.encrypt(password));
        entity.setAccountType(request.getAccountType());
        entity.setDueDate(DateUtils.getExpirationDate(request.getValidDays()));
        entity.setCreator(currentUser);
        entity.setModifier(currentUser);
        entity.setExtParams(request.getExtParams());
        try {
            Map<String, String> keyPairs = RSAUtils.generateRSAKeyPairs();
            String publicKey = keyPairs.get(RSAUtils.PUBLIC_KEY);
            String privateKey = keyPairs.get(RSAUtils.PRIVATE_KEY);
            String secretKey = RandomStringUtils.randomAlphanumeric(SECRET_KEY_SIZE);
            Integer encryptVersion = AESUtils.getCurrentVersion(null);
            entity.setEncryptVersion(encryptVersion);
            entity.setPublicKey(AESUtils.encryptToString(publicKey.getBytes(StandardCharsets.UTF_8), encryptVersion));
            entity.setPrivateKey(AESUtils.encryptToString(privateKey.getBytes(StandardCharsets.UTF_8), encryptVersion));
            entity.setSecretKey(AESUtils.encryptToString(secretKey.getBytes(StandardCharsets.UTF_8), encryptVersion));
        } catch (Exception e) {
            String errMsg = String.format("generate rsa key error: %s", e.getMessage());
            LOGGER.error(errMsg, e);
            throw new BusinessException(errMsg);
        }

        Preconditions.expectTrue(userMapper.insert(entity) > 0, "Create user failed");
        Preconditions.expectTrue(tenantRoleService.saveDefault(username, currentUser) > 0,
                "Add default tenant role failed");

        LOGGER.debug("success to create user info={}", request);
        return entity.getId();
    }
locked time, the unit is minute
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/user/UserServiceImpl.java