You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Christian Fichtl <ma...@christian-fichtl.de> on 2009/05/30 18:45:01 UTC

EJB Security

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

Re: EJB Security

Posted by viola lu <vi...@gmail.com>.
you can refer to section "Security configuration in EJB3 beans using
annotations" from this link below:
http://www.ibm.com/developerworks/websphere/library/techarticles/0811_vamsi/0811_vamsi.html
Good luck!

On Sun, May 31, 2009 at 12:45 AM, Christian Fichtl <mail@christian-fichtl.de
> wrote:

> 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
>



-- 
viola