Skip to content

Commit fabb33b

Browse files
author
Roland Hedberg
committed
Merge pull request #116 from dv10den/master
Updated to doc on how to setup and run the basic IDP and SP examples
2 parents 5eed220 + 38de816 commit fabb33b

File tree

4 files changed

+81
-22
lines changed

4 files changed

+81
-22
lines changed

doc/code/dummy.txt

Whitespace-only changes.

doc/examples/idp.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,25 @@
22

33
An extremly simple example of a SAML2 identity provider.
44
========================================================
5+
6+
Setup:
7+
******
8+
9+
The folder [your path]/pysaml2/example/idp2 contains a file named idp_conf.py.example
10+
11+
Take the file named idp_conf.py.example and rename it idp_conf.py
12+
13+
Generate a metadata file based in the configuration file (idp_conf.py) by using the command::
14+
15+
make_metadata.py idp_conf.py > idp.xml
16+
17+
18+
Run IDP:
19+
********
20+
21+
Open a Terminal::
22+
23+
cd [your path]/pysaml2/example/idp2
24+
python idp.py idp_conf
25+
26+
Note that you should not have the .py extension on the idp_conf.py while running the program

doc/examples/index.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
.. _example_index:
22

3-
These are examples of the usage of pySAML2!
4-
===========================================
3+
Quick pysaml2 example
4+
=====================
55

66
:Release: |version|
77
:Date: |today|
88

9+
In order to confirm that pysaml2 has been installed correctly and are ready to use you could run this basic example
10+
911
Contents:
1012

1113
.. toctree::

doc/examples/sp.rst

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ An extremly simple example of a SAML2 service provider.
44
=======================================================
55

66
How it works
7-
------------
7+
************
88

99
A SP works with authentication and possibly attribute aggregation.
1010
Both of these functions can be seen as parts of the normal Repoze.who
@@ -26,35 +26,52 @@ from the IdP/AA. If there exists both a name and a friendly name, for
2626
instance, the friendly name is used as the key.
2727

2828
Setup
29-
-----
29+
*****
3030

31-
If you look in the example/sp directory of the distribution you will see
32-
the necessary files:
31+
**sp-wsgi:**
32+
33+
* Go to the folder:
34+
[your path]/pysaml2/example/sp-wsgi
35+
36+
* Take the file named sp_conf.py.example and rename it sp_conf.py
37+
38+
sp_conf.py is configured to run on localhost on port 8087. If you want to you could make the necessary changes before proceeding to the next step.
39+
40+
* In order to generate the metadata file open a terminal::
41+
42+
cd [your path]/pysaml2/example/sp-wsgi
43+
make_metadata.py sp_conf.py > sp.xml
44+
45+
46+
**sp-repoze:**
47+
48+
* Go to the folder:
49+
[your path]/pysaml2/example/sp-repoze
50+
51+
* Take the file named sp_conf.py.example and rename it sp_conf.py
52+
53+
sp_conf.py is configured to run on localhost on port 8087. If you want to you could make the necessary changes before proceeding to the next step.
54+
55+
* In order to generate the metadata file open a terminal::
56+
57+
cd [your path]/pysaml2/example/sp-repoze
58+
make_metadata.py sp_conf.py > sp.xml
59+
60+
Important files:
3361

34-
application.py
35-
which is the web application. In this case it will just print the
36-
information provided by the IdP in a table.
37-
3862
sp_conf.py
3963
The SPs configuration
4064

4165
who.ini
4266
The repoze.who configuration file
4367

44-
And then there are two files with certificates, mykey.pem with the private
68+
Inside the folder named pki there are two files with certificates, mykey.pem with the private
4569
certificate and mycert.pem with the public part.
4670

4771
I'll go through these step by step.
4872

49-
The application
50-
---------------
51-
52-
Build to use the wsgiref's simple_server, which is fine for testing but
53-
not for production.
54-
55-
56-
SP configuration
57-
----------------
73+
sp_conf.py
74+
----------
5875

5976
The configuration is written as described in :ref:`howto_config`. It means among other
6077
things that it's easily testable as to the correct syntax.
@@ -134,8 +151,9 @@ Change directory to where you have the configuration file and do ::
134151
135152

136153

137-
Repoze configuration
138-
--------------------
154+
who.ini
155+
-------
156+
The file named who.ini is the repoze.who configuration file
139157

140158
I'm not going through the INI file format here. You should read
141159
`Middleware Responsibilities <http://docs.repoze.org/who/2.0/middleware.html>`_
@@ -175,6 +193,23 @@ After this, the plugin is referenced in a couple of places::
175193

176194
Which means that the plugin is used in all phases.
177195

196+
Run SP:
197+
*******
198+
199+
Open a Terminal::
200+
201+
cd [your path]/pysaml2/example/sp-wsgi
202+
python sp.py sp_conf
203+
204+
Note that you should not have the .py extension on the sp_conf.py while running the program
205+
206+
Now you should be able to open a web browser go to to service provider (if you didn't change sp_conf.py it should be: http://localhost:8087)
207+
208+
You should be redirected to the IDP and presented with a login screen.
209+
210+
You could enter Username:roland and Password:dianakra
211+
All users are specified in idp.py in a dictionary named PASSWD
212+
178213
The application
179214
---------------
180215

0 commit comments

Comments
 (0)