Forums Register Login

Tomcat 8 cannot read httpMethodConstraints

+Pie Number of slices to send: Send


index.jsp


tomcat-users.xml:


The result is that mary , as a manager role is forbidden access the PUT.

But when I remove value= @HttpConstraint... , it works.
+Pie Number of slices to send: Send
That actually wasn't a very clear question.

But what I think you meant was that depending on the user's role, you could do one thing or the other, but not both.

J2EE security roles are not simple labels. It's perfectly legal for Mary to be both a Manager and an Employee:

Likewise, code security can allow users in more than one role:
+Pie Number of slices to send: Send
Hi, Tim,

This security rule says
1. manager is allowed to use doPut
2. employee are allowed to use the rest of the methods except doPut.

Suppose jane is employee and mary is manager as defined in tomcat-user.xml.
I was surprised to see that mary is not allowed to use doPut.


But when I changed the security rule :

Mary is allowed to use doPut.

+Pie Number of slices to send: Send
It has something to do with using Put in the form.
I changed the code into :



Now, jane cannot access POST method and mary can access it.
The reason is the form in index.jsp cannot use method="PUT".
+Pie Number of slices to send: Send
I used curl.exe that I downloaded from https://curl.haxx.se/dlwiz/?type=bin. I used free 7Zip to unzip it.
I ran this command :


curl -u mary -X PUT http://localhost:8080/securityAnnot/MySecurity


It promotes me for password.
Then, the doPut method runs.

I think it was because my browser does not support PUT in form.
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 642 times.
Similar Threads
Doubt in @ServletSecurity
HTTP method POST is not supported by this url
i am getting identifier expected
IllegalStateException in servlet
Servlet to servlet
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:14:30.