I tried to do an old fashioned login on WAS Liberty using LoginContext:
CallbackHandler callbackHandler = WSCallbackHandlerFactory
.getInstance().getCallbackHandler("userName",
"realmName", "password", request,
response, null);
LoginContext loginContext = new LoginContext("system.WEB_INBOUND",
callbackHandler);
loginContext.login();
System.out.println(loginContext.getSubject());
WSSubject.setRunAsSubject(loginContext.getSubject());
The code succeeds and the user is authenticated, but only for that specific request. I've found out that the SSO Cookie (Ltpa) is not set, so I tried to set it manually:
response.addCookie(WebSecurityHelper.getSSOCookieFromSSOToken());
Now the SSO Cookie is set, but gets deleted/reset on the next request.
When I use login-Method on HttpServletRequest, all looks the same but the cookie isn't removed.
Does anyone know how to do a programmatic login on WAS Liberty using a User Registry and SSO Cookie?
Best regards, Billie