Skip to content

Commit 6c9ca03

Browse files
committed
add documentation for configuration options
1 parent 3bf6199 commit 6c9ca03

File tree

1 file changed

+277
-6
lines changed

1 file changed

+277
-6
lines changed

docs/howto/config.rst

Lines changed: 277 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.. _howto_config:
22

3-
Configuration of pySAML2 entities
3+
Configuration of PySAML2 entities
44
=================================
55

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
77
attribute authority, you have to configure it. The format of the configuration
88
file is the same regardless of which type of service you plan to run.
99
What differs are some of the directives.
@@ -51,7 +51,7 @@ The basic structure of the configuration file is therefore like this::
5151
}
5252

5353
.. 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
5555
will do that for you.
5656

5757
Configuration directives
@@ -101,7 +101,7 @@ Example::
101101
},
102102
},
103103

104-
The exapmle configuration above will enable DEBUG logging to stdout.
104+
The example configuration above will enable DEBUG logging to stdout.
105105

106106

107107
debug
@@ -247,6 +247,32 @@ The globally unique identifier of the entity.
247247
.. note:: It is recommended that the entityid should point to a real
248248
webpage where the metadata for the entity can be found.
249249

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
250276

251277
key_file
252278
^^^^^^^^
@@ -269,6 +295,21 @@ Example::
269295
This is the public part of the service private/public key pair.
270296
*cert_file* must be a PEM formatted file with a single certificate.
271297

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.
272313

273314
encryption_keypairs
274315
^^^^^^^^^^^^^^^^^^^
@@ -283,6 +324,26 @@ Indicates which certificates will be used for encryption capabilities::
283324
},
284325
],
285326

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+
286347
metadata
287348
^^^^^^^^
288349

@@ -449,7 +510,7 @@ difference you are prepared to accept.
449510
Hence your server may accept a statement that in fact is too old.
450511

451512
allow_unknown_attributes
452-
""""""""""""""""""""""""
513+
^^^^^^^^^^^^^^^^^^^^^^^^
453514

454515
Indicates that attributes that are not recognized (they are not configured in
455516
attribute-mapping), will not be discarded.
@@ -465,6 +526,28 @@ Example::
465526

466527
"xmlsec_binary": "/usr/local/bin/xmlsec1",
467528

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+
468551
delete_tmpfiles
469552
^^^^^^^^^^^^^^^
470553

@@ -486,6 +569,74 @@ How many *hours* this configuration is expected to be accurate.::
486569
This, of course, is only used by *make_metadata.py*.
487570
The server will not stop working when this amount of time has elapsed :-).
488571

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+
489640
Specific directives
490641
-------------------
491642

@@ -508,6 +659,12 @@ sign_response
508659
Specifies if the IdP should sign the authentication response or not. Can be
509660
True or False. Default is False.
510661

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+
511668
want_authn_requests_only_with_valid_cert
512669
""""""""""""""""""""""""""""""""""""""""
513670

@@ -607,6 +764,79 @@ regular expressions.::
607764

608765
Here only mail addresses that end with ".umu.se" will be returned.
609766

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+
610840
sp
611841
^^
612842

@@ -928,6 +1158,47 @@ Example::
9281158
}
9291159
}
9301160

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+
9311202

9321203
idp/aa/sp
9331204
^^^^^^^^^
@@ -1210,7 +1481,7 @@ Entity Categories
12101481

12111482
Entity categories and their attributes are defined in
12121483
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:
12141485

12151486
1. Using the configuration options *entity_category_support* or
12161487
*entity_category*, to generate the appropriate EntityAttribute metadata

0 commit comments

Comments
 (0)