summaryrefslogtreecommitdiffstats
path: root/modules/saml/docs/sp.md
blob: d1a317838010e803cafca157c89b8adbe1ef8c32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
`saml:SP`
=========

This authentication source is used to authenticate against SAML 1 and SAML 2 IdPs.


Metadata
--------

The metadata for your SP will be available from the federation page on your SimpleSAMLphp installation.

SimpleSAMLphp supports generating metadata with the MDUI and MDRPI metadata extensions.
See the documentation for those extensions for more details:

  * [MDUI extension](./simplesamlphp-metadata-extensions-ui)
  * [MDRPI extension](./simplesamlphp-metadata-extensions-rpi)


Parameters
-------

These are parameters that can be used at runtime to control the authentication.
All these parameters override the equivalent option from the configuration.

`saml:AuthnContextClassRef`
:   The AuthnContextClassRef that will be sent in the login request.

:   *Note*: SAML 2 specific.


`ForceAuthn`
:   Force authentication allows you to force re-authentication of users even if the user has a SSO session at the IdP.

:   *Note*: SAML 2 specific.

`saml:idp`
:   The entity ID of the IdP we should send an authentication request to.

`isPassive`
:   Send a passive authentication request.

:   *Note*: SAML 2 specific.

`saml:NameIDPolicy`
:   The format of the NameID we request from the IdP.
    Defaults to the transient format if unspecified.

:   *Note*: SAML 2 specific.

`saml:Extensions`
:   The samlp:Extensions that will be sent in the login request.

:   *Note*: SAML 2 specific.

`saml:NameID`
:   Add a Subject element with a NameID to the SAML AuthnRequest for the IdP.
    This is an associative array with the fields for the NameID.
    Example: `array('Value' => 'user@example.org', 'Format' => SAML2_Const::NAMEID_UNSPECIFIED)`

:   *Note*: SAML 2 specific.


Authentication data
-------------------

Some SAML-specific attributes are available to the application after authentication.
To retrieve these attributes, the application can use the `getAuthData()`-function from the [SP API](./simplesamlphp-sp-api).
The following attributes are available:

`saml:sp:IdP`
:   The entityID of the IdP the user is authenticated against.

`saml:sp:NameID`
:   The NameID the user was issued by the IdP.
    This is an associative array with the various fields from the NameID.

`saml:sp:SessionIndex`
:   The SessionIndex we received from the IdP.


Options
-------

`acs.Bindings`
: List of bindings the SP should support. If it is unset, all will be added.
: Possible values:

    * `urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST`
    * `urn:oasis:names:tc:SAML:1.0:profiles:browser-post`
    * `urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact`
    * `urn:oasis:names:tc:SAML:1.0:profiles:artifact-01`
    * `urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser`

`assertion.encryption`
:   Whether assertions received by this SP must be encrypted. The default value is `FALSE`.
    If this option is set to `TRUE`, unencrypted assertions will be rejected.

:   Note that this option can be overridden for a specific IdP in saml20-idp-remote.

:   *Note*: SAML 2 specific.

`attributes`
:   List of attributes this SP requests from the IdP.
    This list will be added to the generated metadata.

:   The attributes will be added without a `NameFormat` by default.
    Use the `attributes.NameFormat` option to specify the `NameFormat` for the attributes.

:   An associative array can be used, mixing both elements with and without keys. When a key is
    specified for an element of the array, it will be used as the friendly name of the attribute
    in the generated metadata.

:   *Note*: This list will only be added to the metadata if the `name`-option is also specified.

`attributes.NameFormat`
:   The `NameFormat` for the requested attributes.

`attributes.required`
: If you have attributes added you can here specify which should be marked as required.
: The attributes should still be present in `attributes`.

`AuthnContextClassRef`
:   The SP can request authentication with a specific authentication context class.
    One example of usage could be if the IdP supports both username/password authentication as well as software-PKI.

