<div dir="ltr">Sorry if these are stupid questions.  I&#39;m blaming it on a less than optimal setup.<div><br></div><div>1. When does the  _idp_authn_lc_key cookie normally get set in ExternalAuthn flow if the user needs to login?</div>

<div><br></div><div>2. Can I force it to be set before a servlet redirect?</div><div><br></div><div>3. Is there a way I can utilize Shibboleth to do a redirect instead of a raw servlet sendRedirect?</div><div><br></div><div>

BACKGROUND</div><div>We&#39;re doing External Authentication via a servlet.  If the servlet determines that the user is not authenticated and needs to login again, I need to display a login page.  The problem is our login page and logic exist in another application, so I&#39;m trying to re-direct to that applications login page. (Q: &quot;Then how does your servlet know if the user is authenticated?&quot; A: &quot;Dark magic via domain cookies and databases calls&quot;)</div>

<div><br></div><div>Here is the flow</div><div><br></div><div>www/login</div><div>       [User logs in]</div><div>www/home</div><div>       [User clicks link]</div><div>IdP/unsolicited?providerId=sp.example&amp;relayState=<a href="http://www.example.com/dashboard">www.example.com/dashboard</a></div>

<div>       [ IdP eventually redirects to our servlet]</div><div>IdP/authn/external/SHSession (this is our servlet path)</div><div>      [Authn fails, redirect to external app login page] !!! This is where I need  _idp_authn_lc_key cookie set !!!</div>

<div>      [Note: Currently using req.sendRedirect - is there a better way?]</div><div>www/login?whenDone=IdP/authn/external/SHSession (Guessing here)</div><div>      [User logs in and is redirected to whenDone]</div><div>

      [Note: If needed, whenDone could be orig IdP Unsolicited URL]</div><div>IdP/authn/external/SHSession<br></div><div>      [Authentication passes, call returnToAuthenticationEngine]</div><div>IdP/AuthEngine</div><div>

     [Eventual return to profile to get relayState]</div><div>...  [A bunch of redirects later...]</div><div><a href="http://www.example.com/dashboard">www.example.com/dashboard</a><br></div><div>    [User is happy]</div>

<div><br></div></div>