Restrict access based on SAML attribute

Is there a way to restrict access with saml based on a saml attribute?
I’m thinking of something like MellonRequire in mod_mellon where you can require an attribute to have a specific value. Als AWS seems to have this feature.

The idea is to have a Nextcloud-installation available only for a subset of the users in the SAML database.