Here we assume that the foo:bar user exists in both GF realm and PL IDM. {code:java} @WebServlet(name = "FooServlet", urlPatterns = {"/foo"}) public class FooServlet extends HttpServlet {
private static final Logger LOG = Logger.getLogger(FooServlet.class.getName());
@Inject private Principal principal;
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
LOG.info("principal [req] = " + request.getUserPrincipal()); LOG.info(" principal [CDI] = " + principal ); LOG.info(" request.login( ) " ); request.login(" foo", "bar"); LOG.info("principal [req] = " + request.getUserPrincipal()); LOG.info(" principal [CDI] = " + principal ); ... } {code}
Java EE standard HTTP security configured (via web.xml): {code} Info: principal [req] = null Info: principal [CDI] = ANONYMOUS Info: request.login() Info: principal [req] = foo Info: principal [CDI] = foo {code}
PicketLink HTTP security configured (via @Observes SecurityConfigurationEvent event):
{code} Info: principal [req] = null Info: principal [CDI] = ANONYMOUS Info: request.login() Info: principal [req] = null Info: principal [CDI] = ANONYMOUS {code}
|