:   *Note*: SAML 2 specific.

`authproc`
:   Processing filters that should be run after SP authentication.
    See the [authentication processing filter manual](simplesamlphp-authproc).

`certData`
:   Base64 encoded certificate data. Can be used instead of the `certificate` option.

`certificate`
:   File name of certificate for this SP. This certificate will be included in generated metadata.

`contacts`
:   Specify contacts in addition to the `technical` contact configured through `config/config.php`.

:   For example, specifying a support contact:

        'contacts' => array(
            array(
                'contactType'       => 'support',
                'emailAddress'      => 'support@example.org',
                'givenName'         => 'John',
                'surName'           => 'Doe',
                'telephoneNumber'   => '+31(0)12345678',
                'company'           => 'Example Inc.',
            )
        ),

:   Valid values for `contactType` are: `technical`, `support`, `administrative`, `billing` and `other`. All
    fields, except `contactType` are OPTIONAL.

`description`
:   A description of this SP.
    Will be added to the generated metadata, in an AttributeConsumingService element.

:   This option can be translated into multiple languages by specifying the value as an array of language-code to translated description:

        'description' => array(
            'en' => 'A service',
            'no' => 'En tjeneste',
        ),

:   *Note*: For this to be added to the metadata, you must also specify the `attributes` and `name` options.

`discoURL`
:   Set which IdP discovery service this SP should use.
    If this is unset, the IdP discovery service specified in the global option `idpdisco.url.{saml20|shib13}` in `config/config.php` will be used.
    If that one is also unset, the builtin default discovery service will be used.

`encryption.blacklisted-algorithms`
:   Blacklisted encryption algorithms. This is an array containing the algorithm identifiers.

:   Note that this option can be set for each IdP in the [IdP-remote metadata](./simplesamlphp-reference-idp-remote).

:   *Note*: SAML 2 specific.

`entityID`
:   The entity ID this SP should use.

:   If this option is unset, a default entity ID will be generated.
    The generated entity ID will be a URL where the metadata of this SP can be downloaded.

`ForceAuthn`
:   Force authentication allows you to force re-authentication of users even if the user has a SSO session at the IdP.

:   *Note*: SAML 2 specific.

`idp`
:   The entity ID this SP should connect to.

:   If this option is unset, an IdP discovery service page will be shown.

`IsPassive`
:   IsPassive allows you to enable passive authentication by default for this SP.

:   *Note*: SAML 2 specific.

`name`
:   The name of this SP.
    Will be added to the generated metadata, in an AttributeConsumingService element.

:   This option can be translated into multiple languages by specifying the value as an array of language-code to translated name:

        'name' => array(
            'en' => 'A service',
            'no' => 'En tjeneste',
        ),

:   *Note*: You must also specify at least one attribute in the `attributes` option for this element to be added to the metadata.

`nameid.encryption`
:   Whether NameIDs sent from this SP should be encrypted. The default
    value is `FALSE`.

:   Note that this option can be set for each IdP in the [IdP-remote metadata](./simplesamlphp-reference-idp-remote).

:   *Note*: SAML 2 specific.

`NameIDPolicy`
:   The format of the NameID we request from the IdP.
    Defaults to the `transient` format if unspecified.

:   If this option is set, its value will be added to the metadata generated for this SP, in the NameIDFormat element.

:   *Note 1*: SAML 2 specific.

`OrganizationName`
:   The name of the organization responsible for this SP.
    This name does not need to be suitable for display to end users.

:   This option can be translated into multiple languages by specifying the value as an array of language-code to translated name:

        'OrganizationName' => array(
            'en' => 'Example organization',
            'no' => 'Eksempel organisation',
        ),

:   *Note*: If you specify this option, you must also specify the `OrganizationURL` option.

`OrganizationDisplayName`
:   The name of the organization responsible for this SP.
    This name must be suitable for display to end users.
    If this option isn't specified, `OrganizationName` will be used instead.

