This is an example of a standard attribute filter for SWAMID 2.0 with Entity Categories in a Shibboleth IdP.
attribute-filter.xml
<?xml version="1.0" encoding="UTF-8"?> <AttributeFilterPolicyGroup id="ShibbolethFilterPolicy" xmlns="urn:mace:shibboleth:2.0:afp" xmlns:basic="urn:mace:shibboleth:2.0:afp:mf:basic" xmlns:saml="urn:mace:shibboleth:2.0:afp:mf:saml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mace:shibboleth:2.0:afp classpath:/schema/shibboleth-2.0-afp.xsd urn:mace:shibboleth:2.0:afp:mf:basic classpath:/schema/shibboleth-2.0-afp-mf-basic.xsd urn:mace:shibboleth:2.0:afp:mf:saml classpath:/schema/shibboleth-2.0-afp-mf-saml.xsd"> <!-- General release to all Service Providers --> <!-- Release the transient ID to anyone --> <AttributeFilterPolicy id="releaseTransientIdToAnyone"> <PolicyRequirementRule xsi:type="basic:ANY" /> <AttributeRule attributeID="transientId"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> </AttributeFilterPolicy> <!-- Release the pseudonym user identity to anyone --> <AttributeFilterPolicy id="releasePermanentIdToAnyone"> <PolicyRequirementRule xsi:type="basic:ANY" /> <AttributeRule attributeID="persistentId"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> <AttributeRule attributeID="eduPersonTargetedID"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> </AttributeFilterPolicy> <!-- Entity category based release to Service Providers --> <!-- GEANT Dataprotection Code of Conduct --> <AttributeFilterPolicy id="releaseToCoC"> <PolicyRequirementRule xsi:type="saml:AttributeRequesterEntityAttributeExactMatch" attributeName="http://macedir.org/entity-category" attributeValue="http://www.geant.net/uri/dataprotection-code-of-conduct/v1"/> <AttributeRule attributeID="displayName"> <PermitValueRule xsi:type="basic:ANY"/> </AttributeRule> <AttributeRule attributeID="email"> <PermitValueRule xsi:type="basic:ANY"/> </AttributeRule> <AttributeRule attributeID="eduPersonPrincipalName"> <PermitValueRule xsi:type="basic:ANY"/> </AttributeRule> <AttributeRule attributeID="eduPersonScopedAffiliation"> <PermitValueRule xsi:type="basic:OR"> <basic:Rule xsi:type="basic:AttributeValueString" value="faculty" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="student" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="staff" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="alum" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="member" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="affiliate" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="employee" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="library-walk-in" ignoreCase="true" /> </PermitValueRule> </AttributeRule> <AttributeRule attributeID="schacHomeOrganization"> <PermitValueRule xsi:type="basic:ANY"/> </AttributeRule> </AttributeFilterPolicy> <!-- SWAMID Entity Category Research and Education --> <AttributeFilterPolicy id="entity-category-research-and-education"> <PolicyRequirementRule xsi:type="basic:AND"> <basic:Rule xsi:type="basic:OR"> <basic:Rule xsi:type="saml:AttributeRequesterEntityAttributeExactMatch" attributeName="http://macedir.org/entity-category" attributeValue="http://www.swamid.se/category/eu-adequate-protection"/> <basic:Rule xsi:type="saml:AttributeRequesterEntityAttributeExactMatch" attributeName="http://macedir.org/entity-category" attributeValue="http://www.swamid.se/category/nren-service"/> <basic:Rule xsi:type="saml:AttributeRequesterEntityAttributeExactMatch" attributeName="http://macedir.org/entity-category" attributeValue="http://www.swamid.se/category/hei-service"/> </basic:Rule> <basic:Rule xsi:type="saml:AttributeRequesterEntityAttributeExactMatch" attributeName="http://macedir.org/entity-category" attributeValue="http://www.swamid.se/category/research-and-education"/> </PolicyRequirementRule> <AttributeRule attributeID="givenName"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> <AttributeRule attributeID="surname"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> <AttributeRule attributeID="displayName"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> <AttributeRule attributeID="eduPersonPrincipalName"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> <AttributeRule attributeID="email"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> <!-- If you have multiple mail addresses to add in the TCS Personal Certificate, see example below. <AttributeRule attributeID="email"> <PermitValueRule xsi:type="basic:NOT"> <basic:Rule xsi:type="basic:OR"> <basic:Rule xsi:type="basic:AttributeRequesterString" value="https://tcs-personal.sunet.se/simplesamlphp/module.php/saml/sp/metadata.php/default-sp" /> <basic:Rule xsi:type="basic:AttributeRequesterString" value="https://tcs-personal-portal.terena.org/simplesamlphp/module.php/saml/sp/metadata.php/default-sp" /> </basic:Rule> </PermitValueRule> </AttributeRule> --> <AttributeRule attributeID="eduPersonScopedAffiliation"> <PermitValueRule xsi:type="basic:OR"> <basic:Rule xsi:type="basic:AttributeValueString" value="faculty" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="student" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="staff" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="alum" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="member" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="affiliate" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="employee" ignoreCase="true" /> <basic:Rule xsi:type="basic:AttributeValueString" value="library-walk-in" ignoreCase="true" /> </PermitValueRule> </AttributeRule> <AttributeRule attributeID="organizationName"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> <AttributeRule attributeID="norEduOrgAcronym"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> <AttributeRule attributeID="countryName"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> <AttributeRule attributeID="friendlyCountryName"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> <AttributeRule attributeID="schacHomeOrganization"> <PermitValueRule xsi:type="basic:ANY"/> </AttributeRule> </AttributeFilterPolicy> <!-- SWAMID Entity Category SFS 1993:1153 --> <AttributeFilterPolicy id="entity-category-sfs-1993-1153"> <PolicyRequirementRule xsi:type="saml:AttributeRequesterEntityAttributeExactMatch" attributeName="http://macedir.org/entity-category" attributeValue="http://www.swamid.se/category/sfs-1993-1153"/> <AttributeRule attributeID="norEduPersonNIN"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> </AttributeFilterPolicy> <!-- Examples of entityId based release to Service Providers --> <!-- NyA-webben UHR <AttributeFilterPolicy id="releaseNyAwebbenEntitlement"> <PolicyRequirementRule xsi:type="basic:OR"> <basic:Rule xsi:type="basic:AttributeRequesterString" value="https://www.antagning.se/ecs-sp" /> <basic:Rule xsi:type="basic:AttributeRequesterString" value="https://expert.antagning.se/ecs-sp" /> <basic:Rule xsi:type="basic:AttributeRequesterString" value="https://www.antagning.testa.antagning.se/ecs-sp" /> <basic:Rule xsi:type="basic:AttributeRequesterString" value="https://www.antagning.testb.antagning.se/ecs-sp" /> </PolicyRequirementRule> <AttributeRule attributeID="NyAwebbenEntitlement"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> </AttributeFilterPolicy> --> <!-- TCS Personal <AttributeFilterPolicy id="releaseTcsPersonalEntitlement"> <PolicyRequirementRule xsi:type="basic:OR"> <basic:Rule xsi:type="basic:AttributeRequesterString" value="https://tcs-personal.sunet.se/simplesamlphp/module.php/saml/sp/metadata.php/default-sp" /> <basic:Rule xsi:type="basic:AttributeRequesterString" value="https://tcs-personal-portal.terena.org/simplesamlphp/module.php/saml/sp/metadata.php/default-sp" /> </PolicyRequirementRule> <AttributeRule attributeID="tcsPersonalEntitlement"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> <AttributeRule attributeID="tcsPersonalMail"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> </AttributeFilterPolicy> --> <!-- TCS Personal eScience <AttributeFilterPolicy id="releaseTcsPersonaleSienceEntitlement"> <PolicyRequirementRule xsi:type="basic:OR"> <basic:Rule xsi:type="basic:AttributeRequesterString" value="https://tcs-escience.sunet.se/simplesamlphp/module.php/saml/sp/metadata.php/default-sp" /> <basic:Rule xsi:type="basic:AttributeRequesterString" value="https://tcs-escience-portal.terena.org/simplesamlphp/module.php/saml/sp/metadata.php/default-sp" /> </PolicyRequirementRule> <AttributeRule attributeID="tcsPersonaleScienceEntitlement"> <PermitValueRule xsi:type="basic:ANY" /> </AttributeRule> </AttributeFilterPolicy> --> </AttributeFilterPolicyGroup>