class ResourceAuthenticator implements IAuthenticator {

    protected static final Logger LOG = LoggerFactory.getLogger(ResourceAuthenticator.class);

    private Map<String, String> m_identities = new HashMap<>();

    public ResourceAuthenticator(IResourceLoader resourceLoader, String resourceName) {
        try {
            MessageDigest.getInstance("SHA-256");
        } catch (NoSuchAlgorithmException nsaex) {
            LOG.error("Can't find SHA-256 for password encoding", nsaex);
            throw new RuntimeException(nsaex);
        }

        LOG.info(String.format("Loading password %s %s", resourceLoader.getName(), resourceName));
        Reader reader = null;
        try {
            reader = resourceLoader.loadResource(resourceName);
            if (reader == null) {
                LOG.warn(String.format("Parsing not existing %s %s", resourceLoader.getName(), resourceName));
            } else {
                parse(reader);
            }
        } catch (IResourceLoader.ResourceIsDirectoryException e) {
            LOG.warn(String.format("Trying to parse directory %s", resourceName));
        } catch (ParseException pex) {
            LOG.warn(
                    String.format("Format error in parsing password %s %s", resourceLoader.getName(), resourceName),
                    pex);
        }
    }

    private void parse(Reader reader) throws ParseException {<FILL_FUNCTION_BODY>}

    @Override
    public boolean checkValid(String clientId, String username, byte[] password) {
        if (username == null || password == null) {
            LOG.info("username or password was null");
            return false;
        }
        String foundPwq = m_identities.get(username);
        if (foundPwq == null) {
            return false;
        }
        String encodedPasswd = DigestUtils.sha256Hex(password);
        return foundPwq.equals(encodedPasswd);
    }

}

        if (reader == null) {
            return;
        }

        BufferedReader br = new BufferedReader(reader);
        String line;
        try {
            while ((line = br.readLine()) != null) {
                int commentMarker = line.indexOf('#');
                if (commentMarker != -1) {
                    if (commentMarker == 0) {
                        // skip its a comment
                        continue;
                    } else {
                        // it's a malformed comment
                        throw new ParseException(line, commentMarker);
                    }
                } else {
                    if (line.isEmpty() || line.matches("^\\s*$")) {
                        // skip it's a black line
                        continue;
                    }

                    // split till the first space
                    int delimiterIdx = line.indexOf(':');
                    String username = line.substring(0, delimiterIdx).trim();
                    String password = line.substring(delimiterIdx + 1).trim();

                    m_identities.put(username, password);
                }
            }
        } catch (IOException ex) {
            throw new ParseException("Failed to read", 1);
        }
    
<no_super_class>