Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Credentials not passed into EJB

 
John KurtzMan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All:

We would like to pass in some credentials (either public or private) into an EJB to pass in meta data about the user (certificate, etc). Using a custom login module, on the client side the code is

Subject subject = loginContext.getSubject();
CustomCred credential = new CustomCred();
subject.getPrivateCredentials().add(credential);
subject.getPublicCredentials().add(credential);

============================
Within the EJB, I am trying to pull out the credential thus:

Subject caller = (Subject) PolicyContext.getContext(SUBJECT_CONTEXT_KEY);
Set<?> privateSet = caller.getPrivateCredentials();
Set<?> publicSet = caller.getPrivateCredentials();

=====

The credentials do not show up, but the subject does, as I can get the principal out. I have tried this on glassfish 3.1 and JBoss 5.1, with the same results. Glassfish does put in some authentication information within the private credential, but JBoss does not. Neither seems to support passing in meta data via credentials.

My questions are:
1. Am I doing this correctly?
2. Are Credentials supported in Glassfish or JBoss?
3. If not supported, are there other ways of passing in user meta data?

Thank you in advance

John
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic