public void setUser()

in src/main/java/com/lambdajavablockchain/service/ManagedBlockchainService.java [101:117]


    public void setUser(String userId) throws Exception {
        // Check if user is has enrollment credentials on AWS Secrets Manager
        Enrollment enrollment = SecretsManagerUtil.getFabricEnrollment(userId, AMBConfig.ORG1);

        // create Fabric user context
        FabricUser fabricUser = new FabricUser(userId, AMBConfig.ORG1, AMBConfig.ORG1_MSP, enrollment);

        // check that the client has been properly setup
        if (client == null) {
            log.error("Client not initialized. Run ManagedBlockchainService.setupClient() first");
            throw new ManagedBlockchainServiceException("Client not initialized!");
        }

        // Set client to act on behalf of userId
        client.setUserContext(fabricUser);
        log.info("Using " + userId + " user context");
    }