|  | 
| 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 |         del context.state[self.name] | 
| 149 | 151 |         return self.auth_callback_func(context, internal_response) | 
| 150 | 152 | 
 | 
| @@ -324,3 +326,22 @@ def get_metadata_desc_for_oauth_backend(entity_id, config): | 
| 324 | 326 | 
 | 
| 325 | 327 |     metadata_description.append(description) | 
| 326 | 328 |     return metadata_description | 
|  | 329 | + | 
|  | 330 | + | 
|  | 331 | +def _get_metadata_to_decorate(config): | 
|  | 332 | +    metadata_dict = {} | 
|  | 333 | +    if "entity_info" in config: | 
|  | 334 | +        entity_info = config["entity_info"] | 
|  | 335 | +        if "ui_info" in entity_info: | 
|  | 336 | +            ui_info = entity_info["ui_info"] | 
|  | 337 | +            for name in ui_info.get("display_name", []): | 
|  | 338 | +                if name[1] == "en": | 
|  | 339 | +                    metadata_dict["client_name"] = name[0] | 
|  | 340 | +                metadata_dict["client_name#" + name[1]] = name[0] | 
|  | 341 | +            for logo in ui_info.get("logo", []): | 
|  | 342 | +                if logo["lang"] == "en": | 
|  | 343 | +                    metadata_dict["logo_uri"] = logo["image"] | 
|  | 344 | +                    metadata_dict["logo_width"] = logo["width"] | 
|  | 345 | +                    metadata_dict["logo_height"] = logo["height"] | 
|  | 346 | +                metadata_dict["logo_uri#" + logo["lang"]] = logo["image"] | 
|  | 347 | +    return metadata_dict | 
0 commit comments