@@ -570,9 +570,8 @@ class SLO(Service):
570
570
def do (self , request , binding , relay_state = "" , encrypt_cert = None ):
571
571
logger .info ("--- Single Log Out Service ---" )
572
572
try :
573
- _ , body = request .split ("\n " )
574
- logger .debug ("req: '%s'" % body )
575
- req_info = IDP .parse_logout_request (body , binding )
573
+ logger .debug ("req: '%s'" % request )
574
+ req_info = IDP .parse_logout_request (request , binding )
576
575
except Exception as exc :
577
576
logger .error ("Bad request: %s" % exc )
578
577
resp = BadRequest ("%s" % exc )
@@ -596,9 +595,19 @@ def do(self, request, binding, relay_state="", encrypt_cert=None):
596
595
return resp (self .environ , self .start_response )
597
596
598
597
resp = IDP .create_logout_response (msg , [binding ])
598
+
599
+ if binding == BINDING_SOAP :
600
+ destination = ""
601
+ response = False
602
+ else :
603
+ binding , destination = IDP .pick_binding ("single_logout_service" ,
604
+ [binding ], "spsso" ,
605
+ req_info )
606
+ response = True
599
607
600
608
try :
601
- hinfo = IDP .apply_binding (binding , "%s" % resp , "" , relay_state )
609
+ hinfo = IDP .apply_binding (binding , "%s" % resp , destination , relay_state ,
610
+ response = response )
602
611
except Exception as exc :
603
612
logger .error ("ServiceError: %s" % exc )
604
613
resp = ServiceError ("%s" % exc )
@@ -609,8 +618,18 @@ def do(self, request, binding, relay_state="", encrypt_cert=None):
609
618
if delco :
610
619
hinfo ["headers" ].append (delco )
611
620
logger .info ("Header: %s" % (hinfo ["headers" ],))
612
- resp = Response (hinfo ["data" ], headers = hinfo ["headers" ])
613
- return resp (self .environ , self .start_response )
621
+
622
+ if binding == BINDING_HTTP_REDIRECT :
623
+ for key , value in hinfo ['headers' ]:
624
+ if key .lower () == 'location' :
625
+ resp = Redirect (value , headers = hinfo ["headers" ])
626
+ return resp (self .environ , self .start_response )
627
+
628
+ resp = ServiceError ('missing Location header' )
629
+ return resp (self .environ , self .start_response )
630
+ else :
631
+ resp = Response (hinfo ["data" ], headers = hinfo ["headers" ])
632
+ return resp (self .environ , self .start_response )
614
633
615
634
# ----------------------------------------------------------------------------
616
635
# Manage Name ID service
0 commit comments