<div dir="ltr"><div><div>The solution is to wrap the request (prior to forward) and overload addHeader and getRemoteUser. Relevant code is at:</div><div><br></div><div><a href="http://pastebin.com/29PbiFAL">http://pastebin.com/29PbiFAL</a><br></div><div><br></div><div> I welcome direct email.<br></div><div><br></div><div><br></div></div><div>~cg</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 9, 2015 at 6:45 PM, Camel Guy <span dir="ltr"><<a href="mailto:camel@devguy.com" target="_blank">camel@devguy.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I am running Shibboleth idP 3.1.1 on Jetty 9.2.</div><div><br></div><div>I was able to get RemoteUser working with Spring Security with basic authentication. Filled with hubris, I decided to implement a custom authentication.</div><div><br></div><div>The particular authentication I'm implementing is not interactive, unless it fails.<br><div><br></div><div>I now have a complex mess of code that follows this approach:</div><div><br></div><div><a href="http://javattitude.com/2014/06/07/spring-security-custom-token-based-rest-authentication/" target="_blank">http://javattitude.com/2014/06/07/spring-security-custom-token-based-rest-authentication/</a><br></div><div><br></div><div>The problem is, from the log:</div><div><br></div><div><div>2015-06-09 15:53:29,489 - DEBUG [com.identityoverip.springauth.ise.ISEAuthenticationFilter:317] - Authentication success. Updating SecurityContextHolder to contain: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@be648917: Principal: admin; Credentials: [PROTECTED]; Authenticated: true; Details: ..</div><div><br></div><div>So, the security context was created successfully.</div><div><br></div><div>Then onAuthenticationSuccess() forwards to /Authn/RemoteUser.</div><div><br></div><div>But RemoteUser is having none of it:</div>







<div><br></div><div>2015-06-09 15:53:29,655 - INFO [net.shibboleth.idp.authn.impl.ValidateExternalAuthentication:121] - Profile Action ValidateExternalAuthentication: External authentication failed, no user identity or error information returned<br></div></div><div><br></div><div>I've tried many things:</div><div><br></div><div>1. Add REMOTE_USER header in the request prior to calling forward - containing only 'admin'</div><div>2. Remove create-session='stateless' from <http></div><div><span><br></span></div><div><span>Not to overwhelm you with a ton of information (yet), my <http> entry looks like:</span></div><div><span><br></span></div><div><span><http entry-point-ref="authenticationEntryPoint" </span>use-expressions="true" auto-config="false" >    <custom-filter ref="authenticationTokenProcessingFilter" position="FORM_LOGIN_FILTER"   />  <intercept-url pattern="/Authn/RemoteUser/**" access="isAuthenticated()" /><br> <logout /><br></http></div><div><br></div><div>The number of fixes I've attempted is in the hundreds. The outcome is always the same: External authentication failed, no user identity or error information returned.</div><div><br></div><div>Perhaps I need to configure RemoteUser to look for something other than the REMOTE_USER header.</div><div><br></div><div>If there are no suggestions, I suppose I'd better learn how to use the External flow. Spring MVC/flows is new to me and a custom authenticator seemed easier.</div><div><br></div><div><br></div><div>Thank you,</div><div><br></div><div>cg<br></div></div></div>
</blockquote></div><br></div>