From 38de81678c6d175cea298d317e59bedaebf90d56 Mon Sep 17 00:00:00 2001 From: daniel evertsson Date: Mon, 28 Apr 2014 11:38:18 +0200 Subject: [PATCH] Updated to guide on how to setup and run the basic IDP and SP examples --- doc/code/dummy.txt | 0 doc/examples/idp.rst | 22 +++++++++++++ doc/examples/index.rst | 6 ++-- doc/examples/sp.rst | 75 +++++++++++++++++++++++++++++++----------- 4 files changed, 81 insertions(+), 22 deletions(-) delete mode 100644 doc/code/dummy.txt diff --git a/doc/code/dummy.txt b/doc/code/dummy.txt deleted file mode 100644 index e69de29..0000000 diff --git a/doc/examples/idp.rst b/doc/examples/idp.rst index 40e8795..849045c 100644 --- a/doc/examples/idp.rst +++ b/doc/examples/idp.rst @@ -2,3 +2,25 @@ An extremly simple example of a SAML2 identity provider. ======================================================== + +Setup: +****** + +The folder [your path]/pysaml2/example/idp2 contains a file named idp_conf.py.example + +Take the file named idp_conf.py.example and rename it idp_conf.py + +Generate a metadata file based in the configuration file (idp_conf.py) by using the command:: + + make_metadata.py idp_conf.py > idp.xml + + +Run IDP: +******** + +Open a Terminal:: + + cd [your path]/pysaml2/example/idp2 + python idp.py idp_conf + +Note that you should not have the .py extension on the idp_conf.py while running the program diff --git a/doc/examples/index.rst b/doc/examples/index.rst index a53212d..19c26a4 100644 --- a/doc/examples/index.rst +++ b/doc/examples/index.rst @@ -1,11 +1,13 @@ .. _example_index: -These are examples of the usage of pySAML2! -=========================================== +Quick pysaml2 example +===================== :Release: |version| :Date: |today| +In order to confirm that pysaml2 has been installed correctly and are ready to use you could run this basic example + Contents: .. toctree:: diff --git a/doc/examples/sp.rst b/doc/examples/sp.rst index a5b4ed6..fdbacda 100644 --- a/doc/examples/sp.rst +++ b/doc/examples/sp.rst @@ -4,7 +4,7 @@ An extremly simple example of a SAML2 service provider. ======================================================= How it works ------------- +************ A SP works with authentication and possibly attribute aggregation. 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 instance, the friendly name is used as the key. Setup ------ +***** -If you look in the example/sp directory of the distribution you will see -the necessary files: +**sp-wsgi:** + +* Go to the folder: +[your path]/pysaml2/example/sp-wsgi + +* Take the file named sp_conf.py.example and rename it sp_conf.py + +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. + +* In order to generate the metadata file open a terminal:: + + cd [your path]/pysaml2/example/sp-wsgi + make_metadata.py sp_conf.py > sp.xml + + +**sp-repoze:** + +* Go to the folder: +[your path]/pysaml2/example/sp-repoze + +* Take the file named sp_conf.py.example and rename it sp_conf.py + +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. + +* In order to generate the metadata file open a terminal:: + + cd [your path]/pysaml2/example/sp-repoze + make_metadata.py sp_conf.py > sp.xml + +Important files: -application.py - which is the web application. In this case it will just print the - information provided by the IdP in a table. - sp_conf.py The SPs configuration who.ini The repoze.who configuration file -And then there are two files with certificates, mykey.pem with the private +Inside the folder named pki there are two files with certificates, mykey.pem with the private certificate and mycert.pem with the public part. I'll go through these step by step. -The application ---------------- - -Build to use the wsgiref's simple_server, which is fine for testing but -not for production. - - -SP configuration ----------------- +sp_conf.py +---------- The configuration is written as described in :ref:`howto_config`. It means among other 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 :: -Repoze configuration --------------------- +who.ini +------- +The file named who.ini is the repoze.who configuration file I'm not going through the INI file format here. You should read `Middleware Responsibilities `_ @@ -175,6 +193,23 @@ After this, the plugin is referenced in a couple of places:: Which means that the plugin is used in all phases. +Run SP: +******* + +Open a Terminal:: + + cd [your path]/pysaml2/example/sp-wsgi + python sp.py sp_conf + +Note that you should not have the .py extension on the sp_conf.py while running the program + +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) + +You should be redirected to the IDP and presented with a login screen. + +You could enter Username:roland and Password:dianakra +All users are specified in idp.py in a dictionary named PASSWD + The application ---------------