I have seen a thread on the mailing list on how to set principal in a
context from a stand-alone
client. I followed the instructions, but I still get Jonas_client as the
principal on the server side.

EJBServer trace shows that my roles are initialized properly.  I am at
my wit's ends. Can
anyone see the problem?

My setup follows:
-------------------

I am using Jeremie.

1. My jonas-users.properties:

hello = vas

2. In my client I do:

public class SecClient {

   public static void main( String args[] ) {

   SecurityContext ctx = new SecurityContext ("hello");
   SecurityCurrent current = SecurityCurrent.getCurrent () ;
   current.setSecurityContext(ctx) ;

      try {
         Context initial = null;
         initial = new InitialContext();
         Object objref = initial.lookup("aka/security/Pitbull");
         if( objref == null )
            System.out.println( "Got null reference" );
         else
            System.out.println( "Got reference" );

         PitbullHome home =
            (PitbullHome)PortableRemoteObject.narrow(objref,
               PitbullHome.class);
         Pitbull pitbull = home.create();
         pitbull.testPrincipal();

etc...

3. In my ejb-jar.xml I have:<ejb-jar>
   <description>AKA EJB Application</description>
   <display-name>AKA EJB App</display-name>
   <enterprise-beans>

      <session>
         <description>
            This is an Pitbull bean
         </description>
         <ejb-name>aka/security/Pitbull</ejb-name>
         <home>com.electricmail.security.PitbullHome</home>
         <remote>com.electricmail.security.Pitbull</remote>
         <ejb-class>com.electricmail.security.PitbullBean</ejb-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>
         <security-role-ref>
            <role-name>vas</role-name>
            <role-link>vas</role-link>
         </security-role-ref>
      </session>
   </enterprise-beans>

      <assembly-descriptor>

         <security-role>
            <description>
               Just a trial
            </description>
            <role-name>vas</role-name>
         </security-role>

         <method-permission>
            <role-name>vas</role-name>
            <method>
               <ejb-name>aka/security/Pitbull</ejb-name>
               <method-name>*</method-name>
            </method>
         </method-permission>

      </assembly-descriptor>

</ejb-jar>




----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to