|
12 | 12 | from oic.utils.authn.authn_context import UNSPECIFIED
|
13 | 13 |
|
14 | 14 | import satosa.logging_util as lu
|
| 15 | +from satosa.context import Context |
15 | 16 | from satosa.internal import AuthenticationInformation
|
16 | 17 | from satosa.internal import InternalData
|
17 | 18 | from satosa.exception import SATOSAAuthenticationError
|
@@ -145,6 +146,7 @@ def _authn_response(self, context):
|
145 | 146 | internal_response = InternalData(auth_info=self.auth_info(context.request))
|
146 | 147 | internal_response.attributes = self.converter.to_internal(self.external_type, user_info)
|
147 | 148 | internal_response.subject_id = user_info[self.user_id_attr]
|
| 149 | + context.decorate(Context.KEY_METADATA_STORE, _get_metadata_to_decorate(self.config)) |
148 | 150 | return self.auth_callback_func(context, internal_response)
|
149 | 151 |
|
150 | 152 | def auth_info(self, request):
|
@@ -331,3 +333,22 @@ def get_metadata_desc_for_oauth_backend(entity_id, config):
|
331 | 333 |
|
332 | 334 | metadata_description.append(description)
|
333 | 335 | return metadata_description
|
| 336 | + |
| 337 | + |
| 338 | +def _get_metadata_to_decorate(config): |
| 339 | + metadata_dict = {} |
| 340 | + if "entity_info" in config: |
| 341 | + entity_info = config["entity_info"] |
| 342 | + if "ui_info" in entity_info: |
| 343 | + ui_info = entity_info["ui_info"] |
| 344 | + for name in ui_info.get("display_name", []): |
| 345 | + if name[1] == "en": |
| 346 | + metadata_dict["client_name"] = name[0] |
| 347 | + metadata_dict["client_name#" + name[1]] = name[0] |
| 348 | + for logo in ui_info.get("logo", []): |
| 349 | + if logo["lang"] == "en": |
| 350 | + metadata_dict["logo_uri"] = logo["image"] |
| 351 | + metadata_dict["logo_width"] = logo["width"] |
| 352 | + metadata_dict["logo_height"] = logo["height"] |
| 353 | + metadata_dict["logo_uri#" + logo["lang"]] = logo["image"] |
| 354 | + return metadata_dict |
0 commit comments