If theres nothing in wicket already you could make your own
AuthenticatedWebPage class that did something similar to:

    public UserValue handleBasicAuth(HttpServletRequest request) {
        String auth = request.getHeader("Authorization");
        UserValue user = null;

        if (auth != null && auth.startsWith("Basic")) {

            String[] pair = new
String(Base64.decode(auth.substring(6))).split(":");
            if (pair.length == 2) {
                String userName = pair[0];
                String password = pair[1];

                try {
                    user = userSearch.validateUser(userName, password);
                } catch (Exception e) {
                    LOG.warn("Unable to validate (" + userName + " / "
+ password + " ): " + e.getMessage());
                }
            }
        }

        return user;
    }

    public void sendAuth(HttpServletResponse httpServletResponse)
throws IOException {
        httpServletResponse.setHeader("WWW-Authenticate", "Basic
realm=\"bulletinmail\"");
        httpServletResponse.setStatus(401);
        httpServletResponse.getOutputStream().print("Please login to
bulletinmail");
    }



These are two convience methods in a current struts app of mine, in
the action ( or page in this instance ) I check for validation,
otherwise I call sendAuth and request it.

I don't have any wicket stuff in front of me at the moment so I'm not
sure how easily this could be integrated into wicket.  Do we get
access to the raw response?


On 1/18/06, Dan Gould <[EMAIL PROTECTED]> wrote:
> Is it possible to use HTTP authentication with Wicket?
>
> I.e., some pages (bookmarkable or regular) require HTTP BASIC auth?
>
> I can't seem to find anything about it in the docs, but I want to protect
> some administrative pages in my system before going live...
>
> Thanks,
> Dan
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to