Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
1) I studied that ejb-jar.xml roles map to Principal objects. It that true? Are we talking about the java.security.Principal interface? Or are we talking about java.security.auth.Subject ?
2) Is that true that when a Principal is assigned to an EJB client, it is propagated to all Remote Interface executions this client performs? In this case how to bind a client with a Principal so that it is recognized by the J2EE container?
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
It's actually the vendor-specific equivalent of ejb-jar.xml that does the mapping from roles to actual principals (e.g. weblogic-ejb-jar.xml if you're using WebLogic, and so on). The mapping isn't really related to any particular Java interface but as it happens, you get the user's identity from the context as an instance of java.security.Principal.]
I didn't quite get what you're after with this?
Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Originally posted by Lasse Koskela:
Ah, I think I see what you're after. When you fetch a home interface reference from the JNDI tree, you are being authenticated against the server if the bean has restricted access -- you'll need to provide a username and password. The application server authenticates the username/password against the configured security realm, be it a user database, LDAP or something else. If this authentication is successful, the container creates a Principal object matching the user you authenticated as and makes that object available for you through the EJBContext. Was this closer to what you're looking for?
Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Originally posted by Lasse Koskela:
I think we're getting into vendor specifics here. I believe you can do a "local login" with WLS 8.1 by using weblogic.security.services.Authentication#login(CallbackHandler) where you have to provide a suitable implementation of the CallbackHandler interface but I'm not sure if this will help your situation at all (you'll still need to give a username and password for performing the "local login").
Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD