private static String callClaimChain(Object rootObject, List<Field> list) {
        try {
            Object candidate = rootObject;
            for (Field f : list) {
                if ((candidate = f.get(candidate)) == null) {
                    break;
                }
            }
            return (candidate == null) ? null : candidate.toString();
        } catch (IllegalArgumentException | IllegalAccessException e) {
            LOGGER.error(e, "Unexpected error looking up token field: ", e.getMessage());
        }
        return null;
    }
Get a claim by name.

@param token token to retrieve claim from
@param claim the claim (field key)
@return string representation of claim
plugins/keycloak-oauth-policy/src/main/java/io/apiman/plugins/keycloak_oauth_policy/ClaimLookup.java