• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

getAuthType.......always returning null...

 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Here i am with a simple but crazy problem....huh!
my getAuthType() always returns null even if i'm declaring the BASIC type in my web.xml
here is the simple example from wrox and i'm unable to run it

index.jsp

web.xml

and when i access it its always returning null. i also changed the tomcat-users.xml and added
<user name="projsp" password="projsp" roles="superuser" />
as the book says.
This is really time consuming and i wonder where the error is.......urghhhhhhhhh.....!
Ersin you mentioned easy memory q's ... i guess i better start preparing on that front!! Somebody get Memory chip for me
faiza
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You did not supply the Authorization Constraint in the Security Constraint. Therefore, the Authentication doesn't occur so, null
Change your web.xml to :

This uses the role you added. Use the username and password you provided in tomcat-users.xml
[ January 29, 2002: Message edited by: Carl Trusiak ]
 
faiza haris
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carl it worked!!!
U'r great!
thanx alot!
just hafta practice,practice,practice,practice,practice,practice,practice,...
faiza
 
faiza haris
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh! By the way ... will the wrox guys have to amend their web.xml file? cuz it doesnt tell of the auth-constraint there? and its not working without it?
plz advice!?
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Faiza,
I have not yet get to that advanced page.
But the error seems to be posted on the errata page:
http://www.wrox.com/Books/Book_Errata.asp?loc=1&message_id=12904&isbn=1861004958�ion=11_3&subject=&subject_id=
Error in web.xml for authentication examples
In Chapter 16 we deal with basic, digest, and form authentication. It appears that the web.xml file needed to run the examples associated with these has a bug in it. According to the book, we need a <security-constraint> element that looks like the following:
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Web Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
</security-constraint>
However, to make the examples work we need to add a <auth-constraint> element too:
<security-constraint>
<web-resource-collection>
<web-resource-name>The Entire Web Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>
(many thanks to Matt Moodie for this bug fix)
Axel
 
faiza haris
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for telling abt the errata Axel!!
Its a Feature not a bug
faiza
 
What's that smell? Hey, sniff this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic