Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setting principle in request object  RSS feed

 
Shivaji Byrapaneni
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i came to know that i need to keep the principle object in request object to
make the configured role availble to be acessible by web container to map with the roles provided in the web.xml

could any body help me letting knwo how cani keep the principle object to session..?

i tried this

it is giving null



Thanks in advance
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the above code is showing null for the principal then your request is probably hitting a URL that is not secured.
 
Shivaji Byrapaneni
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes might be

i hope if i better explain my issue you can provide me with some solution

i will be having a set of pages which need to be accessed bya spcific set of people with specific roles

which im planning to make it through declarative security mechanisam so i added that configurations to web.xml

i made a login page and kept that outside so that it can be acessed by ppl. From the managed bean of my login page im triggering the jaas and getting my subject.

Here i need to set that subject or the principle in that subjetc some where so that my sessions remembers the user logged in.

from some forums i came to know that web.xml reads the request object getUserPrinciple() method to determine the role of the user logged in.

here my problem raises.

where should i set that user principle to request object and one more thing is that i cant even find a setter for that.

please correct me if that getUserPrinciple method is also not the correct one

please help

thanks in advance
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you have hit a secured resource the principal will be set by the container - you don't need to set it. If its not being set you are not hitting a secured URL. Can you post your web.xml and the URL you try?
 
Shivaji Byrapaneni
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my web.xml i had this



my workpsace structure is like this




what exactly im doing is in my login page on click of submit im calling JAAS like this



please help
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...and what URL did you hit?
 
Shivaji Byrapaneni
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/pages/xxx.jsp

which is under the secured list as specified in web.xml
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!