The Artima Developer Community
Sponsored Link

Java Buzz Forum
JCIFS and jWebUnit

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Matt Raible

Posts: 422
Nickname: mraible
Registered: Jul, 2003

Matt Raible is a J2EE Consultant in Denver, Colorado.
JCIFS and jWebUnit Posted: Jan 20, 2005 9:59 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Matt Raible.
Original Post: JCIFS and jWebUnit
Feed Title: Raible Designs ~ We Build Web Apps
Feed URL: http://static.raibledesigns.com/500.html
Feed Description: Opinions and tips on how to build web applications using Java. Currently using Hibernate, Struts, XHTML, CSS, Ant, JUnit and XDoclet.
Latest Java Buzz Posts
Latest Java Buzz Posts by Matt Raible
Latest Posts From Raible Designs ~ We Build Web Apps

Advertisement
On my current project, we're using JCIFS to integrate our application authentication process with NT Domain logins. While I found it quite easy to integrate, the one issue I found is I couldn't replicate the login process in a jWebUnit test. I tried setting the WWW-Authentication header to NTLM, but couldn't get it to work. The solution I ended up using is to subclass the NtlmHttpFilter and disable authentication when the User-Agent is "httpunit".


public class LoginFilter extends NtlmHttpFilter {

  public void doFilter(ServletRequest req, ServletResponse res,
                         FilterChain chain)
    throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequestreq;
        String userAgent = request.getHeader("user-agent");

        // prompt for login, except when jWebUnit is used
        if (userAgent == null || !userAgent.startsWith("httpunit")) {
            super.doFilter(req, res, chain);
            return;
        }

        chain.doFilter(req, res);
    }
}

Hopefully this is useful for others. If you've managed to get regular jWebUnit authentication working with NTLM, I'm all ears.

Read: JCIFS and jWebUnit

Topic: Examples of extending Pebble Previous Topic   Next Topic Topic: Java Hacker's Worksheet preview/Color Calculator

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use