class UserWhiteListPlugin implements IAuthorizationPlugin {
    private static final String CLASS_NAME = UserWhiteListPlugin.class.getName();
    private static final Logger LOGGER = Logger.getLogger(CLASS_NAME);

    // configuration parameters
    static final String FILE_PARAM = "file";
    static final String FIELD_PARAM = "fieldName";

    // valid values for the FIELD_NAME parameter
    static final String USERNAME_FIELD = "username";
    static final String ID_FIELD = "id";

    private final Set<String> whitelist = new TreeSet<>();
    private String fieldName;

    @Override
    public void load(Map<String, Object> parameters) {<FILL_FUNCTION_BODY>}

    @TestOnly
    Set<String> getWhitelist() {
        return whitelist;
    }

    @Override
    public void unload() {
        whitelist.clear();
    }

    private boolean checkWhitelist(HttpServletRequest request) {
        User user;
        String attrName = UserPlugin.REQUEST_ATTR;
        if ((user = (User) request.getAttribute(attrName)) == null) {
            LOGGER.log(Level.WARNING, "cannot get {0} attribute", attrName);
            return false;
        }

        if (fieldName.equals(USERNAME_FIELD)) {
            return user.getUsername() != null && whitelist.contains(user.getUsername());
        } else if (fieldName.equals(ID_FIELD)) {
            return user.getId() != null && whitelist.contains(user.getId());
        }

        return false;
    }

    @Override
    public boolean isAllowed(HttpServletRequest request, Project project) {
        return checkWhitelist(request);
    }

    @Override
    public boolean isAllowed(HttpServletRequest request, Group group) {
        return checkWhitelist(request);
    }
}

        if (parameters == null) {
            throw new IllegalArgumentException("Null parameter");
        }

        String filePath;
        if ((filePath = (String) parameters.get(FILE_PARAM)) == null) {
            throw new IllegalArgumentException("Missing parameter [" + FILE_PARAM + "] in the configuration");
        }

        if ((fieldName = (String) parameters.get(FIELD_PARAM)) == null) {
            fieldName = USERNAME_FIELD;
        } else if (!fieldName.equals(USERNAME_FIELD) && !fieldName.equals(ID_FIELD)) {
            throw new IllegalArgumentException("Invalid value of parameter [" + FIELD_PARAM +
                    "] in the configuration: only " + USERNAME_FIELD + " or " + ID_FIELD + " are supported");
        }

        // Load whitelist from file to memory.
        try (Stream<String> stream = Files.lines(Paths.get(filePath))) {
            stream.map(String::strip).forEach(whitelist::add);
        } catch (IOException e) {
            throw new IllegalArgumentException(String.format("Unable to read the file \"%s\"", filePath), e);
        }

        LOGGER.log(Level.FINE, "UserWhiteList plugin loaded with filePath={0} ({1} entries), fieldName={2}",
                new Object[]{filePath, whitelist.size(), fieldName});
    
<no_super_class>