Commit 9fde9a7c authored by Tamim Ziai's avatar Tamim Ziai

Merge branch 'develop' into 'master'

Develop

See merge request crust/customer!13
parents 8ffea11c 356ad62f
TASK_BASE_DN = 'ou=tasks,ou=lui2backend,dc=pdp,dc=didmos,dc=de'
CRUST_TASK_URL_1 = 'http://localhost:8000/pdp/info' # Deactivating URL by emtpy string ''
CRUST_TASK_URL_1 = 'http://localhost:8000/pdp/roles/aRole' # Deactivating URL by emtpy string ''
CRUST_TASK_URL_2 = 'http://localhost:8000/pdp/info' # Deactivating URL by emtpy string ''
CRUST_TASK_URL_2 = '' # Deactivating URL by emtpy string ''
CRUST_TASK_URL_3 = '' # Deactivating URL by emtpy string ''
......
......@@ -19,5 +19,6 @@ class Custom_PDP():
mapped_list.append(('userPassword', lss.hash(password)))
mapped_list.append((getattr(settings, 'LUI_OIDC_USER_LOGIN_NAME'), user + '@ldap'))
AddRequest = get_class('AddRequest', 'ldap_app.processors.dispatcher.Request')(mapped_list, location=base_dn, template='selfregTemplate')
AddRequest.login_name = user
return AddRequest.run(determine_dn = True, deactivate_authorization = True, generate_login = False)
\ No newline at end of file
......@@ -9,7 +9,7 @@ class granted:
if not getattr(settings, 'CRUST_TASK_URL_1') == '':
json_body = provide_request_body(user_ldap_entry)
#headers = {'X-TENANT-ID': 'lui2backend', 'Authorization': 'Basic ' + base64.b64encode('crust:Unity-Grease-Cow-Sensitive-Despair-5'.encode()).decode()}
response = requests.post(getattr(settings, 'CRUST_TASK_URL_1'), data=json_body, timeout=1)
response = requests.delete(getattr(settings, 'CRUST_TASK_URL_1'), data=json_body, timeout=1)
if response.status_code is not 200:
return response.status_code
if not getattr(settings, 'CRUST_TASK_URL_2') == '':
......@@ -34,10 +34,9 @@ class denied:
def provide_request_body(ldap_entry):
json_body = dict()
LDAPEntryHelper = get_class('LDAPEntryHelper', 'ldap_app.processors.ldap_helper.ldap_helper')()
required_attributes = ['didmosLoginName', 'mail', 'uid']
for attribute in required_attributes:
if LDAPEntryHelper.has_key(ldap_entry, attribute):
json_body[attribute] = LDAPEntryHelper.get_value([(x, ldap_entry[x]) for x in ldap_entry], attribute)
if attribute in ldap_entry:
json_body[attribute] = ldap_entry[attribute]
return json.dumps(json_body)
......@@ -9,7 +9,7 @@ class granted:
if not getattr(settings, 'CRUST_TASK_URL_1') == '':
json_body = provide_request_body(user_ldap_entry)
#headers = {'X-TENANT-ID': 'lui2backend', 'Authorization': 'Basic ' + base64.b64encode('crust:Unity-Grease-Cow-Sensitive-Despair-5'.encode()).decode()}
response = requests.post(getattr(settings, 'CRUST_TASK_URL_1'), data=json_body, timeout=1)
response = requests.delete(getattr(settings, 'CRUST_TASK_URL_1'), data=json_body, timeout=1)
if response.status_code is not 200:
return response.status_code
if not getattr(settings, 'CRUST_TASK_URL_2') == '':
......@@ -34,10 +34,9 @@ class denied:
def provide_request_body(ldap_entry):
json_body = dict()
LDAPEntryHelper = get_class('LDAPEntryHelper', 'ldap_app.processors.ldap_helper.ldap_helper')()
required_attributes = ['didmosLoginName', 'mail', 'uid']
for attribute in required_attributes:
if LDAPEntryHelper.has_key(ldap_entry, attribute):
json_body[attribute] = LDAPEntryHelper.get_value([(x, ldap_entry[x]) for x in ldap_entry], attribute)
if attribute in ldap_entry:
json_body[attribute] = ldap_entry[attribute]
return json.dumps(json_body)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment