Two Laptop Bag
The moose likes Sockets and Internet Protocols and the fly likes Authentication via HttpUrlConnection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Authentication via HttpUrlConnection" Watch "Authentication via HttpUrlConnection" New topic

Authentication via HttpUrlConnection

Bill Siggelkow
Ranch Hand

Joined: Jun 27, 2001
Posts: 57
Has anyone successfully used the Authenticator class? I tried this from a client app and it did not seem to work. Instead, I simply stored the username and password as base64 encoded strings in the request. I am connecting to a servlet running on WLS 6.1.

Bill Siggelkow
Jade Cove Solutions
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
The Authenticator class (I assume you are using the one from OReilly) encodes the Authentication information in the http request header. The Server or Servlet has to be configured to accept the authentication in this manner. If when you connect using a browser, a popup window is displayed for username and password, you can be fairly sure it's configured that way. If you want information on writing a servlet that reads the Basic Authentication from a http request header, I recommend you post the question in Serlvet forum.
I Hope This Helps
Carl Trusiak, SCJP2, SCWCD

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
I agree. Here's the link:
subject: Authentication via HttpUrlConnection
It's not a secret anymore!