Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
change LogoutView to LogoutInitView
In the current implementation, logout was handled using LogoutView, which is designed to process logout responses sent by the IdP (i.e., IdP → SP callback). However, our use case requires initiating the logout flow from the Service Provider (SP) side when a user clicks the logout button.
According to the djangosaml2 documentation:
The issue we encountered was that the logout process stopped at the SP level and did not propagate to the IdP, because the SAML session information (saml_session) was missing. As a result, Single Logout (SLO) was not properly completed.
To resolve this:
I changed the logout entry point from LogoutView to LogoutInitView. This ensures that when the user clicks the logout button, the flow correctly starts from SP → IdP. The logout process now properly initiates a SAML LogoutRequest and completes the SLO flow. This change aligns the logout behavior with the intended SAML SLO flow and ensures IdP-level logout is triggered correctly.
set cookie conf for djangosaml2
In djangosaml2.middleware.SamlSessionMiddleware, session information is:
However, in the latest version of Hue, there is no configurable way to set required cookie attributes such as COOKIE_DOMAIN, COOKIE_PATH. (Source Code Link)
Without these attributes being correctly configured, the SAML session cookie is not properly stored in the browser. As a result: saml_session is empty during logout. The IdP logout step fails because required session information (e.g., subject_id) is missing.
To address this limitation:
I identified that properly configuring cookie settings would require modifying Hue source code.
This approach ensures consistent logout behavior even when Hue does not expose cookie configuration options for djangosaml2.
How was this patch tested?
This patch was tested on the latest main branch of our company’s production Hue environment.