class AuthzHelper {

    public static boolean memberNameMatch(final String memberName, final  String matchName) {

        // we are supporting 4 formats for role members
        // *, <domain>.[user]*, <domain>.<user>, and <domain>:group.<group-name>
        // special handling for wildcards only

        if (memberName.equals("*")) {
            return true;
        } else if (memberName.endsWith("*")) {
            return matchName.startsWith(memberName.substring(0, memberName.length() - 1));
        } else {
            return memberName.equals(matchName);
        }
    }

}