| Basic Scheme Authentication | Under the Hood |
| Java 1.1 | Learning More |
| Digest Scheme Authentication | Links |
In Java version 1.2 or later, in your client code, you can use the java.net.Authenticator class to handle the details. You extend the class overriding the getPasswordAuthentication method like this:
Then you then register your custom Authenticator with
import java.net.Authenticator; //... // hooking up your custom Authenticator Authenticator.setDefault( new MyAuthenticator() );
You then do your GETs ignoring logons! Your Authenticator magically kicks in when needed and logs you into the server. See the File I/O amanuensis or the CMP HTTP package for how. The technique reputedly works for HTTP (Hypertext Transfer Protocol) and proxies. It may work for HTTPS (Hypertext Transfer Protocol over SSL (Secure Socket Layer)). It even works for digest passwords. I don’t see how it could work for certificate style authentication, however, but who knows…
If you are using an older Java, you will have to do it the Smith-Barney way (obscure reference to the late John Houseman):
For the more secure digest-style authentication, the protocol is more complex. It requires nine subfields. It
is described in RFC 2617. Java Authenticator uses this method when the server specifies scheme=
digest. It works by sending an MD5 digest with each transaction, and changing the digest periodically. Your Applet does not need to get involved with the details of how it works. Authenticator handles it all transparently. You can fine tune how it works with networking properties:
http.auth.digest.validateServer=false
http.auth.digest.validateProxy=false
http.auth.digest.cnonceRepeat=5
Sun does does not have a method to tell you which schemes Authenticator supports or what the official scheme names are. It may support others besides basic, digest, ntlm and spnego (Kerberos). It does not work with cookies or forms.
You might wonder how after the login is complete that the server can tell if messages coming in from the Internet are from people who are already logged in. There are a number of ways of doing it. Some you might think would work don’t.
|
|
available on the web at: |
http://mindprod.com/jgloss/authentication.html |
optional Replicator mirror
|
J:\mindprod\jgloss\authentication.html | |
![]() |
Please email your
feedback for publication,
letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear
wording, broken/redirected link reports, suggestions to improve this page or comments to
Roedy Green :
| |
| Blog | Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[50.17.109.248] |
|
| Feedback | You are visitor number 33,338. | |