Giter Club home page Giter Club logo

django-openid's Introduction

django_openid
=============

A new take on Django/OpenID integration, making extensive use of class-based 
views.

Caution: Work in Progress

It's not ready yet! However, you are welcome to dive in to the code or take a 
look at the in-progress documentation in django_openid/docs (which can be 
built using Sphinx).

django-openid's People

Contributors

brosner avatar dpoirier avatar fmarier avatar jezdez avatar robhudson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

django-openid's Issues

admin interface in the demo projects

Adding the admin interface the demo projects would help to understand what is going on. It would also help to understand how the "monkeypatch_adminsite" is supposed to be used. Reading the source I am under the impression that this function should add the capability to login into the admin interface using openid .

admin.autodiscover()
admin_site = admin.site
monkeypatch_adminsite(admin_site)
class NoSignNext(RegistrationConsumer):
    sign_next_param = False

urlpatterns = patterns('',                 
     (r'^$', lambda r: HttpResponseRedirect('/openid/')),
     (r'^openid/(.*)', NoSignNext()),
     (r'^admin/', include(admin_site.urls)),
)

Using the code above does not change the login form to add an openid field. Could you please point me what I am missing ?

Thank you for this library full of gems.
Regards,
--yml

TemplateResponse baking happens too late

I don't think this is something django-openid should fix (since TemplateResponse might need some Django love to work correctly), but since it is included I'll just mention it here. TemplateResponse doesn't render the template until the last possible second. This has some great advantages, but disadvantages too because Django isn't aware that the HttpResponse will do this. This results in template rendering to happen in the WSGI handler outside of the base handler. As a result request.urlconf won't work since by this point it has been reverted back to ROOT_URLCONF (in Django). Furthermore any exceptions that occur during rendering bypass the base handlers lovely debug screen in DEBUG=True mode (any base handler exception handling code).

RegistrationForm can't work

Even with both password fields filled out correctly the error "This field cannot be blank." is always shown.

With updating
fields = ('username', 'first_name', 'last_name', 'email')
to
fields = ('username', 'first_name', 'last_name', 'email', 'password')
the registration works for non-OpenID, but with OpenID it fails again.

I think this is because the password field of User model is always required, no matter what the form says.

Anyway, I forked it: http://github.com/and3k/django-openid/commit/df911f2a1676f58adb0b616e369627ef37b109b7

DjangoOpenIDStore allows use of already used nonce (potential security flaw)

Unit test to repro is below. Note that MemoryStore, which is included with the python-openid lib, passes the test. I believe the problem can be fixed by deleting line 97 of models.py: "nonce.delete()".

def testStore(self):
store = MemoryStore()
store = DjangoOpenIDStore()
server_url = 'http://foo.com/'
timestamp = time.time()
salt = '123'

    assert store.useNonce(server_url, timestamp, salt),\
        'useNonce should return True the first time: '+str(store)
    for i in range(10):
        assert not store.useNonce(server_url, timestamp, salt),\
            'useNonce should return False after that: '+str(store)

Django 1.2.1 CSRF protection failes

When the context processor django.middleware.csrf.CsrfViewMiddleware from Django 1.2.1 is active, the login form triggers a CSRF attempt error.

Incompatibility with Django 1.3 TemplateResponse object

Hi,

When using django_openid in a Django 1.3 project, there will be an error with the returned TemplateResponse object.

When the response object has a render() function (as TemplateResponse has), Django 1.3 will call the add_post_render_callback() function of that response. This method is available in django.template.response.TemplateResponse, but not in the copy at django_openid.response.TemplateResponse.
The obvious result is a 500 error, which bit me already quite.

The easy fix is not using an own copy of the TemplateResponse object when using Django 1.3

Don't automatically unregister the default UserAdmin since other apps might want to add an inline, too.

I believe this easily can be documented, e.g.

  • add the OpenIDInline to your own user admin inlines list or add this code in your project:

    from django.contrib.auth.admin import UserAdmin
    from django.contrib import admin
    from django.contrib.admin.sites import NotRegistered
    from django_openid.admin import UserAdminWithOpenIDs
    
    # Add OpenIDs to the user admin, but only if User has been registered
    try:
        admin.site.unregister(User)
        admin.site.register(User, UserAdminWithOpenIDs)
    except NotRegistered:
        pass
    

Error in do_pick method in auth.py

I don't know exactly what's happening, but I'm getting this error from time to time:

Traceback (most recent call last):
File "/usr/local/www/gnomeweb/python-packages/django/core/handlers/base.py", line 100, in get_response
response = callback(request, _callback_args, *_callback_kwargs)
File "/var/www/djamnedlies/django_openid/consumer.py", line 157, in call
return router(request, path_override = rest_of_url)
File "/var/www/djamnedlies/django_openid/utils.py", line 67, in call
return self.handle(request, path_override)
File "/var/www/djamnedlies/django_openid/utils.py", line 64, in handle
return callback(request, _callback_args, *_callback_kwargs)
File "/var/www/djamnedlies/../djamnedlies/django_openid/auth.py", line 172, in do_pick
if not request.openid:

AttributeError: 'WSGIRequest' object has no attribute 'openid'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.