Hello,

I want to add Security to my remote EJB.

I added this to my obenejb-jar.xml:

<sec:security>
    <sec:default-principal realm-name="geronimo-admin">
          <sec:default-principal>
<sec:principal class ="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="guest"/>
          </sec:default-principal>
     </sec:default-principal>

    <sec:role-mappings>
        <sec:role role-name="ejbuser">
<sec:principal class ="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal"
                  name="system"/>
        </sec:role>
    </sec:role-mappings>
</sec:security>

In these Annotation to my Implementation:
@Stateless
@RolesAllowed("ejbuser")
public class logintestImpl implements logintestRemote {

The Client:

Properties prop=new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
prop.put("java.naming.provider.url", "ejbd://10.8.0.1:4201");
                                                
Context context = new InitialContext(prop);
                        
LoginContext lc = new LoginContext("geronimo-admin",
                                new TextCallbackHandler());
lc.login();
        
logintestRemote sEJB = (logintestRemote)context.lookup("logintestImplRemote");
sEJB.klopfen();
                        
lc.logout();

My problem is that it isn't complete and I get errors when deploying the EJB on Geronimo 2.1.4

What would be a solution that works?
Where can I find Tutorials and Examples for EJB Security Implementation on Geronimo?

Best regards

Chris

Reply via email to