This commit is contained in:
Roland Hedberg 2014-06-11 14:49:04 +02:00
parent 37884f5a6b
commit bbe6715c2a
2 changed files with 22 additions and 18 deletions

View File

@ -2,10 +2,10 @@ Setup and run simple RP.
========================
Setup RP2:
**************
The folder [your path]/pyoidc/oidc_example/rp2 contains a file named conf.py.example
**********
The folder [your path]/pysaml2/oidc_example/rp2 contains a file named conf.py.example
#. Take the file named **conf.py.example** and copy it to a new file named **conf.py**
#. Take the file named **conf.py.example** and rename it **conf.py**
#. Edit the conf.py
#. The most important attributes are BASE and PORT
@ -20,12 +20,12 @@ Note that you should not have the .py extension on the conf.py while running the
Setup RP3:
**************
The folder [your path]/pyoidc/oidc_example/rp3 contains a file named conf.py.example
**********
The folder [your path]/pysaml2/oidc_example/rp3 contains a file named conf.py.example
#. Take the file named **conf.py.example** and copy it to a new file named **conf.py**
#. Take the file named **conf.py.example** and rename it **conf.py**
#. Edit the conf.py
#. The most important attributes are BASE (use the IP address of your local machine) and PORT (use predefined in conf.py)
#. The most important attributes are BASE and PORT
Note: In the RP configuration file there is a dictionary named CLIENTS which in this quick example only should have one element:
"": {
@ -50,7 +50,7 @@ Test the RP and OP:
Open a browser and go to localhost:8666 (the url and port specified in [your path]/pyoidc/oidc_example/rp2/conf.py)
As a UID enter username@localhost:8092 (important: the port must match the port specified when starting the OP)
As a UID enter username@localhost:8093
Now you should be redirected to the OP and asked to login.

View File

@ -1,22 +1,25 @@
import importlib
import json
from tempfile import NamedTemporaryFile
import urllib
from urllib import urlencode
import urlparse
import uuid
import logging
import requests
import base64
import xml.etree.ElementTree as ET
from saml2 import BINDING_HTTP_ARTIFACT, BINDING_HTTP_REDIRECT, BINDING_HTTP_POST
from saml2 import BINDING_HTTP_ARTIFACT
from saml2 import BINDING_HTTP_REDIRECT
from saml2 import BINDING_HTTP_POST
import saml2
from saml2.client import Saml2Client
from saml2.s_utils import sid, rndstr, UnknownPrincipal, UnsupportedBinding
from saml2.s_utils import sid
from saml2.s_utils import rndstr
from saml2.s_utils import UnknownPrincipal
from saml2.s_utils import UnsupportedBinding
from oic.oauth2 import VerificationError
from oic.utils.authn.user import UserAuthnMethod, create_return_url
from oic.utils.authn.user import UserAuthnMethod
from oic.utils.authn.user import create_return_url
from urlparse import parse_qs
from oic.utils.http_util import Redirect, SeeOther, Response
from oic.utils.http_util import Redirect
from oic.utils.http_util import SeeOther
from oic.utils.http_util import Response
from oic.utils.http_util import Unauthorized
logger = logging.getLogger(__name__)
@ -32,7 +35,8 @@ class SAMLAuthnMethod(UserAuthnMethod):
CONST_SAML_COOKIE = "samlauthc"
CONST_HASIDP = "hasidp"
def __init__(self, srv, lookup, userdb, spconf, url, return_to, verification_endpoint="verify", cache=None,
def __init__(self, srv, lookup, userdb, spconf, url, return_to,
verification_endpoint="verify", cache=None,
bindings=None, userinfo=None):
"""
Constructor for the class.