code: public static RoleDescriptorResolver getRoleDescriptorResolver(final MetadataResolver metadata,
                                                                     final boolean requireValidMetadata) throws Exception {
          val roleDescriptorResolver = new PredicateRoleDescriptorResolver(metadata);
          roleDescriptorResolver.setSatisfyAnyPredicates(true);
          roleDescriptorResolver.setUseDefaultPredicateRegistry(true);
          roleDescriptorResolver.setRequireValidMetadata(requireValidMetadata);
          roleDescriptorResolver.initialize();
          return roleDescriptorResolver;
      }
docs: Gets role descriptor resolver.
  
  @param metadata             the metadata
  @param requireValidMetadata the require valid metadata
  @return the role descriptor resolver
  @throws Exception the exception