Change name of the package.

This commit is contained in:
juanifioren 2015-02-18 15:07:22 -03:00
parent a88a3567c3
commit 2bac30361e
26 changed files with 146 additions and 46 deletions

View file

@ -1,3 +1,3 @@
include LICENSE
include README.rst
recursive-include openid_provider/templates *
recursive-include oidc_provider/templates *

View file

@ -1,5 +1,5 @@
Django-OIDC-Provider
Django OIDC Provider
####################
**This project is in ALFA version and is rapidly changing. DO NOT USE IT FOR PRODUCTION SITES.**
@ -19,7 +19,7 @@ Install the package using pip.
.. code:: bash
pip install git+https://github.com/juanifioren/django-oidc-provider.git#egg=openid_provider
pip install git+https://github.com/juanifioren/django-oidc-provider.git#egg=oidc_provider
Add it to your apps.
@ -33,7 +33,7 @@ Add it to your apps.
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'openid_provider',
'oidc_provider',
# ...
)
@ -43,7 +43,7 @@ Add the provider urls.
urlpatterns = patterns('',
# ...
url(r'^openid/', include('openid_provider.urls', namespace='openid_provider')),
url(r'^openid/', include('oidc_provider.urls', namespace='oidc_provider')),
# ...
)
@ -82,7 +82,7 @@ Then let's create a Client. Start django shell: ``python manage.py shell``.
.. code:: python
>>> from openid_provider.models import Client
>>> from oidc_provider.models import Client
>>> c = Client(name='Some Client', client_id='123', client_secret='456', response_type='code', redirect_uris=['http://example.com/'])
>>> c.save()
@ -144,7 +144,7 @@ Check out an example:
.. code:: python
from openid_provider.lib.claims import AbstractScopeClaims
from oidc_provider.lib.claims import AbstractScopeClaims
class MyAppScopeClaims(AbstractScopeClaims):
@ -180,7 +180,7 @@ If a field is empty or ``None`` will be cleaned from the response.
Templates
*********
Add your own templates files inside a folder named ``templates/openid_provider/``.
Add your own templates files inside a folder named ``templates/oidc_provider/``.
You can copy the sample html here and edit them with your own styles.
**authorize.html**
@ -191,7 +191,7 @@ You can copy the sample html here and edit them with your own styles.
<p>Client <strong>{{ client.name }}</strong> would like to access this information of you ...</p>
<form method="post" action="{% url 'openid_provider:authorize' %}">
<form method="post" action="{% url 'oidc_provider:authorize' %}">
{% csrf_token %}
@ -224,7 +224,7 @@ Just run them as normal Django tests.
.. code:: bash
$ python manage.py test openid_provider
$ python manage.py test oidc_provider
************
Contributing

View file

@ -1,5 +1,5 @@
from django.utils.translation import ugettext as _
from openid_provider.models import UserInfo
from oidc_provider.models import UserInfo
class AbstractScopeClaims(object):

View file

@ -1,10 +1,10 @@
from datetime import timedelta
from django.utils import timezone
from openid_provider.lib.errors import *
from openid_provider.lib.utils.params import *
from openid_provider.lib.utils.token import *
from openid_provider.models import *
from openid_provider import settings
from oidc_provider.lib.errors import *
from oidc_provider.lib.utils.params import *
from oidc_provider.lib.utils.token import *
from oidc_provider.models import *
from oidc_provider import settings
import uuid

View file

@ -1,9 +1,9 @@
from django.http import JsonResponse
from openid_provider.lib.errors import *
from openid_provider.lib.utils.params import *
from openid_provider.lib.utils.token import *
from openid_provider.models import *
from openid_provider import settings
from oidc_provider.lib.errors import *
from oidc_provider.lib.utils.params import *
from oidc_provider.lib.utils.token import *
from oidc_provider.models import *
from oidc_provider import settings
import urllib

View file

@ -1,10 +1,10 @@
from django.http import HttpResponse
from django.http import JsonResponse
from openid_provider.lib.errors import *
from openid_provider.lib.claims import *
from openid_provider.lib.utils.params import *
from openid_provider.models import *
from openid_provider import settings
from oidc_provider.lib.errors import *
from oidc_provider.lib.claims import *
from oidc_provider.lib.utils.params import *
from oidc_provider.models import *
from oidc_provider import settings
import re

View file

@ -1,7 +1,7 @@
from datetime import timedelta
from django.utils import timezone
from openid_provider.models import *
from openid_provider import settings
from oidc_provider.models import *
from oidc_provider import settings
import jwt
import time
import uuid

View file

