/** * Factory method which produces a pac4j web context. * * @param httpServletRequest the http servlet request to be used for building the web context * @param httpServletResponse the http servlet response to be used for building the web context * @return a web context associated with the current servlet request */ @Produces JEEContext getWebContext(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) { logger.trace("Producing a pac4j web context..."); final Config config = ConfigSingleton.getConfig(); if (config == null) { throw new TechnicalException("The Config of the ConfigSingleton is null. You must define at least one pac4j filter!"); } JEEContext jEEContext = new JEEContext( httpServletRequest, httpServletResponse, config.getSessionStore() ); logger.trace("Returning a pac4j web context."); return jEEContext; }
@Override protected final void internalFilter(final HttpServletRequest request, final HttpServletResponse response, final FilterChain filterChain) throws IOException, ServletException { assertNotNull("securityLogic", securityLogic); final Config config = getConfig(); assertNotNull("config", config); final JEEContext context = new JEEContext(request, response, config.getSessionStore()); retrieveSecurityLogic().perform(context, config, (ctx, profiles, parameters) -> { // if no profiles are loaded, pac4j is not concerned with this request filterChain.doFilter(profiles.isEmpty() ? request : new Pac4JHttpServletRequestWrapper(request, profiles), response); return null; }, retrieveHttpActionAdapter(), clients, authorizers, matchers, multiProfile); }
@Override protected void internalFilter(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws IOException, ServletException { assertNotNull("callbackLogic", callbackLogic); final Config config = getConfig(); assertNotNull("config", config); final JEEContext context = new JEEContext(request, response, config.getSessionStore()); retrieveCallbackLogic().perform(context, config, retrieveHttpActionAdapter(), this.defaultUrl, this.saveInSession, this.multiProfile, this.renewSession, this.defaultClient); }
@Override protected void internalFilter(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws IOException, ServletException { assertNotNull("applicationLogoutLogic", logoutLogic); final Config config = getConfig(); assertNotNull("config", config); final JEEContext context = new JEEContext(request, response, config.getSessionStore()); retrieveLogoutLogic().perform(context, config, retrieveHttpActionAdapter(), this.defaultUrl, this.logoutUrlPattern, this.localLogout, this.destroySession, this.centralLogout); }