:   This option can be translated into multiple languages by specifying the value as an array of language-code to translated name.

:   *Note*: If you specify this option, you must also specify the `OrganizationName` option.

`OrganizationURL`
:   A URL the end user can access for more information about the organization.

:   This option can be translated into multiple languages by specifying the value as an array of language-code to translated URL.

:   *Note*: If you specify this option, you must also specify the `OrganizationName` option.

`privatekey`
:   File name of private key to be used for signing messages and decrypting messages from the IdP. This option is only required if you use encrypted assertions or if you enable signing of messages.

:   *Note*: SAML 2 specific.

`privatekey_pass`
:   The passphrase for the private key, if it is encrypted. If the private key is unencrypted, this can be left out.

:   *Note*: SAML 2 specific.

`ProtocolBinding`
:   The binding that should be used for SAML2 authentication responses.
    This option controls the binding that is requested through the AuthnRequest message to the IdP.
    By default the HTTP-Post binding is used.

:   *Note*: SAML 2 specific.

`redirect.sign`
:   Whether authentication requests, logout requests and logout responses sent from this SP should be signed. The default is `FALSE`.
    If set, the `AuthnRequestsSigned` attribute of the `SPSSODescriptor` element in SAML 2.0 metadata will contain its value. This
    option takes precedence over the `sign.authnrequest` option in any metadata generated for this SP.

:   *Note*: SAML 2 specific.

`redirect.validate`
:   Whether logout requests and logout responses received by this SP should be validated. The default is `FALSE`.

:   *Note*: SAML 2 specific.

`RegistrationInfo`
:   Allows to specify information about the registrar of this SP. Please refer to the
    [MDRPI extension](./simplesamlphp-metadata-extensions-rpi) document for further information.

`RelayState`
:   The page the user should be redirected to after an IdP initiated SSO.

