1
1
.. _howto_config :
2
2
3
- Configuration of pySAML2 entities
3
+ Configuration of PySAML2 entities
4
4
=================================
5
5
6
- Whether you plan to run a pySAML2 Service Provider, Identity Provider or an
6
+ Whether you plan to run a PySAML2 Service Provider, Identity Provider or an
7
7
attribute authority, you have to configure it. The format of the configuration
8
8
file is the same regardless of which type of service you plan to run.
9
9
What differs are some of the directives.
@@ -51,7 +51,7 @@ The basic structure of the configuration file is therefore like this::
51
51
}
52
52
53
53
.. note :: You can build the metadata file for your services directly from the
54
- configuration. The make_metadata.py script in the pySAML2 tools directory
54
+ configuration. The make_metadata.py script in the PySAML2 tools directory
55
55
will do that for you.
56
56
57
57
Configuration directives
@@ -101,7 +101,7 @@ Example::
101
101
},
102
102
},
103
103
104
- The exapmle configuration above will enable DEBUG logging to stdout.
104
+ The example configuration above will enable DEBUG logging to stdout.
105
105
106
106
107
107
debug
@@ -247,6 +247,32 @@ The globally unique identifier of the entity.
247
247
.. note :: It is recommended that the entityid should point to a real
248
248
webpage where the metadata for the entity can be found.
249
249
250
+ name
251
+ ^^^^
252
+
253
+ A string value that sets the name of the PySAML2 entity.
254
+
255
+ Example::
256
+
257
+ "name": "Example IdP"
258
+
259
+ description
260
+ ^^^^^^^^^^^
261
+
262
+ A string value that sets the description of the PySAML2 entity.
263
+
264
+ Example::
265
+
266
+ "description": "My IdP",
267
+
268
+ verify_ssl_cert
269
+ ^^^^^^^^^^^^^^^
270
+
271
+ A boolean value (``True `` or ``False ``). The default configuration is ``False ``.
272
+
273
+ Example::
274
+
275
+ "verify_ssl_cert": True
250
276
251
277
key_file
252
278
^^^^^^^^
@@ -269,6 +295,21 @@ Example::
269
295
This is the public part of the service private/public key pair.
270
296
*cert_file * must be a PEM formatted file with a single certificate.
271
297
298
+ tmp_cert_file
299
+ ^^^^^^^^^^^^^
300
+
301
+ Example::
302
+ "tmp_cert_file": "tmp_cert.pem"
303
+
304
+ *tmp_cert_file * is a PEM formatted certificate file
305
+
306
+ tmp_key_file
307
+ ^^^^^^^^^^^^
308
+
309
+ Example::
310
+ "tmp_key_file": "tmp_key.pem"
311
+
312
+ *tmp_key_file * is a PEM formatted key file.
272
313
273
314
encryption_keypairs
274
315
^^^^^^^^^^^^^^^^^^^
@@ -283,6 +324,26 @@ Indicates which certificates will be used for encryption capabilities::
283
324
},
284
325
],
285
326
327
+ generate_cert_info
328
+ ^^^^^^^^^^^^^^^^^^
329
+
330
+ A boolean value.
331
+
332
+ Example::
333
+
334
+ "generate_cert_info": False
335
+
336
+
337
+ ca_certs
338
+ ^^^^^^^^
339
+
340
+ This is the path to a file containing root CA certificates for SSL server certificate validation.
341
+
342
+ Example::
343
+
344
+ "ca_certs": full_path("cacerts.txt"),
345
+
346
+
286
347
metadata
287
348
^^^^^^^^
288
349
@@ -449,7 +510,7 @@ difference you are prepared to accept.
449
510
Hence your server may accept a statement that in fact is too old.
450
511
451
512
allow_unknown_attributes
452
- """"""""""""""""""""""""
513
+ ^^^^^^^^^^^^^^^^^^^^^^^^
453
514
454
515
Indicates that attributes that are not recognized (they are not configured in
455
516
attribute-mapping), will not be discarded.
@@ -465,6 +526,28 @@ Example::
465
526
466
527
"xmlsec_binary": "/usr/local/bin/xmlsec1",
467
528
529
+ xmlsec_path
530
+ ^^^^^^^^^^^
531
+
532
+ This option is used to define non-system paths where the xmlsec1 binary can be located.
533
+ It can be used when the xmlsec_binary option is not defined.
534
+
535
+ Example::
536
+
537
+ "xmlsec_path": ["/usr/local/bin", "/opt/local/bin"],
538
+
539
+ OR::
540
+
541
+ from saml2.sigver import get_xmlsec_binary
542
+
543
+ if get_xmlsec_binary:
544
+ xmlsec_path = get_xmlsec_binary(["/opt/local/bin","/usr/local/bin"])
545
+ else:
546
+ xmlsec_path = '/usr/bin/xmlsec1'
547
+
548
+ "xmlsec_binary": xmlsec_path,
549
+
550
+
468
551
delete_tmpfiles
469
552
^^^^^^^^^^^^^^^
470
553
@@ -486,6 +569,74 @@ How many *hours* this configuration is expected to be accurate.::
486
569
This, of course, is only used by *make_metadata.py *.
487
570
The server will not stop working when this amount of time has elapsed :-).
488
571
572
+
573
+ metadata_key_usage
574
+ ^^^^^^^^^^^^^^^^^^^
575
+
576
+ This specifies the purpose of the entity's cryptographic keys used to sign data.
577
+ If this option is not configured it will default to ``"both" ``.
578
+
579
+ The possible options for this configuration are ``both ``, ``signing ``, ``encryption ``.
580
+
581
+ If metadata_key_usage is set to ``"signing" `` or ``"both" ``, and a cert_file is provided
582
+ the value of use in the KeyDescriptor element will be set to ``"signing" ``.
583
+
584
+ If metadata_key_usage is set to ``"both" `` or ``"encryption" `` and a enc_cert is provided
585
+ the value of ``"use" `` in the KeyDescriptor will be set to ``"encryption" ``.
586
+
587
+ Example::
588
+
589
+ "metadata_key_usage" : "both",
590
+
591
+
592
+ secret
593
+ ^^^^^^
594
+
595
+ A string value that is used in the generation of the RelayState.
596
+
597
+ Example::
598
+
599
+ "secret": "0123456789",
600
+
601
+ crypto_backend
602
+ ^^^^^^^^^^^^^^
603
+ Defines the crypto backend used for signing and encryption. The default is ``xmlsec1 ``.
604
+ The options are ``xmlsec1 `` and ``XMLSecurity ``.
605
+
606
+ If set to "XMLSecurity", the crypto backend will be pyXMLSecurity.
607
+
608
+ Example::
609
+
610
+ "crypto_backend": "xmlsec1",
611
+
612
+ verify_encrypt_advice
613
+ ^^^^^^^^^^^^^^^^^^^^^
614
+
615
+ A boolean value.
616
+
617
+ Example::
618
+
619
+ def verify_encrypt_cert(cert_str):
620
+ osw = OpenSSLWrapper()
621
+ ca_cert_str = osw.read_str_from_file(full_path("root_cert/localhost.ca.crt"))
622
+ valid, mess = osw.verify(ca_cert_str, cert_str)
623
+ return valid
624
+
625
+ ::
626
+
627
+ "verify_encrypt_cert_advice": verify_encrypt_cert,
628
+
629
+
630
+ verify_encrypt_cert_assertion
631
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
632
+
633
+ A boolean value.
634
+
635
+ Example::
636
+
637
+ "verify_encrypt_cert_assertion": verify_encrypt_cert
638
+
639
+
489
640
Specific directives
490
641
-------------------
491
642
@@ -508,6 +659,12 @@ sign_response
508
659
Specifies if the IdP should sign the authentication response or not. Can be
509
660
True or False. Default is False.
510
661
662
+ want_authn_requests_signed
663
+ """"""""""""""""""""""""""
664
+
665
+ Indicates that the AuthnRequest received by this IdP should be signed. Can be True or False.
666
+ The default value is False.
667
+
511
668
want_authn_requests_only_with_valid_cert
512
669
""""""""""""""""""""""""""""""""""""""""
513
670
@@ -607,6 +764,79 @@ regular expressions.::
607
764
608
765
Here only mail addresses that end with ".umu.se" will be returned.
609
766
767
+ scope
768
+ """""
769
+
770
+ A list of string values that will be used to set the ``<Scope> `` element
771
+ The default value of regexp is ``false ``.
772
+
773
+ Example::
774
+
775
+ "scope": ["example.org", "example.com"],
776
+
777
+
778
+ ui_info
779
+ """"""""
780
+
781
+ This determines what information to display about an entity by
782
+ configuring its mdui:UIInfo element. The configurable options include;
783
+
784
+ *privacy_statement_url *
785
+ The URL to information about the privacy practices of the entity.
786
+ *information_url *
787
+ Which URL contains localized information about the entity.
788
+ *logo *
789
+ The logo image for the entity. The value is a dictionary with keys
790
+ height, width and text.
791
+ *display_name *
792
+ The localized name for the entity.
793
+ *description *
794
+ The localized description of the entity. The value is a dictionary with keys
795
+ text and lang.
796
+ *keywords *
797
+ The localized search keywords for the entity. The value is a dictionary with keys
798
+ lang and text.
799
+
800
+ Example::
801
+
802
+ "ui_info": {
803
+ "privacy_statement_url": "http://example.com/saml2/privacyStatement.html",
804
+ "information_url": "http://example.com/saml2/info.html",
805
+ "logo": {
806
+ "height": "40",
807
+ "width" : "30",
808
+ "text": "http://example.com/logo.jpg"
809
+ },
810
+ "display_name": "Example Co.",
811
+ "description" : {"text":"Exempel Bolag","lang":"se"},
812
+ "keywords": {"lang":"en", "text":["foo", "bar"]}
813
+ }
814
+
815
+
816
+ name_qualifier
817
+ """"""""""""""
818
+
819
+ A string value that sets the ``NameQualifier `` attribute of the ``<NameIdentifier> `` element.
820
+
821
+ Example::
822
+
823
+ "name_qualifier": "http://authentic.example.com/saml/metadata",
824
+
825
+
826
+ session_storage
827
+ """""""""""""""
828
+
829
+ Example::
830
+
831
+ "session_storage": ("mongodb", "session")
832
+
833
+ domain
834
+ """"""
835
+
836
+ Example::
837
+
838
+ "domain": "umu.se",
839
+
610
840
sp
611
841
^^
612
842
@@ -928,6 +1158,47 @@ Example::
928
1158
}
929
1159
}
930
1160
1161
+ discovery_response
1162
+ """"""""""""""""""
1163
+
1164
+ This configuration allows the SP to include one or more Discovery Response Endpoints.
1165
+ The discovery_response can be the just the URL::
1166
+
1167
+ "discovery_response":["http://example.com/sp/ds"],
1168
+
1169
+ or it can be a 2 tuple of the URL+Binding::
1170
+
1171
+ from saml2.extension.idpdisc import BINDING_DISCO
1172
+
1173
+ "discovery_response": [("http://example.com/sp/ds", BINDING_DISCO)]
1174
+
1175
+ ecp
1176
+ """
1177
+
1178
+ This configuration option takes a dictionary with the ecp client IP address as the
1179
+ key and the entity ID as the value.
1180
+
1181
+ Example::
1182
+
1183
+ "ecp": {
1184
+ "203.0.113.254": "http://example.com/idp",
1185
+ }
1186
+
1187
+ requested_attribute_name_format
1188
+ """""""""""""""""""""""""""""""
1189
+
1190
+ This sets the NameFormat attribute in the ``<RequestedAttribute> `` element.
1191
+ The name formats are defined in saml2.saml.py. If not configured the default is ``NAME_FORMAT_URI ``
1192
+ which corresponds to ``urn:oasis:names:tc:SAML:2.0:attrname-format:uri ``.
1193
+
1194
+ Example::
1195
+
1196
+ from saml2.saml import NAME_FORMAT_BASIC
1197
+
1198
+ ::
1199
+
1200
+ "requested_attribute_name_format": NAME_FORMAT_BASIC
1201
+
931
1202
932
1203
idp/aa/sp
933
1204
^^^^^^^^^
@@ -1210,7 +1481,7 @@ Entity Categories
1210
1481
1211
1482
Entity categories and their attributes are defined in
1212
1483
src/saml2/entity_category/<registrar-of-entity-category>.py.
1213
- We can configure Entity Categories in pysaml2 in two ways:
1484
+ We can configure Entity Categories in PySAML2 in two ways:
1214
1485
1215
1486
1. Using the configuration options *entity_category_support * or
1216
1487
*entity_category *, to generate the appropriate EntityAttribute metadata
0 commit comments