code: protected final void validateAudienceRestrictions(final List<AudienceRestriction> audienceRestrictions,
                                                        final String spEntityId) {
  
          if (audienceRestrictions == null || audienceRestrictions.isEmpty()) {
              throw new SAMLAssertionAudienceException("Audience restrictions cannot be null or empty");
          }
  
          final Set<String> audienceUris = new HashSet<>();
          for (final AudienceRestriction audienceRestriction : audienceRestrictions) {
              if (audienceRestriction.getAudiences() != null) {
                  for (final Audience audience : audienceRestriction.getAudiences()) {
                      audienceUris.add(audience.getAudienceURI());
                  }
              }
          }
          if (!audienceUris.contains(spEntityId)) {
              throw new SAMLAssertionAudienceException("Assertion audience " + audienceUris
                  + " does not match SP configuration " + spEntityId);
          }
      }
docs: Validate audience by matching the SP entityId.
  
  @param audienceRestrictions the audience restrictions
  @param spEntityId           the sp entity id