@@ -32,7 +32,7 @@ def __init__(self, config, *args, **kwargs):
32
32
self .redirect_url = config ["redirect_url" ]
33
33
self .signing_key = RSAKey (key = rsa_load (config ["sign_key" ]), use = "sig" , alg = "RS256" )
34
34
self .endpoint = "/handle_account_linking"
35
- self .config = config
35
+ self .id_to_attr = config . get ( "id_to_attr" , None )
36
36
logger .info ("Account linking is active" )
37
37
38
38
def _handle_al_response (self , context ):
@@ -53,9 +53,8 @@ def _handle_al_response(self, context):
53
53
satosa_logging (logger , logging .INFO , "issuer/id pair is linked in AL service" ,
54
54
context .state )
55
55
internal_response .user_id = message
56
- id_to_attr = self .config .get ("id_to_attr" , None )
57
- if id_to_attr :
58
- internal_response .attributes [id_to_attr ] = message
56
+ if self .id_to_attr :
57
+ internal_response .attributes [id_to_attr ] = [message ]
59
58
60
59
del context .state [self .name ]
61
60
return super ().process (context , internal_response )
@@ -81,9 +80,8 @@ def process(self, context, internal_response):
81
80
satosa_logging (logger , logging .INFO , "issuer/id pair is linked in AL service" ,
82
81
context .state )
83
82
internal_response .user_id = message
84
- id_to_attr = self .config .get ("id_to_attr" , None )
85
- if id_to_attr :
86
- internal_response .attributes [id_to_attr ] = message
83
+ if self .id_to_attr :
84
+ internal_response .attributes [id_to_attr ] = [message ]
87
85
try :
88
86
del context .state [self .name ]
89
87
except KeyError :
0 commit comments