SAML V2.0 Metadata Attribute Extensions ======================================= [TOC] This is a reference for the SimpleSAMLphp implementation of the [SAML V2.0 Attribute Extensions](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-attribute-ext.pdf) defined by OASIS. A common use case is adding entity attributes to the generated metadata. For an IdP `metadata/saml20-idp-hosted.php` entries are used to define the metadata extension items; for an SP they can be added to `config/authsources.php`. An example of this is: [ 'urn:simplesamlphp:v1:simplesamlphp' => ['is', 'really', 'cool'], '{urn:simplesamlphp:v1}foo' => ['bar'], ], /* ... */ ]; The OASIS specification primarily defines how to include arbitrary `Attribute` and `Assertion` elements within the metadata for an entity. *Note*: SimpleSAMLphp does not support `Assertion` elements within the metadata at this time. Defining Attributes ------------------- The `EntityAttributes` key is used to define the attributes in the metadata. Each item in the `EntityAttributes` array defines a new `` item in the metadata. The value for each key must be an array. Each item in this array produces a separate `` element within the `` element. 'EntityAttributes' => [ 'urn:simplesamlphp:v1:simplesamlphp' => ['is', 'really', 'cool'], ], This generates: is really cool Each `` element requires a `NameFormat` attribute. This is specified using curly braces at the beginning of the key name: 'EntityAttributes' => [ '{urn:simplesamlphp:v1}foo' => ['bar'], ], This generates: bar When the curly braces are omitted, the NameFormat is automatically set to "urn:oasis:names:tc:SAML:2.0:attrname-format:uri". Examples -------- If given the following configuration... $metadata['https://example.com/saml-idp'] = [ 'host' => 'www.example.com', 'certificate' => 'example.com.crt', 'privatekey' => 'example.com.pem', 'auth' => 'example-userpass', 'EntityAttributes' => [ 'urn:simplesamlphp:v1:simplesamlphp' => ['is', 'really', 'cool'], '{urn:simplesamlphp:v1}foo' => ['bar'], ], ]; ... will generate the following XML metadata: is really cool bar ... An example configuration to declare Géant Data Protection Code of Conduct entity category support for a service provider in `authsources.php`: 'saml:SP' => [ ... 'EntityAttributes' => [ 'http://macedir.org/entity-category' => [ 'http://www.geant.net/uri/dataprotection-code-of-conduct/v1' ] ], 'UIInfo' =>[ 'DisplayName' => [ 'en' => 'English name', 'es' => 'Nombre en Español', ], 'Description' => [ 'en' => 'English description', 'es' => 'Descripción en Español', ], 'InformationURL' => [ 'en' => 'http://example.com/info/en', 'es' => 'http://example.com/info/es', ], 'PrivacyStatementURL' => [ 'en' => 'http://example.com/privacy/en', 'es' => 'http://example.com/privacy/es', ], ] ],