@@ -276,11 +276,11 @@ def do(self, query, binding_in, relay_state="", encrypt_cert=None):
276
276
resp_args , _resp = self .verify_request (query , binding_in )
277
277
except UnknownPrincipal as excp :
278
278
logger .error ("UnknownPrincipal: %s" , excp )
279
- resp = ServiceError ("UnknownPrincipal: {}" . format ( excp ) )
279
+ resp = ServiceError (f "UnknownPrincipal: { excp } " )
280
280
return resp (self .environ , self .start_response )
281
281
except UnsupportedBinding as excp :
282
282
logger .error ("UnsupportedBinding: %s" , excp )
283
- resp = ServiceError ("UnsupportedBinding: {}" . format ( excp ) )
283
+ resp = ServiceError (f "UnsupportedBinding: { excp } " )
284
284
return resp (self .environ , self .start_response )
285
285
286
286
if not _resp :
@@ -301,7 +301,7 @@ def do(self, query, binding_in, relay_state="", encrypt_cert=None):
301
301
_resp = IDP .create_authn_response (identity , userid = self .user , encrypt_cert = encrypt_cert , ** resp_args )
302
302
except Exception as excp :
303
303
logging .error (exception_trace (excp ))
304
- resp = ServiceError ("Exception: {}" . format ( excp ) )
304
+ resp = ServiceError (f "Exception: { excp } " )
305
305
return resp (self .environ , self .start_response )
306
306
307
307
logger .info ("AuthNResponse: %s" , _resp )
@@ -311,7 +311,7 @@ def do(self, query, binding_in, relay_state="", encrypt_cert=None):
311
311
kwargs = {}
312
312
313
313
http_args = IDP .apply_binding (
314
- self .binding_out , "%s" % _resp , self .destination , relay_state , response = True , ** kwargs
314
+ self .binding_out , f" { _resp } " , self .destination , relay_state , response = True , ** kwargs
315
315
)
316
316
317
317
logger .debug ("HTTPargs: %s" , http_args )
@@ -511,7 +511,7 @@ def do_verify(environ, start_response, _):
511
511
512
512
kaka = set_cookie ("idpauthn" , "/" , uid , query ["authn_reference" ][0 ])
513
513
514
- lox = "{ }?id={}&key={}" . format ( query ["redirect_uri" ][ 0 ], uid , query [ " key" ][0 ])
514
+ lox = f" { query [ 'redirect_uri' ][ 0 ] } ?id={ uid } &key={ query [' key' ][0 ]} "
515
515
logger .debug ("Redirect => %s" , lox )
516
516
resp = Redirect (lox , headers = [kaka ], content = "text/html" )
517
517
@@ -545,7 +545,7 @@ def do(self, request, binding, relay_state="", encrypt_cert=None):
545
545
req_info = IDP .parse_logout_request (body , binding )
546
546
except Exception as exc :
547
547
logger .error ("Bad request: %s" , exc )
548
- resp = BadRequest ("%s" % exc )
548
+ resp = BadRequest (f" { exc } " )
549
549
return resp (self .environ , self .start_response )
550
550
551
551
msg = req_info .message
@@ -562,16 +562,16 @@ def do(self, request, binding, relay_state="", encrypt_cert=None):
562
562
IDP .session_db .remove_authn_statements (msg .name_id )
563
563
except KeyError as exc :
564
564
logger .error ("ServiceError: %s" , exc )
565
- resp = ServiceError ("%s" % exc )
565
+ resp = ServiceError (f" { exc } " )
566
566
return resp (self .environ , self .start_response )
567
567
568
568
resp = IDP .create_logout_response (msg , [binding ])
569
569
570
570
try :
571
- hinfo = IDP .apply_binding (binding , "%s" % resp , "" , relay_state )
571
+ hinfo = IDP .apply_binding (binding , f" { resp } " , "" , relay_state )
572
572
except Exception as exc :
573
573
logger .error ("ServiceError: %s" , exc )
574
- resp = ServiceError ("%s" % exc )
574
+ resp = ServiceError (f" { exc } " )
575
575
return resp (self .environ , self .start_response )
576
576
577
577
# _tlh = dict2list_of_tuples(hinfo["headers"])
@@ -604,7 +604,7 @@ def do(self, query, binding, relay_state="", encrypt_cert=None):
604
604
_resp = IDP .create_manage_name_id_response (request )
605
605
606
606
# It's using SOAP binding
607
- hinfo = IDP .apply_binding (BINDING_SOAP , "%s" % _resp , "" , relay_state , response = True )
607
+ hinfo = IDP .apply_binding (BINDING_SOAP , f" { _resp } " , "" , relay_state , response = True )
608
608
609
609
resp = Response (hinfo ["data" ], headers = hinfo ["headers" ])
610
610
return resp (self .environ , self .start_response )
@@ -626,7 +626,7 @@ def do(self, aid, binding, relay_state="", encrypt_cert=None):
626
626
resp = NotFound (aid )
627
627
return resp (self .environ , self .start_response )
628
628
629
- hinfo = IDP .apply_binding (BINDING_URI , "%s" % assertion , response = True )
629
+ hinfo = IDP .apply_binding (BINDING_URI , f" { assertion } " , response = True )
630
630
631
631
logger .debug ("HINFO: %s" , hinfo )
632
632
resp = Response (hinfo ["data" ], headers = hinfo ["headers" ])
@@ -652,7 +652,7 @@ def do(self, request, binding, relay_state="", encrypt_cert=None):
652
652
653
653
msg = IDP .create_artifact_response (_req , _req .artifact .text )
654
654
655
- hinfo = IDP .apply_binding (BINDING_SOAP , "%s" % msg , "" , "" , response = True )
655
+ hinfo = IDP .apply_binding (BINDING_SOAP , f" { msg } " , "" , "" , response = True )
656
656
657
657
resp = Response (hinfo ["data" ], headers = hinfo ["headers" ])
658
658
return resp (self .environ , self .start_response )
@@ -673,7 +673,7 @@ def do(self, request, binding, relay_state="", encrypt_cert=None):
673
673
msg = IDP .create_authn_query_response (_query .subject , _query .requested_authn_context , _query .session_index )
674
674
675
675
logger .debug ("response: %s" , msg )
676
- hinfo = IDP .apply_binding (BINDING_SOAP , "%s" % msg , "" , "" , response = True )
676
+ hinfo = IDP .apply_binding (BINDING_SOAP , f" { msg } " , "" , "" , response = True )
677
677
678
678
resp = Response (hinfo ["data" ], headers = hinfo ["headers" ])
679
679
return resp (self .environ , self .start_response )
@@ -702,7 +702,7 @@ def do(self, request, binding, relay_state="", encrypt_cert=None):
702
702
msg = IDP .create_attribute_response (identity , name_id = name_id , ** args )
703
703
704
704
logger .debug ("response: %s" , msg )
705
- hinfo = IDP .apply_binding (BINDING_SOAP , "%s" % msg , "" , "" , response = True )
705
+ hinfo = IDP .apply_binding (BINDING_SOAP , f" { msg } " , "" , "" , response = True )
706
706
707
707
resp = Response (hinfo ["data" ], headers = hinfo ["headers" ])
708
708
return resp (self .environ , self .start_response )
@@ -735,7 +735,7 @@ def do(self, query, binding, relay_state="", encrypt_cert=None):
735
735
_resp = IDP .create_name_id_mapping_response (name_id , ** info )
736
736
737
737
# Only SOAP
738
- hinfo = IDP .apply_binding (BINDING_SOAP , "%s" % _resp , "" , "" , response = True )
738
+ hinfo = IDP .apply_binding (BINDING_SOAP , f" { _resp } " , "" , "" , response = True )
739
739
740
740
resp = Response (hinfo ["data" ], headers = hinfo ["headers" ])
741
741
return resp (self .environ , self .start_response )
@@ -948,8 +948,8 @@ def application(environ, start_response):
948
948
949
949
950
950
AUTHN_BROKER = AuthnBroker ()
951
- AUTHN_BROKER .add (authn_context_class_ref (PASSWORD ), username_password_authn , 10 , "http://%s" % socket .gethostname ())
952
- AUTHN_BROKER .add (authn_context_class_ref (UNSPECIFIED ), "" , 0 , "http://%s" % socket .gethostname ())
951
+ AUTHN_BROKER .add (authn_context_class_ref (PASSWORD ), username_password_authn , 10 , f "http://{ socket .gethostname ()} " )
952
+ AUTHN_BROKER .add (authn_context_class_ref (UNSPECIFIED ), "" , 0 , f "http://{ socket .gethostname ()} " )
953
953
CONFIG = importlib .import_module (args .config )
954
954
IDP = server .Server (args .config , cache = Cache ())
955
955
IDP .ticket = {}
@@ -985,7 +985,7 @@ def application(environ, start_response):
985
985
PORT = CONFIG .PORT
986
986
987
987
SRV = make_server (HOST , PORT , application )
988
- print ("IdP listening on {}:{}" . format ( HOST , PORT ) )
988
+ print (f "IdP listening on { HOST } :{ PORT } " )
989
989
SRV .serve_forever ()
990
990
else :
991
991
_rot = args .mako_root
0 commit comments