AuthzHelper { public static boolean memberNameMatch(final String memberName, final String matchName) { if (memberName.equals("*")) { return true; } else if (memberName.endsWith("*")) { return matchName.startsWith(memberName.substring(0, memberName.length() - 1)); } else { return memberName.equals(matchName); } }  static void removeRoleMembers(List<RoleMember> originalRoleMembers, List<RoleMember> removeRoleMembers); static void removeGroupMembers(List<GroupMember> originalGroupMembers, List<GroupMember> removeGroupMembers); static boolean isMemberDisabled(Integer systemDisabled); static boolean isMemberExpired(Timestamp expiration, long currentTime); static boolean shouldSkipGroupMember(GroupMember member, long currentTime); static boolean isMemberOfGroup(List<GroupMember> groupMembers, final String member); static boolean checkGroupMemberValidity(List<GroupMember> groupMembers, final String member); static boolean memberNameMatch(final String memberName, final  String matchName); static boolean shouldRunDelegatedTrustCheck(final String trust, final String trustDomain); static String retrieveResourceDomain(String resource, String op, String trustDomain); static String extractResourceDomainName(final String resource); static boolean authorityAuthorizationAllowed(Principal principal); static boolean checkRoleMemberValidity(List<RoleMember> roleMembers, final String member,
                                                  GroupMembersFetcher groupMembersFetcher); static boolean isMemberOfRole(Role role, final String member, GroupMembersFetcher groupMembersFetcher); static boolean assumeRoleResourceMatch(String roleName, Assertion assertion); static boolean matchDelegatedTrustPolicy(Policy policy, final String roleName, final String roleMember,
                                                    List<Role> roles, GroupMembersFetcher groupMembersFetcher); static boolean matchDelegatedTrustAssertion(Assertion assertion, final String roleName, final String roleMember,
                                                       List<Role> roles, GroupMembersFetcher groupMembersFetcher);  }
@Test public void testMemberNameMatch() { assertTrue(AuthzHelper.memberNameMatch("*", "user.joe")); assertTrue(AuthzHelper.memberNameMatch("*", "athenz.service.storage")); assertTrue(AuthzHelper.memberNameMatch("user.*", "user.joe")); assertTrue(AuthzHelper.memberNameMatch("athenz.*", "athenz.service.storage")); assertTrue(AuthzHelper.memberNameMatch("athenz.service*", "athenz.service.storage")); assertTrue(AuthzHelper.memberNameMatch("athenz.service*", "athenz.service-storage")); assertTrue(AuthzHelper.memberNameMatch("athenz.service*", "athenz.service")); assertTrue(AuthzHelper.memberNameMatch("user.joe", "user.joe")); assertFalse(AuthzHelper.memberNameMatch("user.*", "athenz.joe")); assertFalse(AuthzHelper.memberNameMatch("athenz.*", "athenztest.joe")); assertFalse(AuthzHelper.memberNameMatch("athenz.service*", "athenz.servic")); assertFalse(AuthzHelper.memberNameMatch("athenz.service*", "athenz.servictag")); assertFalse(AuthzHelper.memberNameMatch("user.joe", "user.joel")); }