public DescribeUserScramCredentialsResponseData describe(DescribeUserScramCredentialsRequestData request) {
        List<UserName> users = request.users();
        Map<String, Boolean> uniqueUsers = new HashMap<>();

        if ((users == null) || (users.isEmpty())) {
            // If there are no users listed then get all the users
            for (Map<String, ScramCredentialData> scramCredentialDataSet : mechanisms.values()) {
                for (String user : scramCredentialDataSet.keySet()) {
                    uniqueUsers.put(user, false);
                }
            }
        } else {
            // Filter out duplicates
            for (UserName user : users) {
                if (uniqueUsers.containsKey(user.name())) {
                    uniqueUsers.put(user.name(), true);
                } else {
                    uniqueUsers.put(user.name(), false);
                }
            }
        }

        DescribeUserScramCredentialsResponseData retval = new DescribeUserScramCredentialsResponseData();

        for (Map.Entry<String, Boolean> user : uniqueUsers.entrySet()) {
            DescribeUserScramCredentialsResult result = new DescribeUserScramCredentialsResult().setUser(user.getKey());

            if (!user.getValue()) {
                boolean datafound = false;
                List<CredentialInfo> credentialInfos = new ArrayList<>();
                for (Map.Entry<ScramMechanism, Map<String, ScramCredentialData>> mechanismsEntry : mechanisms.entrySet()) {
                    Map<String, ScramCredentialData> credentialDataSet = mechanismsEntry.getValue();
                    if (credentialDataSet.containsKey(user.getKey())) {
                        credentialInfos.add(new CredentialInfo().setMechanism(mechanismsEntry.getKey().type())
                                                                .setIterations(credentialDataSet.get(user.getKey()).iterations()));
                        datafound = true;
                    }
                }
                if (datafound) {
                    result.setCredentialInfos(credentialInfos);
                } else {
                    result.setErrorCode(Errors.RESOURCE_NOT_FOUND.code())
                          .setErrorMessage(DESCRIBE_USER_THAT_DOES_NOT_EXIST + user.getKey());
                }
            } else {
                result.setErrorCode(Errors.DUPLICATE_RESOURCE.code())
                      .setErrorMessage(DESCRIBE_DUPLICATE_USER + user.getKey());
            }
            retval.results().add(result);
        }
        return retval;
    }
Represents the SCRAM credentials in the metadata image.

This class is thread-safe.
metadata/src/main/java/org/apache/kafka/image/ScramImage.java