UaaTokenUtils { public static String getRevocationHash(List<String> salts) { String result = ""; for (String s : salts) { byte[] hashable = (result+ "###" + s).getBytes(); result = Integer.toHexString(murmurhash3x8632(hashable, 0, hashable.length, 0xF0F0)); } return result; } private  UaaTokenUtils(); static String getRevocationHash(List<String> salts); static int murmurhash3x8632(byte[] data, int offset, int len, int seed); static Set<String> retainAutoApprovedScopes(Collection<String> requestedScopes, Set<String> autoApprovedScopes); static boolean isUserToken(Map<String, Object> claims); static String getRevocableTokenSignature(ClientDetails client, String clientSecret, UaaUser user); static String getRevocableTokenSignature(UaaUser user, String tokenSalt, String clientId, String clientSecret); static String constructToken(Map<String, Object> header, Map<String, Object> claims, Signer signer); static boolean isJwtToken(String token); static String constructTokenEndpointUrl(String issuer, IdentityZone identityZone); static boolean hasRequiredUserAuthorities(Collection<String> requiredGroups, Collection<? extends GrantedAuthority> userGroups); static boolean hasRequiredUserGroups(Collection<String> requiredGroups, Collection<String> userGroups); static Map<String, Object> getClaims(String jwtToken); static final Pattern jwtPattern; }
@Test public void testRevocationHash() { List<String> salts = new LinkedList<>(); for (int i=0; i<3; i++) { salts.add(new RandomValueStringGenerator().generate()); } String hash1 = UaaTokenUtils.getRevocationHash(salts); String hash2 = UaaTokenUtils.getRevocationHash(salts); assertFalse("Hash 1 should not be empty",StringUtils.isEmpty(hash1)); assertFalse("Hash 2 should not be empty", StringUtils.isEmpty(hash2)); assertEquals(hash1, hash2); }