Quantcast
Channel: SCN : All Content - SAP HANA Cloud Platform Developer Center
Viewing all articles
Browse latest Browse all 3285

HCP Java Servlet Filter / Principal was not set on initial request

$
0
0

Dear community,

 

I have a Java Application with Java Web Runtime running and need to authenticate the user via FORM authentication.

 

Declarative authentication is currently not possible for my usecase.

So I use the following code inside a filter to do programmatical authentication:

 

@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain)        throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
if(request.getRemoteUser() == null) {     try {          LoginContext loginContext = LoginContextFactory.createLoginContext("FORM");          loginContext.login();      } catch (LoginException e) {         unauthorized(response, "FORM Login failed");         return;       }
}
[...]

The filter is the first and only one in the chain.

However I get the following exception after successful authentication and the application crashes:

 

2016 07 05 11:52:39#+00#ERROR#org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/xxxxxxx].[corp.sap.wdf.xxxxxxx.core.servlet.UIProxyServlet]##D066389#http-bio-8041-exec-5#na#abb86455f#osg#web#abb86455f#Servlet.service() for servlet [corp.sap.wdf.xxxxxxx.core.servlet.UIProxyServlet] in context with path [/xxxxxxx] threw exception

com.sap.core.connectivity.destinations.configuration.DestinationRuntimeException: Principal 'xxxxxxx(authentication method: SAML2)

[THE SAML CONTENT]

MNI terminated=false

' was not set on initial request, but was received on a subsequent request which is illegal.

Principal was not sent on initial request? What does that mean?

I thought that it is always the case that we get the principal after redirect from SAP cloud id service?

Can someone please tell me what is going wrong here?

 

Best Regards

Martin Löper


Viewing all articles
Browse latest Browse all 3285

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>