using django-auth-ldap only for authorization

197 views
Skip to first unread message

alekam

unread,
Jul 3, 2010, 1:45:57 PM7/3/10
to django-auth-ldap
I want use django-auth-ldap only for user authtorizion and
authenticate users from another backend.
I add some modifications to django-auth-ldap. Changeset:
https://bitbucket.org/kamedov/django-auth-ldap/changeset/2e966830eaad

Usage example:

# ~*~ my-backend.py ~*~

from django_auth_ldap.backend import LDAPBackend, _LDAPUser
from django_cas.backends import CASBackend

class CasLdapBackend(CASBackend, LDAPBackend):
def authenticate(self, ticket, service):
"""Authenticates CAS ticket and retrieves user data from
LDAP"""

user = CASBackend.authenticate(self, ticket, service)

ldap_user = _LDAPUser(self, user=user)
ldap_user.authtorize()

return ldap_user.get_user()

def get_user(self, user_id):
return LDAPBackend.get_user(self, user_id)

Peter Sagerson

unread,
Jul 4, 2010, 1:11:19 AM7/4/10
to django-a...@googlegroups.com
Thanks, alekam. You might also look at the existing AUTH_LDAP_AUTHORIZE_ALL_USERS[1] setting. It seems like it addresses the same scenario.


[1] http://packages.python.org/django-auth-ldap/#auth-ldap-authorize-all-users

Alex Kamedov

unread,
Jul 4, 2010, 2:08:09 AM7/4/10
to django-a...@googlegroups.com
Hm, it looks like the same, but I'm not understanding how to use it in my case.

Peter Sagerson

unread,
Jul 4, 2010, 4:07:14 PM7/4/10
to django-a...@googlegroups.com
If you set AUTH_LDAP_AUTHORIZE_ALL_USERS, you won't get the behavior of _check_requirements or _get_or_create_user, but you will get the behavior of AUTH_LDAP_FIND_GROUP_PERMS for all users, regardless of how they were authenticated. If you need to populate any model fields from LDAP, then you'll need your customization.

Alex Kamedov

unread,
Jul 5, 2010, 2:35:38 AM7/5/10
to django-a...@googlegroups.com
Thanks you for explanation.

Di majo

unread,
May 12, 2024, 3:53:33 PM5/12/24
to django-auth-ldap
MT103/202 DIRECT WIRE TRANSFER
PAYPAL TRANSFER
CASHAPP TRANSFER
ZELLE TRANSFER
LOAN DEAL
TRANSFER WISE
WESTERN UNION TRANSFER
BITCOIN FLASHING
BANK ACCOUNT LOADING/FLASHING
IBAN TO IBAN TRANSFER
MONEYGRAM TRANSFER
IPIP/DTC
SLBC PROVIDER
CREDIT CARD TOP UP
DUMPS/ PINS
SEPA TRANSFER
WIRE TRANSFER
BITCOIN TOP UP
GLOBALPAY INC US
SKRILL USA
UNIONPAY RECEIVER

Thanks.


NOTE; ONLY SERIOUS / RELIABLE RECEIVERS CAN CONTACT.

DM ME ON WHATSAPP
+44 7529 555638

On Monday, July 5, 2010 at 7:35:38 AM UTC+1 Alex Kamedov wrote:
Thanks you for explanation.
Reply all
Reply to author
Forward
0 new messages