Hi,people

I try to use the security in JBoss and did the following (as in the
JBoss-JAAS documentation):

1. added this line to the jboss.xml of my beans

  <security-domain>java:/jaas/jaascampus</security-domain>

2. created the table

 table user{
 username varchar(10) ,
 password varchar(10) }

 table roles{
 username varchar(10) ,
 roles varchar(10) }


3. added  my new configuration to auth.conf file :

 jaascampus {
 /* A JDBC based LoginModule
 LoginModule options:
 dsJndiName: The name of the DataSource of the database containing the
Principals, Roles tables
 principalsQuery: The prepared statement query equivalent to:
     "select Password from Principals where PrincipalID=?"
 rolesQuery: The prepared statement query equivalent to:
     "select Role, RoleGroup from Roles where PrincipalID=?"
 */
     org.jboss.security.auth.spi.DatabaseServerLoginModule required
     dsJndiName="java:/CampusDB"
     principalsQuery="select password from user where username=?"
     rolesQuery="select roles, 'Roles' from roles where username=?"
     unauthenticatedIdentity=nobody
     ;
 };

4.- Filled my tables with

user:
  username=test
  password=testpassword
roles :
  username=test
  roles=creategroup

5.- My ejb-jar is how following:

<ejb-jar>

    <enterprise-beans>
        <session>
            <display-name>The Facade Controller</display-name>
            <ejb-name>TheFacade</ejb-name>
            <home>com.campus.presentation.session.ejb.FacadeHome</home>
            <remote>com.campus.presentation.session.ejb.Facade</remote>

<ejb-class>com.campus.presentation.session.ejb.FacadeEJB</ejb-class>
            <session-type>Stateful</session-type>
            <transaction-type>Container</transaction-type>
            <security-role-ref>
                <role-name>creategroup</role-name>
                <role-link>creategroup</role-link>
            </security-role-ref>
        </session>
    </enterprise-beans>

    <assembly-descriptor>

        <security-role>
            <role-name>creategroup</role-name>
        </security-role>

        <method-permission>
            <role-name>creategroup</role-name>
            <method>
                <ejb-name>TheFacade</ejb-name>
                <method-name>*</method-name>
            </method>
        </method-permission>

        <container-transaction>
            <method>
                <ejb-name>TheFacade</ejb-name>
                <method-intf>Remote</method-intf>
                <method-name>handlerEvent</method-name>
            </method>
            <trans-attribute>Supports</trans-attribute>
        </container-transaction>

    </assembly-descriptor>

</ejb-jar>

6.- When i login with the user, password ("test","testpassword") and tried
to access to EJB
I had the following message:

[INFO,Default] EJBUtil : getFacadeHome(): JNDINames.FACADE_EJBHOME
:java:comp/env/ejb/facade/Facade
[INFO,Default] EJBUtil : getFacadeHome(): JNDINames.FACADE_EJBHOME : Debug 2
[ERROR,SecurityInterceptor] Insufficient method permissions, principal=null,
method=create, requiredRoles=[creategroup], principalRoles=[]
[ERROR,TheFacade] TRANSACTION ROLLBACK EXCEPTION:
javax.transaction.TransactionRolledbackException: checkSecurityAssociation;
nested exception is:
        java.lang.SecurityException: Insufficient method permissions,
principal=null, method=create, requiredRoles=[creategroup],
principalRoles=[]; nested exce
ption is:
        java.rmi.RemoteException: checkSecurityAssociation; nested exception
is:
        java.lang.SecurityException: Insufficient method permissions,
principal=null, method=create, requiredRoles=[creategroup],
principalRoles=[]
java.rmi.RemoteException: checkSecurityAssociation; nested exception is:
        java.lang.SecurityException: Insufficient method permissions,
principal=null, method=create, requiredRoles=[creategroup],
principalRoles=[]
java.lang.SecurityException: Insufficient method permissions,
principal=null, method=create, requiredRoles=[creategroup],
principalRoles=[]
        at
org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(SecurityI
nterceptor.java:215)
        at
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.jav
a:91)
        at
org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invokeHome(Stateful
SessionInstanceInterceptor.java:119)
        at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:142)
        at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
java:347)
        at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
        at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:103)
        at
org.jboss.ejb.StatefulSessionContainer.invokeHome(StatefulSessionContainer.j
ava:324)
        at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContai
nerInvoker.java:456)
        at
org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:23
7)


i hope their help

Regards

Jaime



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to