@ -0,0 +1,100 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Client',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(default=b'', max_length=100)),
('client_id', models.CharField(unique=True, max_length=255)),
('client_secret', models.CharField(unique=True, max_length=255)),
('response_type', models.CharField(max_length=30, choices=[(b'code', b'code (Authorization Code Flow)'), (b'id_token', b'id_token (Implicit Flow)'), (b'id_token token', b'id_token token (Implicit Flow)')])),
('_redirect_uris', models.TextField(default=b'')),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Code',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('code', models.CharField(unique=True, max_length=255)),
('expires_at', models.DateTimeField()),
('_scope', models.TextField(default=b'')),
('client', models.ForeignKey(to='oidc_provider.Client')),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Token',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('access_token', models.CharField(unique=True, max_length=255)),
('expires_at', models.DateTimeField()),
('_scope', models.TextField(default=b'')),
('_id_token', models.TextField()),
('client', models.ForeignKey(to='oidc_provider.Client')),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='UserInfo',
fields=[
('user', models.OneToOneField(primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('given_name', models.CharField(default=b'', max_length=255)),
('family_name', models.CharField(default=b'', max_length=255)),
('middle_name', models.CharField(default=b'', max_length=255)),
('nickname', models.CharField(default=b'', max_length=255)),
('preferred_username', models.CharField(default=b'', max_length=255)),
('profile', models.URLField(default=b'')),
('picture', models.URLField(default=b'')),
('website', models.URLField(default=b'')),
('email_verified', models.BooleanField(default=False)),
('gender', models.CharField(default=b'', max_length=100)),
('birthdate', models.DateField(null=True)),
('zoneinfo', models.CharField(default=b'', max_length=100)),
('locale', models.CharField(default=b'', max_length=100)),
('phone_number', models.CharField(default=b'', max_length=255)),
('phone_number_verified', models.BooleanField(default=False)),
('address_formatted', models.CharField(default=b'', max_length=255)),
('address_street_address', models.CharField(default=b'', max_length=255)),
('address_locality', models.CharField(default=b'', max_length=255)),
('address_region', models.CharField(default=b'', max_length=255)),
('address_postal_code', models.CharField(default=b'', max_length=255)),
('address_country', models.CharField(default=b'', max_length=255)),
('updated_at', models.DateTimeField(auto_now=True, null=True)),
],
options={
},
bases=(models.Model,),
),
migrations.AddField(
model_name='token',
name='user',
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
preserve_default=True,
),
migrations.AddField(
model_name='code',
name='user',
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
preserve_default=True,
),
]

View file

@ -1,5 +1,5 @@
from django.conf import settings
from openid_provider.lib.claims import AbstractScopeClaims
from oidc_provider.lib.claims import AbstractScopeClaims
# Here goes all the package default settings.

View file

@ -2,7 +2,7 @@
<p>Client <strong>{{ client.name }}</strong> would like to access this information of you ...</p>
<form method="post" action="{% url 'openid_provider:authorize' %}">
<form method="post" action="{% url 'oidc_provider:authorize' %}">
{% csrf_token %}

View file

@ -3,9 +3,9 @@ from django.contrib.auth.models import AnonymousUser
from django.core.urlresolvers import reverse
from django.test import RequestFactory
from django.test import TestCase
from openid_provider import settings
from openid_provider.tests.utils import *
from openid_provider.views import *
from oidc_provider import settings
from oidc_provider.tests.utils import *
from oidc_provider.views import *
import urllib
@ -20,7 +20,7 @@ class CodeFlowTestCase(TestCase):
"""
Generate an OpenID Authentication Request using the fake client data.
"""
path = reverse('openid_provider:authorize')
path = reverse('oidc_provider:authorize')
query_str = urllib.urlencode({
'client_id': self.client.client_id,
@ -42,7 +42,7 @@ class CodeFlowTestCase(TestCase):
See: https://tools.ietf.org/html/rfc6749#section-4.1.2.1
"""
url = reverse('openid_provider:authorize')
url = reverse('oidc_provider:authorize')
request = self.factory.get(url)
response = AuthorizeView.as_view()(request)

View file

@ -1,5 +1,5 @@
from django.contrib.auth.models import User
from openid_provider.models import *
from oidc_provider.models import *
def create_fake_user():

View file

@ -1,6 +1,6 @@
from django.conf.urls import patterns, include, url
from django.views.decorators.csrf import csrf_exempt
from openid_provider.views import *
from oidc_provider.views import *
urlpatterns = patterns('',

View file

@ -4,10 +4,10 @@ from django.shortcuts import render
from django.template.loader import render_to_string
from django.views.decorators.http import require_http_methods
from django.views.generic import View
from openid_provider.lib.errors import *
from openid_provider.lib.endpoints.authorize import *
from openid_provider.lib.endpoints.token import *
from openid_provider.lib.endpoints.userinfo import *
from oidc_provider.lib.errors import *
from oidc_provider.lib.endpoints.authorize import *
from oidc_provider.lib.endpoints.token import *
from oidc_provider.lib.endpoints.userinfo import *
class AuthorizeView(View):
@ -26,7 +26,7 @@ class AuthorizeView(View):
'params': authorize.params,
}
hidden_inputs = render_to_string(
'openid_provider/hidden_inputs.html', context)
'oidc_provider/hidden_inputs.html', context)
# Remove openid from scope list since we don't need to print it.
authorize.params.scope.remove('openid')
@ -37,7 +37,7 @@ class AuthorizeView(View):
'params': authorize.params,
}
return render(request, 'openid_provider/authorize.html', context)
return render(request, 'oidc_provider/authorize.html', context)
else:
path = request.get_full_path()
return redirect_to_login(path)
@ -48,7 +48,7 @@ class AuthorizeView(View):
'description': error.description,
}
return render(request, 'openid_provider/error.html', context)
return render(request, 'oidc_provider/error.html', context)
except (AuthorizeError) as error:
uri = error.create_uri(

View file

@ -10,10 +10,10 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-oidc-provider',
version='0.0.0',
packages=['openid_provider'],
packages=['oidc_provider'],
include_package_data=True,
license='MIT License',
description='A simple OpenID Connect Provider implementation for Djangonauts.',
description='OpenID Connect Provider implementation for Django.',
long_description=README,
url='http://github.com/juanifioren/django-oidc-provider',
author='Juan Ignacio Fiorentino',