Skip to content

Commit 7890740

Browse files
committed
fix: Docs small changes in setup - pysaml2 example conf improved
1 parent 4906bae commit 7890740

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

docs/source/contents/setup.rst

+27-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ you will need to set the full path to it in the configuration stage.
1111

1212
.. _xmlsec1: http://www.aleksey.com/xmlsec/
1313

14-
Now you can install the djangosaml2 package using easy_install or pip. This
14+
Now you can install the djangosaml2 package using pip. This
1515
will also install PySAML2 and its dependencies automatically::
1616

1717
apt install python3-pip xmlsec python3-dev libssl-dev libsasl2-dev
@@ -48,11 +48,6 @@ installed apps::
4848
'djangosaml2', # new application
4949
)
5050

51-
Actually this is not really required since djangosaml2 does not include
52-
any data model. The only reason we include it is to be able to run
53-
djangosaml2 test suite from our project, something you should always
54-
do to make sure it is compatible with your Django version and environment.
55-
5651
.. Note::
5752

5853
When you finish the configuration you can run the djangosaml2 test suite as
@@ -114,7 +109,7 @@ federations where the logout protocol is not always available.
114109

115110
If you want to allow several authentication mechanisms in your project
116111
you should set the LOGIN_URL option to another view and put a link in such
117-
view to the ``/saml2/login/`` view.
112+
view to djangosaml2 wb path, like ``/saml2/login/``.
118113

119114
Handling Post-Login Redirects
120115
=============================
@@ -131,7 +126,7 @@ hostnames to be used for the post-login redirect. In such cases, the setting::
131126
May be set to a list of allowed post-login redirect hostnames (note, the URL components beyond the hostname
132127
may be specified by the client - typically with the ?next= parameter.)
133128

134-
In the absence of a ?next= parameter, the LOGIN_REDIRECT_URL setting will be used (assuming the destination hostname
129+
In the absence of a `?next=parameter`, the `LOGIN_REDIRECT_URL` setting will be used (assuming the destination hostname
135130
either matches the output of get_host() or is included in the SAML_ALLOWED_HOSTS setting)
136131

137132
Preferred sso binding
@@ -220,7 +215,7 @@ In SAML standard doc, section 4.1.4.5 it states
220215

221216
The service provider MUST ensure that bearer assertions are not replayed, by maintaining the set of used ID values for the length of time for which the assertion would be considered valid based on the NotOnOrAfter attribute in the <SubjectConfirmationData>
222217

223-
djangosaml2 provides a hook 'is_authorized' for the SP to store assertion IDs and implement replay prevention with your choice of storage.
218+
djangosaml2 provides a hook 'is_authorized' for the SP to store assertion IDs and implement replay prevention with your choice of storage.
224219
::
225220

226221
def is_authorized(self, attributes: dict, attribute_mapping: dict, idp_entityid: str, assertion: object, **kwargs) -> bool:
@@ -435,6 +430,10 @@ settings.py file under the SAML_CONFIG option. We will see a typical configurati
435430
saml2.BINDING_HTTP_POST),
436431
],
437432
},
433+
434+
'signing_algorithm': saml2.xmldsig.SIG_RSA_SHA256,
435+
'digest_algorithm': saml2.xmldsig.DIGEST_SHA256,
436+
438437
# Mandates that the identity provider MUST authenticate the
439438
# presenter directly rather than rely on a previous security context.
440439
'force_authn': False,
@@ -450,6 +449,25 @@ settings.py file under the SAML_CONFIG option. We will see a typical configurati
450449
# attributes that may be useful to have but not required
451450
'optional_attributes': ['eduPersonAffiliation'],
452451

452+
'want_response_signed': True,
453+
'authn_requests_signed': True,
454+
'logout_requests_signed': True,
455+
# Indicates that Authentication Responses to this SP must
456+
# be signed. If set to True, the SP will not consume
457+
# any SAML Responses that are not signed.
458+
'want_assertions_signed': True,
459+
460+
'only_use_keys_in_metadata': True,
461+
462+
# When set to true, the SP will consume unsolicited SAML
463+
# Responses, i.e. SAML Responses for which it has not sent
464+
# a respective SAML Authentication Request.
465+
'allow_unsolicited': False,
466+
467+
# Permits to have attributes not configured in attribute-mappings
468+
# otherwise...without OID will be rejected
469+
'allow_unknown_attributes': True,
470+
453471
# in this section the list of IdPs we talk to are defined
454472
# This is not mandatory! All the IdP available in the metadata will be considered instead.
455473
'idp': {

0 commit comments

Comments
 (0)