Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Assigning different authentication method in web.xml  RSS feed

 
Rudy Rusli
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there anyway in a web apps I can assign two different authentication methods for different pages.

Let say I have test1.jsp and test2.jsp

For test1.jsp I need to require user to use BASIC authentication
But for test2.jsp I need to require user to use DIGEST authentication.

How do I handle this? Is it in my web.xml? If it is, how do I set it?

Thanks in advance for all the help.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you can only specify a single authentication method in web.xml. It's pretty easy to handle BASIC auth yourself, though. Here's some code to extract username and password from the request:



Base64Coder is here.

If the provided authentication isn't sufficient (e.g. on the first access), you challenge it:

 
Rudy Rusli
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about 'Fallback Mechanism' described in this article?

http://e-docs.bea.com/wls/docs100/security/thin_client.html#wp1055606

I tried putting "DIGEST,BASIC" in the auth-method but doesn't seem to work..com/wls/docs100/security/thin_client.html#wp1055606

[ August 15, 2007: Message edited by: Rudy Rusli ]
[ August 15, 2007: Message edited by: Rudy Rusli ]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Fallback" suggests to me that the methods will be tried until one of them atually works, rather than trying them until a user successfully logs in. It's worth a shot, I suppose.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!