@@ -132,12 +132,14 @@ def _auth_req_finish(self, context, internal_request):
132
132
133
133
def _auth_resp_finish (self , context , internal_response ):
134
134
# re-hash user id since e.g. account linking micro service might have changed it
135
- user_id = UserIdHasher .hash_id (self .config ["USER_ID_HASH_SALT" ],
136
- internal_response .user_id ,
137
- internal_response .requester ,
138
- context .state )
135
+ user_id = UserIdHasher .hash_id (
136
+ self .config ["USER_ID_HASH_SALT" ],
137
+ internal_response .user_id ,
138
+ internal_response .requester ,
139
+ context .state )
139
140
internal_response .user_id = user_id
140
- internal_response .user_id_hash_type = UserIdHasher .hash_type (context .state )
141
+ internal_response .user_id_hash_type = UserIdHasher .hash_type (
142
+ context .state )
141
143
user_id_to_attr = self .config ["INTERNAL_ATTRIBUTES" ].get ("user_id_to_attr" , None )
142
144
if user_id_to_attr :
143
145
internal_response .attributes [user_id_to_attr ] = [internal_response .user_id ]
@@ -148,8 +150,10 @@ def _auth_resp_finish(self, context, internal_response):
148
150
for attribute in hash_attributes :
149
151
# hash all attribute values individually
150
152
if attribute in internal_attributes :
151
- hashed_values = [UserIdHasher .hash_data (self .config ["USER_ID_HASH_SALT" ], v )
152
- for v in internal_attributes [attribute ]]
153
+ hashed_values = [
154
+ UserIdHasher .hash_data (self .config ["USER_ID_HASH_SALT" ], v )
155
+ for v in internal_attributes [attribute ]
156
+ ]
153
157
internal_attributes [attribute ] = hashed_values
154
158
155
159
# remove all session state
@@ -188,10 +192,14 @@ def _auth_resp_callback_func(self, context, internal_response):
188
192
# not be configured to construct one from asserted attributes.
189
193
# So only hash the user_id if it is not None.
190
194
if internal_response .user_id :
191
- user_id = UserIdHasher .hash_data (
195
+ user_id = UserIdHasher .hash_id (
192
196
self .config ["USER_ID_HASH_SALT" ],
193
- internal_response .user_id )
197
+ internal_response .user_id ,
198
+ internal_response .requester ,
199
+ context .state )
194
200
internal_response .user_id = user_id
201
+ internal_response .user_id_hash_type = UserIdHasher .hash_type (
202
+ context .state )
195
203
196
204
if self .response_micro_services :
197
205
return self .response_micro_services [0 ].process (
0 commit comments