• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get Subject object from EJB3 Stateless Session Bean  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another simple question
we have a ear application containing web layer and a ejb3 layer.
my web application required authentication.
Can you help me on that Topic : i need to access the javax.security.auth.Subject current implementation from an ejb3 stateless session bean that is accessed by the local interface.

Can anybody help me !
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that's more of an EJB question, so I'm moving the question to that forum.
 
Oliver Kamps
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

the EJB spec allows you to access the caller principal (EJBContext.getCallerPrincipal()) and test whether the caller has a specified role (EJBContext.isCallerInRole(String)).

The spec itself does not provide a way of accessing a Subject.

What exactly are you trying to achieve? Why do you need to access the Subject?

Cheers,
Oliver
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I want to implement an abstract Audit mechanism and add "createdBy" and "lastUpdatedBy" field in my database but i want to get my user name at the last moment !
Principal caller should be ok

Thanks !
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!