-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Review] Quite a lot of minor improvements #1
base: master
Are you sure you want to change the base?
Changes from all commits
7ddc980
dcc8b07
4f09d92
37ad2bb
4374b48
6b4553a
a399a40
85747e6
5cab86a
0dbc898
bdc16cb
68842b9
b7b2ad2
f93a653
bc11cbc
9d576b8
fe226cf
5237ad8
33bce98
4d0fd15
b2f1011
ef63d55
79a445f
ae304ba
8623375
0b3d46d
81b1614
33ba4d9
1083673
e57f590
94480aa
c677497
fdf715b
0dab78b
5d62003
cb93692
6a0d1c7
ca3491d
5f1b033
3dd894d
51d8b09
c3079f5
413355e
53a054c
496fad0
66c54c1
c3a8dd1
beeca78
a5d68f3
1bf2287
ae1bd79
e6de2e0
e48e1d5
f8c2860
05e54dc
7932d0e
fa8c30a
57323b3
530264d
c94d037
527cfbc
fce378a
b9e9646
3b7aa3e
48b7b75
82630cd
1930d37
acdcbe6
53f4350
2427f75
3c99327
ae4a0ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
pipeline: | ||
restore-cache: | ||
image: drillster/drone-volume-cache | ||
restore: true | ||
mount: | ||
- cache | ||
- .tox | ||
volumes: | ||
- /tmp/drone-cache:/cache | ||
|
||
build: | ||
image: python:3.5 | ||
commands: | ||
- mkdir -p cache/pip | ||
- pip -q install --upgrade --cache-dir cache/pip tox flake8 | ||
- tox -e py35-django110 | ||
# - flake8 --config=.flake8rc | ||
# - "isort -df -c -rc" | ||
|
||
dist: | ||
image: python:3.5 | ||
commands: | ||
- '[ "${DRONE_TAG##v}" = "$$(python setup.py -V)" ]' | ||
- python setup.py sdist bdist_wheel | ||
when: | ||
event: tag | ||
tag: v* | ||
|
||
pypi: | ||
image: thomasf/twine | ||
commands: | ||
- twine upload dist/* | ||
secrets: [ twine_username, twine_password ] | ||
when: | ||
event: tag | ||
tag: v* | ||
|
||
|
||
rebuild-cache: | ||
image: drillster/drone-volume-cache | ||
rebuild: true | ||
mount: | ||
- cache | ||
- .tox | ||
volumes: | ||
- /tmp/drone-cache:/cache |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ var/ | |
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
.venv | ||
|
||
# Installer logs | ||
pip-log.txt | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[settings] | ||
skip=.tox |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,18 +7,21 @@ Behind the scenes, it uses Roland Hedberg's great pyoidc library. | |
|
||
Modified by JHUAPL BOSS to support Python3 | ||
|
||
Modified by Thomas Frössman with fixes and additional modifications. | ||
|
||
Quickstart | ||
---------- | ||
|
||
Install djangooidc:: | ||
|
||
# Latest code - unstable! | ||
pip install git+https://github.com/jhuapl-boss/django-oidc.git | ||
|
||
pip install git+https://github.com/{desiredforkname}/django-oidc.git | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will want to keep our original version |
||
|
||
(replace {desiredforkname} by the github username; find the fork which suit your needs, or just copy the name from your browser location field). | ||
|
||
Then to use it in a Django project, add this to your urls.py:: | ||
|
||
url(r'openid/', include('djangooidc.urls')), | ||
url(r'^openid/', include('djangooidc.urls')), | ||
|
||
|
||
Then add the following items to your settings.py: | ||
|
@@ -66,6 +69,26 @@ For example, an Azure AD OP would be:: | |
You may now test the authentication by going to (on the development server) http://localhost:8000/openid/login or to any | ||
of your views that requires authentication. | ||
|
||
Using a private key jwt for client authentication | ||
------------------------------------------------- | ||
If you are using private keys for client authentication with the OP, you can specify it like:: | ||
|
||
OIDC_PROVIDERS = { | ||
"mitreid": { | ||
"srv_discovery_url": "https://mitreid.org/", | ||
"behaviour": OIDC_DEFAULT_BEHAVIOUR, | ||
"client_registration": { | ||
"client_id": "your_client_id", | ||
"redirect_uris": ["http://localhost:8000/openid/callback/login/"], | ||
'token_endpoint_auth_method': ['private_key_jwt'], | ||
"enc_kid": "rsa_test", | ||
"keyset_jwk_file": "file://keys/keyset.jwk" | ||
} | ||
} | ||
} | ||
|
||
In this case keys/keyset.jwk is the full keyset (public and private keys) used when registering the client with the OP | ||
manually. (I.E. you've provided the OP with the public key.) | ||
|
||
Features | ||
-------- | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Django settings for access_web project. | ||
import os | ||
import django | ||
|
||
DEBUG = True | ||
TEMPLATE_DEBUG = DEBUG | ||
|
@@ -36,7 +37,7 @@ | |
|
||
# Language code for this installation. All choices can be found here: | ||
# http://www.i18nguy.com/unicode/language-identifiers.html | ||
LANGUAGE_CODE = 'en-US' | ||
LANGUAGE_CODE = 'en-us' | ||
|
||
SITE_ID = 1 | ||
|
||
|
@@ -95,13 +96,25 @@ | |
'django.template.loaders.app_directories.Loader', | ||
) | ||
|
||
MIDDLEWARE_CLASSES = ( | ||
'django.middleware.common.CommonMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
) | ||
if django.VERSION >= (2, 1): | ||
MIDDLEWARE = [ | ||
'django.middleware.security.SecurityMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.common.CommonMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
] | ||
else: | ||
MIDDLEWARE_CLASSES = ( | ||
'django.middleware.common.CommonMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
) | ||
|
||
|
||
SESSION_ENGINE = 'django.contrib.sessions.backends.db' | ||
|
||
|
@@ -121,9 +134,28 @@ | |
|
||
ROOT_URLCONF = 'django_rp.urls' | ||
|
||
TEMPLATE_DIRS = ( | ||
# os.path.join(BASE_DIR, "django_rp/templates"), | ||
) | ||
if django.VERSION >= (2, 1): | ||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [ | ||
os.path.join(BASE_DIR, 'djangooidc/templates'), | ||
], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.request', | ||
'django.contrib.auth.context_processors.auth', | ||
'django.contrib.messages.context_processors.messages', | ||
], | ||
}, | ||
}, | ||
] | ||
else: | ||
TEMPLATE_DIRS = ( | ||
# os.path.join(BASE_DIR, "django_rp/templates"), | ||
) | ||
|
||
INSTALLED_APPS = ( | ||
'django.contrib.auth', | ||
|
@@ -218,16 +250,16 @@ | |
# The keys in this dictionary are the OPs (OpenID Providers) short user friendly name not the issuer (iss) name. | ||
OIDC_PROVIDERS = { | ||
# Test OP - webfinger supported on non-standard URL, no client self registration. | ||
"Azure Active Directory": { | ||
"srv_discovery_url": "https://sts.windows.net/9019caa7-f3ba-4261-8b4f-9162bdbe8cd1/", | ||
"behaviour": OIDC_DEFAULT_BEHAVIOUR, | ||
"client_registration": { | ||
"client_id": "0d21f6d8-796f-4879-a2e1-314ddfcfb737", | ||
"client_secret": "6hzvhNTsHPvTiUH/GUHVsFDt8b0BajZNox/iFI7iVJ8=", | ||
"redirect_uris": ["http://localhost:8000/openid/callback/login/"], | ||
"post_logout_redirect_uris": ["http://localhost:8000/openid/callback/logout/"], | ||
} | ||
}, | ||
# "Azure Active Directory": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the full file, this comments out all OIDC providers. What was the reason for this, as it leaves the django_rp example in an incomplete state. |
||
# "srv_discovery_url": "https://sts.windows.net/9019caa7-f3ba-4261-8b4f-9162bdbe8cd1/", | ||
# "behaviour": OIDC_DEFAULT_BEHAVIOUR, | ||
# "client_registration": { | ||
# "client_id": "0d21f6d8-796f-4879-a2e1-314ddfcfb737", | ||
# "client_secret": "6hzvhNTsHPvTiUH/GUHVsFDt8b0BajZNox/iFI7iVJ8=", | ||
# "redirect_uris": ["http://localhost:8000/openid/callback/login/"], | ||
# "post_logout_redirect_uris": ["http://localhost:8000/openid/callback/logout/"], | ||
# } | ||
# }, | ||
# # No webfinger support, but OP information lookup and client registration | ||
# "xenosmilus": { | ||
# "srv_discovery_url": "https://xenosmilus2.umdc.umu.se:8091/", | ||
|
@@ -283,4 +315,4 @@ | |
# }, | ||
} | ||
# | ||
############################################################################### | ||
############################################################################### |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
from django.conf.urls import patterns, include, url | ||
from os import path | ||
|
||
from django.conf.urls import include, url | ||
from django.contrib import admin | ||
|
||
from testapp.views import home, unprotected | ||
|
||
admin.autodiscover() | ||
|
||
from os import path | ||
|
||
BASEDIR = path.dirname(path.abspath(__file__)) | ||
|
||
urlpatterns = patterns('', | ||
# URLS for OpenId authentication | ||
url(r'openid/', include('djangooidc.urls')), | ||
|
||
# Test URLs | ||
url(r'^$', 'testapp.views.home', name='home'), | ||
url(r'^unprotected$', 'testapp.views.unprotected', name='unprotected'), | ||
urlpatterns = [ | ||
# URLS for OpenId authentication | ||
url(r'^openid/', include('djangooidc.urls')), | ||
|
||
# Uncomment the next line to enable the admin: | ||
url(r'^admin/', include(admin.site.urls)), | ||
# Test URLs | ||
url(r'^$', home, name='home'), | ||
url(r'^unprotected$', unprotected, name='unprotected'), | ||
|
||
) | ||
# Uncomment the next line to enable the admin: | ||
url(r'^admin/', admin.site.urls), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# coding: utf-8 | ||
|
||
__version__ = '0.1.3' | ||
__version__ = '0.0.9' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May create an AUTHORS file / add to NOTICE instead of including this information in the README.
This line breaks setup.py, as it includes a non-ascii character and setup.py reads this file without setting the encoding to UTF-8.