-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDP dynamic configuration #126
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
|
||
|
||
class IDP: | ||
""" Access point for the IDP Server instance | ||
""" | ||
_server_instance: Server = None | ||
_server_instances: Dict[str, Server] = {} |
There was a problem hiding this comment.
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 entityid
s of the metadata. So it is expected the IDP conf is persistent for one entityid
(see the load method)
@@ -414,18 +435,20 @@ def get(self, request: HttpRequest, *args, **kwargs): | |||
return self.render_response(request, html_response, None) | |||
|
|||
|
|||
@method_decorator(never_cache, name="dispatch") | |||
class MetadataView(IdPHandlerViewMixin, View): |
There was a problem hiding this comment.
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
@@ -228,14 +228,10 @@ def metadata_path(self) -> str: | |||
|
|||
@property | |||
def sign_response(self) -> bool: | |||
if self._sign_response is None: | |||
return getattr(IDP.load().config, "sign_response", False) |
There was a problem hiding this comment.
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
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 :SAML_IDP_CONF
settingSAML_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 :