<div>Hi everyone,<br></div><div><br></div><div>We have a custom Java Web application running in Tomcat.<br></div><div>This application is configured with SAML SSO, and so far everything is working fine.<br></div><div>The application also has a custom login.jsp where users can authenticate without SAML. <br></div><div>This login page is not yet used, but the customer now wants to allow non-SSO users to login to the application, using this login.jsp page.<br></div><div>This is where the problems start.<br></div><div><br></div><div>I'm using following setup in Apache:<br></div><div><br></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><Location /myapp></span><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">  AuthType Shibboleth</span><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">  ShibRequestSetting requireSession false</span><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">  Require shibboleth</span><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"></Location></span><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><Location /myapp/ssoauth></span><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">  AuthType Shibboleth</span><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">  ShibRequestSetting requireSession true</span><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">  Require shib-session</span><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">  Redirect /myapp/ssoauth /myapp</span><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"></Location></span><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;"><br></span></div><div><span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">ProxyPass "/myapp" "ajp://localhost:8009/myapp"</span><br></div><div><br></div><div>- Case 1:<br></div><div>   When I access <a href="https://host.domain/myapp/ssoauth">https://host.domain/myapp/ssoauth</a> I'm redirected to the IDP for authentication, and I can successfully access my application.<br></div><div>   This is working as expected.<br></div><div>   The user credentials are passed to our application through the REMOTE_USER variable.<br></div><div>  <br></div><div>- Case 2:<br></div><div>   When I access <a href="https://host.domain/myapp/login.jsp">https://host.domain/myapp/login.jsp</a> my custom login.jsp page is displayed, but when I submit my credentials I receive an HTTP-401 unauthorized error.<br></div><div><br></div><div>   On submitting the credentials on the login.jsp page, a POST request is done for /myapp/login_do servlet.<br></div><div>   The credentials are valid, and the login servlet redirects the browser to an entry page in our application.<br></div><div>   It is the access to this entry page that responds with the HTTP-401.<br></div><div>  <br></div><div>   Strangely, the HTTP-401 response includes a WWW-Authenticate header, which seems to indicate that it is expecting that the user authenticates with basic auth:<br></div><div>   <span style="font-family: menlo, consolas, courier new, monospace, sans-serif;">WWW-Authenticate: Basic realm="mydomain"</span><br></div><div><br></div><div>   If mod_shib is disabled, users can successfully authenticate using the custom login page.<br></div><div><br></div><div>Any thoughts on how to fix the issue ?<br></div><div>Or maybe is there a better approach than the one I am using here ?<br></div><div><br></div><div><br></div><div>Environment:<br></div><ul><li>Apache 2.4 and Shibboleth SP 2.5 on Linux<br></li><li>mod_proxy_ajp to proxy requests to Tomcat<br></li><li>Apache Tomcat 8.5<br></li></ul><div><br></div><div>I also tested Shibboleth SP 2.6.1 using unicon/shibboleth-sp:2.6.1 docker image with the same results.<br></div><div>I'm currently trying unicon/shibboleth-sp:3.0.4 but I'm still having some problems with the Shibboleth setup.<br></div><div><br></div><div>Thanks in advance<br></div><div>Oskar.<br></div>