Table of Contents
The consent module is implemented as an Authentication Processing Filter. That means it can be configured in the global config.php file or the SP remote or IdP hosted metadata.
It is recommended to run the consent module at the IdP, and configure the filter to run after all attribute mangling filters is completed, to show the user the exact same attributes that are sent to the SP.
In order to generate the privacy preserving hashes in the consent module, you need to name one attribute that always is available and that is unique to all users. An example of such an attribute is eduPersonPrincipalName.
saml20-idp-hosted.php add the name of the user ID attribute:
'userid.attribute' => 'uid',
If the attribute defined above is not available for a user, an error message will be shown, and the user will not be allowed through the filter. So make sure that you select an attribute that is available to all users.
Next you need to enable the consent module, touch an
enable file, in the
The simplest way to setup the consent module is to not use any storage at all. This means that the user will always be asked to give consent each time the user logs in.
90 => array( 'class:Consent', ),
The consent module is shipped with two storage options, Cookie and Database.
In order to use a storage backend, you need to set the
store option. To use
cookies as storage you need to set the
store option to
90 => array( 'class' => 'consent:Consent', 'store' => 'consent:Cookie', ),
In order to use a database backend storage, you first need to setup the database.
Here is the initialization SQL script:
CREATE TABLE consent ( consent_date TIMESTAMP NOT NULL, usage_date TIMESTAMP NOT NULL, hashed_user_id VARCHAR(80) NOT NULL, service_id VARCHAR(255) NOT NULL, attribute VARCHAR(80) NOT NULL, UNIQUE (hashed_user_id, service_id) );
consent:Database backend storage has the following options
- Must be set to
- Data Source Name must comply to the syntax for the PHP PDO layer.
- Username for the database user to be used for the connection.
- Password for the database user used for the connection.
- Name of the table used for storing the consents. This option is optional
and defaults to
- The number of seconds to wait for a connection to the database server. This option is optional. If unset, it uses the default from the database-driver.
Example config using PostgreSQL database:
90 => array( 'class' => 'consent:Consent', 'store' => array( 'consent:Database', 'dsn' => 'pgsql:host=sql.example.org;dbname=consent', 'username' => 'simplesaml', 'password' => 'sdfsdf', ), ),
Example config using MySQL database:
90 => array( 'class' => 'consent:Consent', 'store' => array( 'consent:Database', 'dsn' => 'mysql:host=db.example.org;dbname=simplesaml', 'username' => 'simplesaml', 'password' => 'sdfsdf', ), ),
The following options can be used when configuring the Consent module
- Boolean value that indicate whether the values of the attributes should be used in calculating the unique hashes that identifies the consent. If includeValues is set and the value of an attribute changes, then the consent becomes invalid. This option is optional and defaults to FALSE.
- Boolean value that indicate whether the "Remember" consent checkbox is checked by default. This option is optional and defaults to FALSE.
- Indicates whether the "Yes" or "No" button is in focus by default. This option is optional and can take the value 'yes' or 'no' as strings. If omitted neither will receive focus.
- Configuration of the Consent storage backend. The store option is given in
: and refers to the class sspmod_ _Consent_Store_ . The consent module comes with two build in storages backends 'consnet:Cookie' and 'consent:Database'. See separate section on setting up consent using different storage methods. This option is optional. If option is not set, then the user is asked to consent, but the consent is not saved.
- Whether the value of the attributes should be hidden. Set to an array of the attributes that should have it value hidden. Default behaviour is that all attribute values are shown
- Whether we will show a link to more information about the service from the
no consent page. Defaults to
The following options can/ be set in other places in SimpleSAMLphp
- Disable consent for a set of services. See section
- Unique identifier that is released for all users. See section
Configure the user ID.
Consent can be disabled either in the IdP metadata or in the SP metadata.
To disable consent for one or more SPs for a given IdP, add the
consent.disable-option to the IdP metadata. To disable consent for one or
more IdPs for a given SP, add the
consent.disable-option to the SP metadata.
Disable consent for a given IdP:
$metadata['https://idp.example.org/'] = array( [...], 'consent.disable' => TRUE, );
Disable consent for some SPs connected to a given IdP:
$metadata['https://idp.example.org/'] = array( [...], 'consent.disable' => array( 'https://sp1.example.org/', 'https://sp2.example.org/', ), );
Disable consent for a given SP:
$metadata['https://sp.example.org'] = array( [...] 'consent.disable' => TRUE, ),
Disable consent for some IdPs for a given SP:
$metadata['https://sp.example.org'] = array( [...] 'consent.disable' => array( 'https://idp1.example.org/', 'https://idp2.example.org/', ), ),
It is possible to change the way the attributes are represented in the consent page. This is done by implementing an attribute array reordering function.
To create this function, you have to create a file named
and place it under
directory. To be found and called, the function must be named
The parameter $para is an reference to the attribute array. By manipulating this array you can change the way the attribute are presented to the user on the consent and status page.
If you want the attributes to be listed in more than one level, you can make the function add a child_ prefix to the root node attribute name in a recursive attribute tree.
These values will be listed as an bullet list
Array ( [objectClass] => Array (  => top  => person ) )
This array has two child arrays. These will be listed in two separate sub tables.
Array ( [child_eduPersonOrgUnitDN] => Array (  => Array ( [ou] => Array (  => ET ) [cn] => Array (  => Eksterne tjenester ) )  => Array ( [ou] => Array (  => TA ) [cn] => Array (  => Tjenesteavdeling ) ) ) )