14
14
import ldap3
15
15
from ldap3 .core .exceptions import LDAPException
16
16
17
+ import satosa .logging_util as lu
17
18
from satosa .exception import SATOSAError
18
19
from satosa .micro_services .base import ResponseMicroService
19
20
from satosa .response import Redirect
20
21
21
- import satosa . logging_util as lu
22
+
22
23
logger = logging .getLogger (__name__ )
23
24
24
25
KEY_FOUND_LDAP_RECORD = "ldap_attribute_store_found_record"
@@ -372,8 +373,8 @@ def _populate_attributes(self, config, record):
372
373
else [values ]
373
374
)
374
375
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 )
377
378
378
379
return attributes
379
380
@@ -452,7 +453,8 @@ def process(self, context, data):
452
453
"message" : "LDAP server host" ,
453
454
"server host" : connection .server .host ,
454
455
}
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 )
456
458
457
459
for filter_val in filter_values :
458
460
ldap_ident_attr = config ["ldap_identifier_attribute" ]
@@ -576,7 +578,7 @@ def process(self, context, data):
576
578
else :
577
579
msg = "No record found in LDAP so no attributes will be added"
578
580
logline = lu .LOG_FMT .format (id = lu .get_session_id (context .state ), message = msg )
579
- logger .warning (msg )
581
+ logger .warning (logline )
580
582
on_ldap_search_result_empty = config ["on_ldap_search_result_empty" ]
581
583
if on_ldap_search_result_empty :
582
584
# Redirect to the configured URL with
@@ -591,10 +593,10 @@ def process(self, context, data):
591
593
)
592
594
msg = "Redirecting to {}" .format (url )
593
595
logline = lu .LOG_FMT .format (id = lu .get_session_id (context .state ), message = msg )
594
- logger .info (msg )
596
+ logger .info (logline )
595
597
return Redirect (url )
596
598
597
599
msg = "Returning data.attributes {}" .format (data .attributes )
598
600
logline = lu .LOG_FMT .format (id = lu .get_session_id (context .state ), message = msg )
599
- logger .debug (msg )
601
+ logger .debug (logline )
600
602
return super ().process (context , data )
0 commit comments