@@ -399,6 +399,8 @@ def process(self, context, data):
399
399
Default interface for microservices. Process the input data for
400
400
the input context.
401
401
"""
402
+ session_id = lu .get_session_id (context .state )
403
+
402
404
issuer = data .auth_info .issuer
403
405
requester = data .requester
404
406
config = self .config .get (requester ) or self .config ["default" ]
@@ -408,13 +410,13 @@ def process(self, context, data):
408
410
"issuer" : issuer ,
409
411
"config" : self ._filter_config (config ),
410
412
}
411
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
413
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
412
414
logger .debug (logline )
413
415
414
416
# Ignore this SP entirely if so configured.
415
417
if config ["ignore" ]:
416
418
msg = "Ignoring SP {}" .format (requester )
417
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
419
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
418
420
logger .info (logline )
419
421
return super ().process (context , data )
420
422
@@ -439,7 +441,7 @@ def process(self, context, data):
439
441
if filter_value
440
442
]
441
443
msg = {"message" : "Search filters" , "filter_values" : filter_values }
442
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
444
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
443
445
logger .debug (logline )
444
446
445
447
# Initialize an empty LDAP record. The first LDAP record found using
@@ -453,7 +455,7 @@ def process(self, context, data):
453
455
"message" : "LDAP server host" ,
454
456
"server host" : connection .server .host ,
455
457
}
456
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
458
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
457
459
logger .debug (logline )
458
460
459
461
for filter_val in filter_values :
@@ -463,7 +465,7 @@ def process(self, context, data):
463
465
"message" : "LDAP query with constructed search filter" ,
464
466
"search filter" : search_filter ,
465
467
}
466
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
468
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
467
469
logger .debug (logline )
468
470
469
471
attributes = (
@@ -485,14 +487,14 @@ def process(self, context, data):
485
487
exp_msg = "Caught unhandled exception: {}" .format (err )
486
488
487
489
if exp_msg :
488
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = exp_msg )
490
+ logline = lu .LOG_FMT .format (id = session_id , message = exp_msg )
489
491
logger .error (logline )
490
492
return super ().process (context , data )
491
493
492
494
if not results :
493
495
msg = "Querying LDAP server: No results for {}."
494
496
msg = msg .format (filter_val )
495
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
497
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
496
498
logger .debug (logline )
497
499
continue
498
500
@@ -502,10 +504,10 @@ def process(self, context, data):
502
504
responses = connection .get_response (results )[0 ]
503
505
504
506
msg = "Done querying LDAP server"
505
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
507
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
506
508
logger .debug (logline )
507
509
msg = "LDAP server returned {} records" .format (len (responses ))
508
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
510
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
509
511
logger .info (logline )
510
512
511
513
# For now consider only the first record found (if any).
@@ -514,7 +516,7 @@ def process(self, context, data):
514
516
msg = "LDAP server returned {} records using search filter"
515
517
msg = msg + " value {}"
516
518
msg = msg .format (len (responses ), filter_val )
517
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
519
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
518
520
logger .warning (logline )
519
521
record = responses [0 ]
520
522
break
@@ -524,7 +526,7 @@ def process(self, context, data):
524
526
if config ["clear_input_attributes" ]:
525
527
msg = "Clearing values for these input attributes: {}"
526
528
msg = msg .format (data .attributes )
527
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
529
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
528
530
logger .debug (logline )
529
531
data .attributes = {}
530
532
@@ -549,7 +551,7 @@ def process(self, context, data):
549
551
"DN" : record ["dn" ],
550
552
"attributes" : record ["attributes" ],
551
553
}
552
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
554
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
553
555
logger .debug (logline )
554
556
555
557
# Populate attributes as configured.
@@ -573,11 +575,11 @@ def process(self, context, data):
573
575
# may use it if required.
574
576
context .decorate (KEY_FOUND_LDAP_RECORD , record )
575
577
msg = "Added record {} to context" .format (record )
576
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
578
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
577
579
logger .debug (logline )
578
580
else :
579
581
msg = "No record found in LDAP so no attributes will be added"
580
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
582
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
581
583
logger .warning (logline )
582
584
on_ldap_search_result_empty = config ["on_ldap_search_result_empty" ]
583
585
if on_ldap_search_result_empty :
@@ -592,11 +594,11 @@ def process(self, context, data):
592
594
encoded_idp_entity_id ,
593
595
)
594
596
msg = "Redirecting to {}" .format (url )
595
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
597
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
596
598
logger .info (logline )
597
599
return Redirect (url )
598
600
599
601
msg = "Returning data.attributes {}" .format (data .attributes )
600
- logline = lu .LOG_FMT .format (id = lu . get_session_id ( context . state ) , message = msg )
602
+ logline = lu .LOG_FMT .format (id = session_id , message = msg )
601
603
logger .debug (logline )
602
604
return super ().process (context , data )
0 commit comments