Git Product home page Git Product logo

django-pam's People

Contributors

cnobile2012 avatar dansan avatar ferranp avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

django-pam's Issues

LoginView and LogoutView complete example

Please update the documentation with a complete example for these Login and Logout views. I tried to follow the "example_site" but no luck.
I'm trying to use the LoginView() and LogoutView() but I cannot make to work the LogoutView.
It logs me out successfully when I click LogOut but if I try to access a direct link afterwards it does go to it without asking for login (somehow it bypasses authentication).
I'm using the @method_decorator(login_required() and if I clear the browser cache and logout it works and forces me the login before accessing the desired page.
Also I have and issue with the Logout redirect. After logout I'm trying to redirect to the login page and it does but the URL still display the logout link.
I'm using python 3.7.2 on Debian.

SocketServer Error - "Interrupted system call"

On trying to authenticate with a system user, I get the following error -

[07/Jun/2016 17:33:49] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 1724
Unhandled exception in thread started by <function wrapper at 0x1f10410>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 226, in wrapper
fn(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 144, in inner_run
ipv6=self.use_ipv6, threading=threading)
File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 193, in run
httpd.serve_forever()
File "/usr/lib/python2.7/SocketServer.py", line 225, in serve_forever
r, w, e = select.select([self], [], [], poll_interval)
select.error: (4, 'Interrupted system call')

If I stop the server and start it again, and revisit the admin url, it automatically logs me in.

Please let me know what further information you need to advise.

Django 3.0 Compatibility issue

Hi,

I was running a compatibility check with Django 3.0 and the module is not functioning due the change:

  • django.utils.six - Remove usage of this vendored library or switch to six.

Would it possible to change "six" instead of the django.utils.six ?

ugettext,ugettext_lazy,and force_text deprecated in Django 4

django-pam doesn't work on Django 4 because ugettext,ugettext_lazy,and force_text no longer exist.

The following imports:

from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils.encoding import force_text

need to be replaced with:

from django.utils.translation import gettext, gettext_lazy as _
from django.utils.encoding import force_str

Example to Add User, Log in

Hey @cnobile2012 ! I just added this module to Singularity Registry Server, and I'm having trouble testing it out. Would it be possible to get an example of how to create a user (in a Docker container) and then log in? I haven't used pam so I'm only familiar with useradd. Thank you!

Change description and long_description in setup.py

This is a suggestion for changin description in setup.py to a shorter text like Django PAM authentication backend implementation. And, long_description for the text that currently has description plus a reference to README.rst.

Why? Because it helps tools like pytoport to comply with porting guidelines. And surely other packaging frameworks will thank the change.

I'm packaging django-pam for FreeBSD and I got the advise to request this change. See this PR for better reference.

assert isinstance(request, HttpRequest) prevents use with Django Rest Framework (drf)

The assert in

"The 'request' positonal argument should be either None or an "
fails when used in a DRF app when accessing the /api-token-auth page (see https://www.django-rest-framework.org/api-guide/authentication/).

request is then a rest_framework.request.Request.
If the assert is commented out, it works as expected.

IMHO the assert not required in the code, as request isn't used in that method at all. So a condition on it to be from a fixed type is not necessary.

Custom user model with UUID-based id is not usable

When using this package together with Django 3.1 and having a custom user model with the id defined like this:

id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)

An error comes just after login, where it complains about the missing isdigit attribute

Traceback (most recent call last):
  File "/srv/wpaas/lib/python3.6/site-packages/asgiref/sync.py", line 339, in thread_handler
    raise exc_info[1]
  File "/srv/wpaas/lib/python3.6/site-packages/django/core/handlers/exception.py", line 38, in inner
    response = await get_response(request)
  File "/srv/wpaas/lib/python3.6/site-packages/django/core/handlers/base.py", line 231, in _get_response_async
    response = await wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/srv/wpaas/lib/python3.6/site-packages/asgiref/sync.py", line 304, in __call__
    ret = await asyncio.wait_for(future, timeout=None)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 339, in wait_for
    return (yield from fut)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/wpaas/lib/python3.6/site-packages/asgiref/sync.py", line 343, in thread_handler
    return func(*args, **kwargs)
  File "/srv/wpaas/lib/python3.6/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/srv/wpaas/lib/python3.6/site-packages/django/contrib/auth/mixins.py", line 50, in dispatch
    if not request.user.is_authenticated:
  File "/srv/wpaas/lib/python3.6/site-packages/django/utils/functional.py", line 240, in inner
    self._setup()
  File "/srv/wpaas/lib/python3.6/site-packages/django/utils/functional.py", line 376, in _setup
    self._wrapped = self._setupfunc()
  File "/srv/wpaas/lib/python3.6/site-packages/django/contrib/auth/middleware.py", line 23, in <lambda>
    request.user = SimpleLazyObject(lambda: get_user(request))
  File "/srv/wpaas/lib/python3.6/site-packages/django/contrib/auth/middleware.py", line 11, in get_user
    request._cached_user = auth.get_user(request)
  File "/srv/wpaas/lib/python3.6/site-packages/django/contrib/auth/__init__.py", line 181, in get_user
    user = backend.get_user(user_id)
  File "/srv/wpaas/lib/python3.6/site-packages/django_pam/auth/backends.py", line 85, in get_user
    or user_data.isdigit()):
AttributeError: 'UUID' object has no attribute 'isdigit'

The application which we use django-pam, has a dependency on an external system, which requires the ID of users to be named id in the database and also to be of type uuid.
Is there some way in the library to get it to work with UUID or would there need to be a fix to handle this?

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.