Révision b3843f12
Ajouté par Serghei Mihai (congés, retour 15/05) il y a environ 9 ans
uauth/utils.py | ||
---|---|---|
1 | 1 |
import os |
2 | 2 |
import logging |
3 | 3 |
import json |
4 |
from uuid import uuid4 |
|
4 | 5 |
|
5 | 6 |
try: |
6 | 7 |
import ldap |
... | ... | |
42 | 43 |
return |
43 | 44 |
return conn |
44 | 45 |
|
45 |
def create_radius_user(username, password, **kwargs): |
|
46 |
def create_radius_user(**kwargs): |
|
47 |
username = uuid4().get_hex() |
|
48 |
password = uuid4().get_hex() |
|
46 | 49 |
connection = get_ldap_connection() |
47 | 50 |
if connection: |
48 | 51 |
attrs = {'objectClass': ['radiusprofile', 'radiusObjectProfile'], |
... | ... | |
54 | 57 |
dn = 'uid=%s,%s' % (username, settings.LDAP_CONF['dn']) |
55 | 58 |
logger.debug('creating new radius user: %s' % dn) |
56 | 59 |
connection.add_s(dn, ldif) |
57 |
return True
|
|
60 |
return username, password
|
|
58 | 61 |
else: |
59 | 62 |
return False |
Formats disponibles : Unified diff
local accounts authentication (#7066)