Skip to content

Commit 21a5b40

Browse files
committed
Add a Pyramid demo.
Add a Pyramid demo in demo_pyramid dir (generated with 'pyramid-cookiecutter-starter' Cookiecutter template). Add 'pyramid' as a keyword in setup.py.
1 parent c45c0f8 commit 21a5b40

22 files changed

Lines changed: 776 additions & 1 deletion

demo_pyramid/.coveragerc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[run]
2+
source = demo_pyramid
3+
omit = demo_pyramid/test*

demo_pyramid/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*.egg
2+
*.egg-info
3+
*.pyc
4+
*$py.class
5+
*~
6+
.coverage
7+
coverage.xml
8+
build/
9+
dist/
10+
.tox/
11+
nosetests.xml
12+
env*/
13+
tmp/
14+
Data.fs*
15+
*.sublime-project
16+
*.sublime-workspace
17+
.*.sw?
18+
.sw?
19+
.DS_Store
20+
coverage
21+
test

demo_pyramid/CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
0.0
2+
---
3+
4+
- Initial version.

demo_pyramid/MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include *.txt *.ini *.cfg *.rst
2+
recursive-include demo_pyramid *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2

demo_pyramid/README.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
demo_pyramid
2+
===============================
3+
4+
Getting Started
5+
---------------
6+
7+
- Change directory into your newly created project.
8+
9+
cd demo_pyramid
10+
11+
- Create a Python virtual environment.
12+
13+
python3 -m venv env
14+
15+
- Upgrade packaging tools.
16+
17+
env/bin/pip install --upgrade pip setuptools
18+
19+
- Install the project in editable mode with its testing requirements.
20+
21+
env/bin/pip install -e ".[testing]"
22+
23+
- Run your project's tests.
24+
25+
env/bin/pytest
26+
27+
- Run your project.
28+
29+
env/bin/pserve development.ini
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from pyramid.config import Configurator
2+
from pyramid.session import SignedCookieSessionFactory
3+
4+
5+
session_factory = SignedCookieSessionFactory('onelogindemopytoolkit')
6+
7+
8+
def main(global_config, **settings):
9+
""" This function returns a Pyramid WSGI application.
10+
"""
11+
config = Configurator(settings=settings)
12+
config.set_session_factory(session_factory)
13+
config.include('pyramid_jinja2')
14+
config.add_static_view('static', 'static', cache_max_age=3600)
15+
config.add_route('index', '/')
16+
config.add_route('attrs', '/attrs/')
17+
config.add_route('metadata', '/metadata/')
18+
config.scan()
19+
return config.make_wsgi_app()
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"security": {
3+
"nameIdEncrypted": false,
4+
"authnRequestsSigned": false,
5+
"logoutRequestSigned": false,
6+
"logoutResponseSigned": false,
7+
"signMetadata": false,
8+
"wantMessagesSigned": false,
9+
"wantAssertionsSigned": false,
10+
"wantNameId" : true,
11+
"wantNameIdEncrypted": false,
12+
"wantAssertionsEncrypted": false,
13+
"signatureAlgorithm": "http://www.w3.org/2000/09/xmldsig#rsa-sha1",
14+
"digestAlgorithm": "http://www.w3.org/2000/09/xmldsig#sha1"
15+
},
16+
"contactPerson": {
17+
"technical": {
18+
"givenName": "technical_name",
19+
"emailAddress": "technical@example.com"
20+
},
21+
"support": {
22+
"givenName": "support_name",
23+
"emailAddress": "support@example.com"
24+
}
25+
},
26+
"organization": {
27+
"en-US": {
28+
"name": "sp_test",
29+
"displayname": "SP test",
30+
"url": "http://sp.example.com"
31+
}
32+
}
33+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Take care of this folder that could contain private key. Be sure that this folder never is published.
2+
3+
Onelogin Python Toolkit expects that certs for the SP could be stored in this folder as:
4+
5+
* sp.key Private Key
6+
* sp.crt Public cert
7+
8+
Also you can use other cert to sign the metadata of the SP using the:
9+
10+
* metadata.key
11+
* metadata.crt
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"strict": true,
3+
"debug": true,
4+
"sp": {
5+
"entityId": "https://<sp_domain>/metadata/",
6+
"assertionConsumerService": {
7+
"url": "https://<sp_domain>/?acs",
8+
"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
9+
},
10+
"singleLogoutService": {
11+
"url": "https://<sp_domain>/?sls",
12+
"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
13+
},
14+
"NameIDFormat": "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified",
15+
"x509cert": "",
16+
"privateKey": ""
17+
},
18+
"idp": {
19+
"entityId": "https://app.onelogin.com/saml/metadata/<onelogin_connector_id>",
20+
"singleSignOnService": {
21+
"url": "https://app.onelogin.com/trust/saml2/http-post/sso/<onelogin_connector_id>",
22+
"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
23+
},
24+
"singleLogoutService": {
25+
"url": "https://app.onelogin.com/trust/saml2/http-redirect/slo/<onelogin_connector_id>",
26+
"binding": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
27+
},
28+
"x509cert": "<onelogin_connector_cert>"
29+
}
30+
}
1.29 KB
Loading

0 commit comments

Comments
 (0)