Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example/plugins/microservices/account_linking.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ name: AccountLinking
config:
api_url: "https://localhost:8167"
redirect_url: "https://localhost:8167/approve"
sign_key: "pki/account_linking.key"
sign_key: "pki/account_linking.key"
id_to_attr: "uniqueid"
6 changes: 6 additions & 0 deletions src/satosa/micro_services/account_linking.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(self, config, *args, **kwargs):
self.redirect_url = config["redirect_url"]
self.signing_key = RSAKey(key=rsa_load(config["sign_key"]), use="sig", alg="RS256")
self.endpoint = "/handle_account_linking"
self.id_to_attr = config.get("id_to_attr", None)
logger.info("Account linking is active")

def _handle_al_response(self, context):
Expand All @@ -52,6 +53,9 @@ def _handle_al_response(self, context):
satosa_logging(logger, logging.INFO, "issuer/id pair is linked in AL service",
context.state)
internal_response.user_id = message
if self.id_to_attr:
internal_response.attributes[id_to_attr] = [message]

del context.state[self.name]
return super().process(context, internal_response)
else:
Expand All @@ -76,6 +80,8 @@ def process(self, context, internal_response):
satosa_logging(logger, logging.INFO, "issuer/id pair is linked in AL service",
context.state)
internal_response.user_id = message
if self.id_to_attr:
internal_response.attributes[id_to_attr] = [message]
try:
del context.state[self.name]
except KeyError:
Expand Down