1414import ldap3
1515from ldap3 .core .exceptions import LDAPException
1616
17+ import satosa .logging_util as lu
1718from satosa .exception import SATOSAError
1819from satosa .micro_services .base import ResponseMicroService
1920from satosa .response import Redirect
2021
21- import satosa . logging_util as lu
22+
2223logger = logging .getLogger (__name__ )
2324
2425KEY_FOUND_LDAP_RECORD = "ldap_attribute_store_found_record"
@@ -372,8 +373,8 @@ def _populate_attributes(self, config, record):
372373 else [values ]
373374 )
374375 msg = "Recording internal attribute {} with values {}"
375- msg = msg .format (internal_attr , attributes [internal_attr ])
376- logger .debug (msg )
376+ logline = msg .format (internal_attr , attributes [internal_attr ])
377+ logger .debug (logline )
377378
378379 return attributes
379380
@@ -452,7 +453,8 @@ def process(self, context, data):
452453 "message" : "LDAP server host" ,
453454 "server host" : connection .server .host ,
454455 }
455- satosa_logging (logger , logging .DEBUG , msg , context .state )
456+ logline = lu .LOG_FMT .format (id = lu .get_session_id (context .state ), message = msg )
457+ logger .debug (logline )
456458
457459 for filter_val in filter_values :
458460 ldap_ident_attr = config ["ldap_identifier_attribute" ]
@@ -576,7 +578,7 @@ def process(self, context, data):
576578 else :
577579 msg = "No record found in LDAP so no attributes will be added"
578580 logline = lu .LOG_FMT .format (id = lu .get_session_id (context .state ), message = msg )
579- logger .warning (msg )
581+ logger .warning (logline )
580582 on_ldap_search_result_empty = config ["on_ldap_search_result_empty" ]
581583 if on_ldap_search_result_empty :
582584 # Redirect to the configured URL with
@@ -591,10 +593,10 @@ def process(self, context, data):
591593 )
592594 msg = "Redirecting to {}" .format (url )
593595 logline = lu .LOG_FMT .format (id = lu .get_session_id (context .state ), message = msg )
594- logger .info (msg )
596+ logger .info (logline )
595597 return Redirect (url )
596598
597599 msg = "Returning data.attributes {}" .format (data .attributes )
598600 logline = lu .LOG_FMT .format (id = lu .get_session_id (context .state ), message = msg )
599- logger .debug (msg )
601+ logger .debug (logline )
600602 return super ().process (context , data )
0 commit comments