The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes getAuthType.......always returning null... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "getAuthType.......always returning null..." Watch "getAuthType.......always returning null..." New topic
Author

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

faiza haris
Ranch Hand

Joined: Oct 17, 2000
Posts: 173
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
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
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 ]

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
faiza haris
Ranch Hand

Joined: Oct 17, 2000
Posts: 173
Carl it worked!!!
U'r great!
thanx alot!
just hafta practice,practice,practice,practice,practice,practice,practice,...
faiza
faiza haris
Ranch Hand

Joined: Oct 17, 2000
Posts: 173
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!?
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
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

Joined: Oct 17, 2000
Posts: 173
Thanx for telling abt the errata Axel!!
Its a Feature not a bug
faiza
 
 
subject: getAuthType.......always returning null...
 
Threads others viewed
Basic Authentication using web.xml
secutity-constraint web.xml
How authorization constraint effects authentication?
Security constraints declaratively in web.xml
Memory Realm
developer file tools