@@ -32,6 +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 .id_to_attr = config .get ("id_to_attr" , None )
35
36
logger .info ("Account linking is active" )
36
37
37
38
def _handle_al_response (self , context ):
@@ -52,6 +53,9 @@ def _handle_al_response(self, context):
52
53
satosa_logging (logger , logging .INFO , "issuer/id pair is linked in AL service" ,
53
54
context .state )
54
55
internal_response .user_id = message
56
+ if self .id_to_attr :
57
+ internal_response .attributes [id_to_attr ] = [message ]
58
+
55
59
del context .state [self .name ]
56
60
return super ().process (context , internal_response )
57
61
else :
@@ -76,6 +80,8 @@ def process(self, context, internal_response):
76
80
satosa_logging (logger , logging .INFO , "issuer/id pair is linked in AL service" ,
77
81
context .state )
78
82
internal_response .user_id = message
83
+ if self .id_to_attr :
84
+ internal_response .attributes [id_to_attr ] = [message ]
79
85
try :
80
86
del context .state [self .name ]
81
87
except KeyError :
0 commit comments