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
+26-26Lines changed: 26 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,7 +144,7 @@ the classes and methods that are described in a later section.
144
144
145
145
This folder contains a Django project that will be used as demo to show how to add SAML support to the Django Framework. 'demo' is the main folder of the django project (with its settings.py, views.py, urls.py), 'templates' is the django templates of the project and 'saml' is a folder that contains the 'certs' folder that could be used to store the x509 public and private key, and the saml toolkit settings (settings.json and advanced_settings.json).
146
146
147
-
***Notice about certs***
147
+
***Notice about certs***
148
148
149
149
SAML requires a x.509 cert to sign and encrypt elements like NameID, Message, Assertion, Metadata.
150
150
@@ -572,7 +572,7 @@ auth.get_last_request_id()
572
572
Related to the SP there are 3 important endpoints: The metadata view, the ACS view and the SLS view.
573
573
The toolkit provides examples of those views in the demos, but lets see an example.
574
574
575
-
***SP Metadata***
575
+
***SP Metadata***
576
576
577
577
This code will provide the XML metadata file of our SP, based on the info that we provided in the settings files.
Before trying to get an attribute, check that the user is authenticated. If the user isn't authenticated, an empty dict will be returned. For example, if we call to get_attributes before a auth.process_response, the get_attributes() will return an empty dict.
665
665
666
666
667
-
***Single Logout Service (SLS)***
667
+
***Single Logout Service (SLS)***
668
668
669
669
This code handles the Logout Request and the Logout Responses.
670
670
@@ -765,7 +765,7 @@ If a match on the LogoutResponse ID and the LogoutRequest ID to be sent is requi
765
765
auth.get_last_request_id()
766
766
```
767
767
768
-
####Example of a view that initiates the SSO request and handles the response (is the acs target)####
768
+
####Example of a view that initiates the SSO request and handles the response (is the acs target)####
769
769
770
770
We can code a unique file that initiates the SSO process, handle the response, get the attributes, initiate the slo and processes the logout response.
771
771
@@ -820,7 +820,7 @@ else:
820
820
821
821
Described below are the main classes and methods that can be invoked from the SAML2 library.
822
822
823
-
####OneLogin_Saml2_Auth - auth.py####
823
+
####OneLogin_Saml2_Auth - auth.py####
824
824
825
825
Main class of OneLogin Python Toolkit
826
826
@@ -848,7 +848,7 @@ Main class of OneLogin Python Toolkit
848
848
****get_last_request_xml*** Returns the most recently-constructed/processed XML SAML request (AuthNRequest, LogoutRequest)
849
849
****get_last_response_xml*** Returns the most recently-constructed/processed XML SAML response (SAMLResponse, LogoutResponse). If the SAMLResponse had an encrypted assertion, decrypts it.
850
850
851
-
####OneLogin_Saml2_Auth - authn_request.py####
851
+
####OneLogin_Saml2_Auth - authn_request.py####
852
852
853
853
SAML 2 Authentication Request class
854
854
@@ -857,7 +857,7 @@ SAML 2 Authentication Request class
857
857
****get_id*** Returns the AuthNRequest ID.
858
858
****get_xml*** Returns the XML that will be sent as part of the request.
859
859
860
-
####OneLogin_Saml2_Response - response.py####
860
+
####OneLogin_Saml2_Response - response.py####
861
861
862
862
SAML 2 Authentication Response class
863
863
@@ -876,7 +876,7 @@ SAML 2 Authentication Response class
876
876
****get_error*** After execute a validation process, if fails this method returns the cause
877
877
****get_xml_document*** Returns the SAML Response document (If contains an encrypted assertion, decrypts it).
A class that contains methods to obtain and parse metadata from IdP
987
987
@@ -1006,7 +1006,7 @@ how it deployed. New demos using other python frameworks are welcome as a contri
1006
1006
We said that this toolkit includes a django application demo and a flask applicacion demo,
1007
1007
lets see how fast is deploy them.
1008
1008
1009
-
***Virtualenv***
1009
+
***Virtualenv***
1010
1010
1011
1011
The use of a [virtualenv](http://virtualenv.readthedocs.org/en/latest/) is
1012
1012
highly recommended.
@@ -1051,7 +1051,7 @@ Now, with the virtualenv loaded, you can run the demo like this:
1051
1051
1052
1052
You'll have the demo running at http://localhost:8000
1053
1053
1054
-
####Content####
1054
+
####Content####
1055
1055
1056
1056
The flask project contains:
1057
1057
@@ -1063,19 +1063,19 @@ The flask project contains:
1063
1063
****saml*** Is a folder that contains the 'certs' folder that could be used to store the x509 public and private key, and the saml toolkit settings (settings.json and advanced_settings.json).
1064
1064
1065
1065
1066
-
####SP setup####
1066
+
####SP setup####
1067
1067
1068
1068
The Onelogin's Python Toolkit allows you to provide the settings info in 2 ways: settings files or define a setting dict. In the demo-flask it used the first method.
1069
1069
1070
1070
In the index.py file we define the app.config['SAML_PATH'], that will target to the 'saml' folder. We require it in order to load the settings files.
1071
1071
1072
1072
First we need to edit the saml/settings.json, configure the SP part and review the metadata of the IdP and complete the IdP info. Later edit the saml/advanced_settings.json files and configure the how the toolkit will work. Check the settings section of this document if you have any doubt.
1073
1073
1074
-
####IdP setup####
1074
+
####IdP setup####
1075
1075
1076
1076
Once the SP is configured, the metadata of the SP is published at the /metadata url. Based on that info, configure the IdP.
1077
1077
1078
-
####How it works####
1078
+
####How it works####
1079
1079
1080
1080
1. First time you access to the main view 'http://localhost:8000', you can select to login and return to the same view or login and be redirected to /?attrs (attrs view).
1081
1081
@@ -1120,7 +1120,7 @@ Note that many of the configuration files expect HTTPS. This is not required by
1120
1120
1121
1121
If you want to integrate a production django application, take a look on this SAMLServiceProviderBackend that uses our toolkit to add SAML support: https://github.com/KristianOellegaard/django-saml-service-provider
1122
1122
1123
-
####Content####
1123
+
####Content####
1124
1124
1125
1125
The django project contains:
1126
1126
@@ -1136,19 +1136,19 @@ The django project contains:
1136
1136
1137
1137
****templates***. Is the folder where django stores the templates of the project. It was implemented a base.html template that is extended by index.html and attrs.html, the templates of our simple demo that shows messages, user attributes when available and login and logout links.
1138
1138
1139
-
####SP setup####
1139
+
####SP setup####
1140
1140
1141
1141
The Onelogin's Python Toolkit allows you to provide the settings info in 2 ways: settings files or define a setting dict. In the demo-django it used the first method.
1142
1142
1143
1143
After set the SAML_FOLDER in the demo/settings.py, the settings of the python toolkit will be loaded on the django web.
1144
1144
1145
1145
First we need to edit the saml/settings.json, configure the SP part and review the metadata of the IdP and complete the IdP info. Later edit the saml/advanced_settings.json files and configure the how the toolkit will work. Check the settings section of this document if you have any doubt.
1146
1146
1147
-
####IdP setup####
1147
+
####IdP setup####
1148
1148
1149
1149
Once the SP is configured, the metadata of the SP is published at the /metadata url. Based on that info, configure the IdP.
1150
1150
1151
-
####How it works####
1151
+
####How it works####
1152
1152
1153
1153
This demo works very similar to the flask-demo (We did it intentionally).
1154
1154
@@ -1177,7 +1177,7 @@ Now you can run the demo like this:
1177
1177
1178
1178
If that worked, the demo is now running at http://localhost:6543.
1179
1179
1180
-
####Content####
1180
+
####Content####
1181
1181
1182
1182
The Pyramid project contains:
1183
1183
@@ -1191,7 +1191,7 @@ The Pyramid project contains:
1191
1191
****saml*** is a folder that contains the 'certs' folder that could be used to store the x509 public and private key, and the saml toolkit settings (settings.json and advanced_settings.json).
1192
1192
1193
1193
1194
-
####SP setup####
1194
+
####SP setup####
1195
1195
1196
1196
The Onelogin's Python Toolkit allows you to provide the settings info in 2 ways: settings files or define a setting dict. In demo_pyramid the first method is used.
1197
1197
@@ -1203,7 +1203,7 @@ First we need to edit the saml/settings.json, configure the SP part and review t
1203
1203
1204
1204
Once the SP is configured, the metadata of the SP is published at the /metadata/ url. Based on that info, configure the IdP.
1205
1205
1206
-
####How it works####
1206
+
####How it works####
1207
1207
1208
1208
1. First time you access to the main view 'http://localhost:6543', you can select to login and return to the same view or login and be redirected to /?attrs (attrs view).
0 commit comments