public static boolean ifAllGranted(final String requiredRoles) {
    // parse required roles into list
    Set<String> requiredAuthorities = parseAuthorities(requiredRoles);
    if (requiredAuthorities.isEmpty())
      return false;

    // get granted roles
    GrantedAuthority[] authoritiesArray = getUserAuthorities();

    Set<String> grantedAuthorities = new TreeSet<>();
    for (GrantedAuthority authority : authoritiesArray) {
      grantedAuthorities.add(authority.getAuthority());
    }


    // iterate over required roles,
    for (String requiredAuthority : requiredAuthorities) {
      // check if required role is inside granted roles
      // if not, return false
      if (!grantedAuthorities.contains(requiredAuthority)) {
        return false;
      }
    }
    return true;
  }