Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

IDP dynamic configuration#126

Open
challet wants to merge 13 commits into
lighthouse-intelligence:masterfrom
challet:conf-loader
Open

IDP dynamic configuration#126
challet wants to merge 13 commits into
lighthouse-intelligence:masterfrom
challet:conf-loader

Conversation

@challet
Copy link
Copy Markdown
Contributor

@challet challet commented Mar 19, 2021

This PR adds two main dynamic and optional configuration settings :

SAML_IDP_CONF_LOADER : a path to a callable that can adapt the IDP configuration, taking two arguments :

  • static_config : the configuration dict defined by the existing SAML_IDP_CONF setting
  • request : the http request being handled

SAML_IDP_FILTER_SP_QUERYSET : a path to a callable that should return the queryset of SPs available along the request being handled. It takes two arguments :

  • original_queryset : the queryset orginaly used : all active SPs
  • request : the http request being handled

Copy link
Copy Markdown
Contributor Author

@challet challet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments on the changes being done

Comment thread djangosaml2idp/idp.py
""" Access point for the IDP Server instance
"""
_server_instance: Server = None
_server_instances: Dict[str, Server] = {}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are now several instances cached : the keys of this dict are the entityids of the metadata. So it is expected the IDP conf is persistent for one entityid (see the load method)

Comment thread djangosaml2idp/views.py


@method_decorator(never_cache, name="dispatch")
class MetadataView(IdPHandlerViewMixin, View):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved as a class based view for inheriting the dynamic configuration loading method

Comment thread djangosaml2idp/models.py
@property
def sign_response(self) -> bool:
if self._sign_response is None:
return getattr(IDP.load().config, "sign_response", False)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more IDP load in models since their config depends on the http request

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant