You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-18Lines changed: 21 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,8 @@ This version supports Python3. Python 2 support was deprecated on Jan 1st, 2020:
13
13
14
14
#### Warning ####
15
15
16
+
Version 1.16.X is the latest version supporting Python2, consider its use deprecated. 1.17 won't be Python2 and old Python3 compatible.
17
+
16
18
Version 1.13.0 sets sha256 and rsa-sha256 as default algorithms
17
19
18
20
Version 1.8.0 sets strict mode active by default
@@ -154,13 +156,13 @@ A replay attack is basically try to reuse an intercepted valid SAML Message in o
154
156
SAML Messages have a limited timelife (NotBefore, NotOnOrAfter) that
155
157
make harder this kind of attacks, but they are still possible.
156
158
157
-
In order to avoid them, the SP can keep a list of SAML Messages or Assertion IDs alredy valdidated and processed. Those values only need
159
+
In order to avoid them, the SP can keep a list of SAML Messages or Assertion IDs already validated and processed. Those values only need
158
160
to be stored the amount of time of the SAML Message life time, so
159
161
we don't need to store all processed message/assertion Ids, but the most recent ones.
160
162
161
163
The OneLogin_Saml2_Auth class contains the [get_last_request_id](https://github.com/onelogin/python3-saml/blob/ab62b0d6f3e5ac2ae8e95ce3ed2f85389252a32d/src/onelogin/saml2/auth.py#L357), [get_last_message_id](https://github.com/onelogin/python3-saml/blob/ab62b0d6f3e5ac2ae8e95ce3ed2f85389252a32d/src/onelogin/saml2/auth.py#L364) and [get_last_assertion_id](https://github.com/onelogin/python3-saml/blob/ab62b0d6f3e5ac2ae8e95ce3ed2f85389252a32d/src/onelogin/saml2/auth.py#L371) methods to retrieve the IDs
162
164
163
-
Checking that the ID of the current Message/Assertion does not exists in the lis of the ones already processed will prevent replay attacks.
165
+
Checking that the ID of the current Message/Assertion does not exists in the list of the ones already processed will prevent replay attacks.
164
166
165
167
166
168
Getting Started
@@ -297,9 +299,9 @@ This is the ``settings.json`` file:
297
299
},
298
300
// If you need to specify requested attributes, set a
299
301
// attributeConsumingService. nameFormat, attributeValue and
300
-
// friendlyName can be ommited
302
+
// friendlyName can be omitted
301
303
"attributeConsumingService": {
302
-
// OPTIONAL: only specifiy if SP requires this.
304
+
// OPTIONAL: only specify if SP requires this.
303
305
// index is an integer which identifies the attributeConsumingService used
304
306
// to the SP. SAML toolkit supports configuring only one attributeConsumingService
305
307
// but in certain cases the SP requires a different value. Defaults to '1'.
@@ -366,7 +368,7 @@ This is the ``settings.json`` file:
366
368
/*
367
369
* Instead of using the whole X.509cert you can use a fingerprint in order to
368
370
* validate a SAMLResponse (but you still need the X.509cert to validate LogoutRequest and LogoutResponse using the HTTP-Redirect binding).
369
-
* But take in mind that the algortithm for the fingerprint should be as strong as the algorithm in a normal certificate signature
371
+
* But take in mind that the algorithm for the fingerprint should be as strong as the algorithm in a normal certificate signature
370
372
* (e.g. SHA256 or strong)
371
373
*
372
374
* (openssl x509 -noout -fingerprint -in "idp.crt" to generate it,
@@ -501,7 +503,7 @@ In addition to the required settings data (idp, sp), extra settings can be defin
501
503
'allowRepeatAttributeName':false,
502
504
503
505
// If the toolkit receive a message signed with a
504
-
// deprecated algoritm (defined at the constant class)
506
+
// deprecated algorithm (defined at the constant class)
505
507
// will raise an error and reject the message
506
508
"rejectDeprecatedAlgorithm":true
507
509
},
@@ -520,7 +522,7 @@ In addition to the required settings data (idp, sp), extra settings can be defin
520
522
},
521
523
522
524
// Organization information template, the info in en_US lang is
auth = OneLogin_Saml2_Auth(req) # Constructor of the SP, loads settings.json
678
680
# and advanced_settings.json
679
681
680
-
auth.login() # Method that builds and sends the AuthNRequest
682
+
auth.login() # This method will build and return a AuthNRequest URL that can be
683
+
# either redirected to, or printed out onto the screen as a hyperlink
681
684
```
682
685
683
686
The ``AuthNRequest`` will be sent signed or unsigned based on the security info of the ``advanced_settings.json`` file (i.e. ``authnRequestsSigned``).
@@ -690,7 +693,7 @@ We can set a ``return_to`` url parameter to the login function and that will be
690
693
target_url ='https://example.com'
691
694
auth.login(return_to=target_url)
692
695
```
693
-
The login method can recieve 3 more optional parameters:
696
+
The login method can receive 3 more optional parameters:
694
697
695
698
*``force_authn`` When ``true``, the ``AuthNReuqest`` will set the ``ForceAuthn='true'``
696
699
*``is_passive`` When true, the ``AuthNReuqest`` will set the ``Ispassive='true'``
@@ -769,7 +772,7 @@ Notice that we saved the user data in the session before the redirection to have
769
772
In order to retrieve attributes we use:
770
773
771
774
```python
772
-
attributes = auth.get_attributes();
775
+
attributes = auth.get_attributes()
773
776
```
774
777
775
778
With this method we get a dict with all the user data provided by the IdP in the assertion of the SAML response.
@@ -785,12 +788,12 @@ If we execute print attributes we could get:
785
788
}
786
789
```
787
790
788
-
Each attribute name can be used as a key to obtain the value. Every attribute is a list of values. A single-valued attribute is a listy of a single element.
791
+
Each attribute name can be used as a key to obtain the value. Every attribute is a list of values. A single-valued attribute is a list of a single element.
789
792
790
793
The following code is equivalent:
791
794
792
795
```python
793
-
attributes = auth.get_attributes();
796
+
attributes = auth.get_attributes()
794
797
print(attributes['cn'])
795
798
796
799
print(auth.get_attribute('cn'))
@@ -813,7 +816,7 @@ if len(errors) == 0:
813
816
# the value of the url is a trusted URL.
814
817
return redirect(url)
815
818
else:
816
-
print("Sucessfully Logged out")
819
+
print("Successfully Logged out")
817
820
else:
818
821
print("Error when processing SLO: %s%s"% (', '.join(errors), auth.get_last_error_reason()))
819
822
```
@@ -955,7 +958,7 @@ elif 'sls' in request.args: # Single
955
958
# the value of the url is a trusted URL.
956
959
return redirect(url)
957
960
else:
958
-
msg ="Sucessfully logged out"
961
+
msg ="Successfully logged out"
959
962
960
963
iflen(errors) ==0:
961
964
print(msg)
@@ -1071,7 +1074,7 @@ SAML 2 Logout Request class
1071
1074
****get_nameid*** Gets the NameID of the Logout Request Message (returns a string).
1072
1075
****get_issuer*** Gets the Issuer of the Logout Request Message.
1073
1076
****get_session_indexes*** Gets the ``SessionIndexes`` from the Logout Request.
1074
-
****is_valid*** Checks if the Logout Request recieved is valid.
1077
+
****is_valid*** Checks if the Logout Request received is valid.
1075
1078
****get_error*** After execute a validation process, if fails this method returns the cause.
1076
1079
****get_xml*** Returns the XML that will be sent as part of the request or that was received at the SP
1077
1080
@@ -1154,7 +1157,7 @@ Auxiliary class that contains several methods
1154
1157
****get_expire_time*** Compares 2 dates and returns the earliest.
1155
1158
****delete_local_session*** Deletes the local session.
1156
1159
****calculate_X.509_fingerprint*** Calculates the fingerprint of a X.509 cert.
1157
-
****format_finger_print***Formates a fingerprint.
1160
+
****format_finger_print***Formats a fingerprint.
1158
1161
****generate_name_id*** Generates a nameID.
1159
1162
****get_status*** Gets Status from a Response.
1160
1163
****decrypt_element*** Decrypts an encrypted element.
@@ -1204,7 +1207,7 @@ let's see how fast is it to deploy them.
1204
1207
The use of a [virtualenv](http://virtualenv.readthedocs.org/en/latest/) is
1205
1208
highly recommended.
1206
1209
1207
-
Virtualenv helps isolating the python enviroment used to run the toolkit. You
1210
+
Virtualenv helps isolating the python environment used to run the toolkit. You
1208
1211
can find more details and an installation guide in the
@@ -1500,7 +1503,7 @@ Once the SP is configured, the metadata of the SP is published at the ``/metadat
1500
1503
1501
1504
4. We are logged in the app and the user attributes are showed. At this point, we can test the single log out functionality.
1502
1505
1503
-
The single log out funcionality could be tested by 2 ways.
1506
+
The single log out functionality could be tested by 2 ways.
1504
1507
1505
1508
5.1 SLO Initiated by SP. Click on the "logout" link at the SP, after that a Logout Request is sent to the IdP, the session at the IdP is closed and replies through the client to the SP with a Logout Response (sent to the Single Logout Service endpoint). The SLS endpoint /?sls of the SP process the Logout Response and if is valid, close the user session of the local app. Notice that the SLO Workflow starts and ends at the SP.
0 commit comments