:   *Note*: SAML 2 specific.
    For SAML 1.1 SPs, you must specify the `TARGET` parameter in the authentication response.
    How to set that parameter is depends on the IdP.
    For SimpleSAMLphp, see the documentation for [IdP-first flow](./simplesamlphp-idp-more#section_4_1).

`saml.SOAPClient.certificate`
:   A file with a certificate _and_ private key that should be used when issuing SOAP requests from this SP.
    If this option isn't specified, the SP private key and certificate will be used.

:   This option can also be set to `FALSE`, in which case no client certificate will be used.

`saml.SOAPClient.privatekey_pass`
:   The passphrase of the privatekey in `saml.SOAPClient.certificate`.

`saml1.useartifact`
:   Request that the IdP returns the result to the artifact binding.
    The default is to use the POST binding, set this option to TRUE to use the artifact binding instead.

:   This option can also be set in the `shib13-idp-remote` metadata, in which case the setting in `shib13-idp-remote` takes precedence.

:   *Note*: SAML 1 specific.

`saml20.hok.assertion`
:   Enable support for the SAML 2.0 Holder-of-Key SSO profile.
    See the documentation for the [Holder-of-Key profile](./simplesamlphp-hok-sp).

`sign.authnrequest`
:   Whether to sign authentication requests sent from this SP. If set, the `AuthnRequestsSigned` attribute of the
    `SPSSODescriptor` element in SAML 2.0 metadata will contain its value.

:   Note that this option also exists in the IdP-remote metadata, and
    any value in the IdP-remote metadata overrides the one configured
    in the SP configuration.

:   *Note*: SAML 2 specific.

`sign.logout`
:   Whether to sign logout messages sent from this SP.

:   Note that this option also exists in the IdP-remote metadata, and
    any value in the IdP-remote metadata overrides the one configured
    in the SP configuration.

:   *Note*: SAML 2 specific.

`signature.algorithm`
:   The algorithm to use when signing any message generated by this service provider. Defaults to RSA-SHA1.
:   Possible values:

    * `http://www.w3.org/2000/09/xmldsig#rsa-sha1`
       *Note*: the use of SHA1 is **deprecated** and will be disallowed in the future.
    * `http://www.w3.org/2001/04/xmldsig-more#rsa-sha256`
    * `http://www.w3.org/2001/04/xmldsig-more#rsa-sha384`
    * `http://www.w3.org/2001/04/xmldsig-more#rsa-sha512`

`SingleLogoutServiceBinding`
:	List of SingleLogoutService bindings the IdP will claim support for.
:	Possible values:

    * `urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect`
    * `urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST`
	* `urn:oasis:names:tc:SAML:2.0:bindings:SOAP`

`url`
:   A URL to your service provider. Will be added as an OrganizationURL-element in the metadata.

:   This option can be translated into multiple languages by specifying the value as an array of language-code to language-specific URL:

        'url' => array(
            'en' => 'http://sp.example.net/en/info.html',
            'no' => 'http://sp.example.net/no/info.html',
        ),

`validate.logout`
:   Whether we require signatures on logout messages sent to this SP.

:   Note that this option also exists in the IdP-remote metadata, and
    any value in the IdP-remote metadata overrides the one configured
    in the IdP metadata.

:   *Note*: SAML 2 specific.

`WantAssertionsSigned`
:   Whether assertions received by this SP must be signed. The default value is `FALSE`.
    The value set for this option will be used to set the `WantAssertionsSigned` attribute of the `SPSSODescriptor` element in
    the exported SAML 2.0 metadata.


Examples
--------

Here we will list some examples for this authentication source.

### Minimal

    'example-minimal' => array(
        'saml:SP',
    ),

### Connecting to a specific IdP

    'example' => array(
        'saml:SP',
        'idp' => 'https://idp.example.net/',
    ),

### Using a specific entity ID

    'example' => array(
        'saml:SP',
        'entityID' => 'https://sp.example.net',
    ),

### Encryption and signing

    This SP will accept encrypted assertions, and will sign and validate all messages.

    'example-enc' => array(
        'saml:SP',

        'certificate' => 'example.crt',
        'privatekey' => 'example.key',
        'privatekey_pass' => 'secretpassword',
        'redirect.sign' => TRUE,
        'redirect.validate' => TRUE,
    ),


### Specifying attributes and required attributes

    An SP that wants eduPersonPrincipalName and mail, where eduPersonPrincipalName should be listed as required:

    'example-attributes => array(
        'saml:SP',
        'name' => array( // Name required for AttributeConsumingService-element.
            'en' => 'Example service',
            'no' => 'Eksempeltjeneste',
        ),
        'attributes' => array(
            'eduPersonPrincipalName',
            'mail',
            // Specify friendly names for these attributes:
            'sn' => 'urn:oid:2.5.4.4',
            'givenName' => 'urn:oid:2.5.4.42',
        )
        'attributes.required' => array (
            'eduPersonPrincipalName',
        ),
        'attributes.NameFormat' => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic',
    ),


### Limiting supported AssertionConsumerService endpoint bindings

    'example-acs-limit' => array(
        'saml:SP',
        'acs.Bindings' => array(
            'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
            'urn:oasis:names:tc:SAML:1.0:profiles:browser-post',
        ),
    ),


### Requesting a specific authentication method.

    $auth = new SimpleSAML_Auth_Simple('default-sp');
    $auth->login(array(
        'saml:AuthnContextClassRef' => 'urn:oasis:names:tc:SAML:2.0:ac:classes:Password',
    ));

### Using samlp:Extensions

    $dom = SAML2_DOMDocumentFactory::create();
    $ce = $dom->createElementNS('http://www.example.com/XFoo', 'xfoo:test', 'Test data!');
    $ext[] = new SAML2_XML_Chunk($ce);

    $auth = new SimpleSAML_Auth_Simple('default-sp');
    $auth->login(array(
        'saml:Extensions' => $ext,
    ));