Hey guys,
we have a Drupal application integrated with a Dataverse instance via Shibboleth IdP/SP, and I'm working on implementing a Single Logout (SLO) solution.
Our Drupal application has support for SLO in the shib_auth module with the setting "auto_destroy_session". The Drupal application performs a check for whether or not there is a current valid Shibboleth session on every page request. It checks for the global variable 'Shib-Identity-Provider' which is set by the SP and always present if there is a current valid session. It also checks for a session variable which is set by the application when a Shibboleth login first takes place. If the session variable is present but the global Shibboleth variable is not, that means that a Shibboleth login was performed for this user but there is no longer a valid Shibboleth session. In this scenario, if "auto_destroy_session" is enabled, the user is logged out of the Drupal application. This means that the IdP-initiated Single Logout process which destroys the user's Shibboleth session also has the effect of logging them out of Drupal.
I wanted to code this same functionality for our Dataverse application. I created a new JSF filter called ShibAuthFilter to perform a check for a valid Shibboleth session upon every page request. My code is attached. The filter checks for the presence of a global variable that has to be present during a valid Shibboleth session, such as "Shib-Identity-Provider" which is set by the SP (
https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPAttributeAccess). It also checks for whether or not the current user had logged in via Shibboleth- is shibIdentityProvider value set for AuthenticatedUser?
I have a couple questions about my implementation:
1) Is a JSF Filter the best way to accomplish this check for valid Shibboleth session upon every page request? From the documentation that I've read on JSF this seems to be a sensible approach, but perhaps there is a better way which would be more in tune with the application architecture of Dataverse?
2) Can you see any reason off hand why this filter would fail to work properly? Because currently it doesn't work properly, and I'm in the process of setting up remote debugging in our AWS environment to step through the code. The filter correctly keeps a user logged in if they did NOT authenticate via Shibboleth. However, it prevents Shibboleth login completely and logs the user out as soon as they are redirected to /shib.xhtml. I think that for whatever reason, it is unable to find the global Shibboleth variables that should be present during a Shibboleth session. I don't understand why, because I used the same syntax to read these global variables as is already used in Shib.java, yet neither of these worked:
Object shibAttribute = httpServletRequest.getAttribute(ShibUtil.uniquePersistentIdentifier);
Object shibAttribute = httpServletRequest.getAttribute("Shib-Identity-Provider");
Thanks in advance for your help.
My Best,
Alex