Skip to content

Commit 8fdcc05

Browse files
author
Ioannis Kakavas
committed
Allow AL internal UniqueID to be used as attribute
If configured, map AL internal unique id as an attribute to be used by satosa, microservices and other plugins.
1 parent 0b2928d commit 8fdcc05

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

example/plugins/microservices/account_linking.yaml.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ name: AccountLinking
33
config:
44
api_url: "https://localhost:8167"
55
redirect_url: "https://localhost:8167/approve"
6-
sign_key: "pki/account_linking.key"
6+
sign_key: "pki/account_linking.key"
7+
id_to_attr: "uniqueid"

src/satosa/micro_services/account_linking.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ def _handle_al_response(self, context):
5252
satosa_logging(logger, logging.INFO, "issuer/id pair is linked in AL service",
5353
context.state)
5454
internal_response.user_id = message
55+
id_to_attr = self.config.get("id_to_attr", None)
56+
if id_to_attr:
57+
internal_response.attributes[id_to_attr] = message
58+
5559
del context.state[self.name]
5660
return super().process(context, internal_response)
5761
else:
@@ -76,6 +80,9 @@ def process(self, context, internal_response):
7680
satosa_logging(logger, logging.INFO, "issuer/id pair is linked in AL service",
7781
context.state)
7882
internal_response.user_id = message
83+
id_to_attr = self.config.get("id_to_attr", None)
84+
if id_to_attr:
85+
internal_response.attributes[id_to_attr] = message
7986
try:
8087
del context.state[self.name]
8188
except KeyError:

0 commit comments

Comments
 (0)