Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8011713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:06:00+00:00 2026-06-04T19:06:00+00:00

Our application is using Wicket. We’re using Wicket’s own forms to handle authentication, the

  • 0

Our application is using Wicket. We’re using Wicket’s own forms to handle authentication, the main benefits being that the look of the site is kept consistent.

We thought we couldn’t do container authentication because our application allows the user to switch authentication mechanisms mid-stream, and Jetty itself was creating quite a bit of friction anyway, just getting simple authentication to work at the container level.

So we ended up implementing authentication via a filter (there are a number of good examples out there.)

Now I have discovered that by doing this, Wicket authentication is slightly broken. What happened was:

  1. Anonymous user would visit the site.
  2. Security filter determines that the user isn’t authenticated and redirects to sign-in.
  3. Wicket renders the sign-in page.
  4. User signs in.
  5. Wicket processes the post to the sign-in form and redirects user back.
  6. Security filter determines that the user isn’t authenticated and redirects…

I looked inside my subclass of AuthenticatedWebSession, hoping to find some way I could get a hold of the HttpSession and set a session attribute which could then be checked from the filter. However I couldn’t for the life of me find a way to do it.

What I resorted to doing was making yet another filter, coded like this:

public class StealWicketUserFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        // Nothing to initialise.
    }

    @Override
    public void doFilter(ServletRequest servletRequest,
                         ServletResponse servletResponse,
                         FilterChain filterChain) throws IOException, ServletException
    {
        filterChain.doFilter(servletRequest, servletResponse);

        HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
        if ("POST".equals(httpServletRequest.getMethod()) &&
                "/sign_in".equals(httpServletRequest.getRequestURI())) {
            HttpSession session = httpServletRequest.getSession();
            ServerUser currentUser = (ServerUser)
                session.getAttribute("wicket:webUIServlet:currentUser");
            if (currentUser != null) {
                session.setAttribute(CombinedSecurityFilter.CURRENT_USER_ATTRIBUTE,
                                     currentUser);
            }
        }
        else if ("/sign_out".equals(httpServletRequest.getRequestURI())) {
            HttpSession session = httpServletRequest.getSession();
            session.removeAttribute(CombinedSecurityFilter.CURRENT_USER_ATTRIBUTE);
        }
    }

    @Override
    public void destroy() {
        // Nothing to destroy.
    }
}

This of course works (and will continue to work until Wicket change the prefix they store session attributes under.)

I guess what I want to know is whether this is a bad idea and whether there is a “proper Wicket way” to do this sort of thing.

As for the reason we don’t use Wicket’s authentication alone – the reason is that we wanted to support SPNEGO authentication and potentially other external authentication types.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:06:01+00:00Added an answer on June 4, 2026 at 7:06 pm

    You can get hold of your HttpSession,albeit through Request and not Session.

    What you need is:

    WebRequest req = (WebRequest)RequestCycle.get().getRequest();
    HttpSession session = req.getHttpServletRequest().getSession();
    

    However I’m pretty sure Wicket authentication isn’t broken in such an obvious manner so I’d probably try to find out what is causing this glitch instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Goal : Our application is built using multiple types (e.g. Person, PersonSite(ICollection), Site -
Our application is using initialization code that depends on the order static code is
I'm having a hard time testing our Wicket application using Selenium because of the
So we have our J2EE application using Log4j like this public class CustomerController {
I'm not a fan of using ASP.NET session state, but our application is using
Our application is developed using Spring framework. Is it good practice to check null
In our application we are using set of images as slides. If we click
I am developing a PHP application using our XAMPP setup as a test server.
Our application downloads data from the internet using RSS but is having connection problems
In our application (c++) we load 3rd party DLLs using LoadLibrary. Sometimes these DLLs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.