2 Replies Latest reply on Nov 9, 2001 9:37 PM by Eric Chow

    Unable to locate a login configuration

    Eric Chow Apprentice

      hello,

      I am trying to use JAAS to handle the access control for calling EJB.

      I have following the steps that in the JBoss document.
      But still failed. Please give me a hand.
      The following are soem of my files:

      If you want, I can send you all my simple testing files.

      ------ jboss.xml
      <?xml version="1.0" encoding="UTF-8"?>

      <security-domain>
      java:/jaas/EricSecurityDomain
      </security-domain>
      <enterprise-beans>

      <ejb-name>Calc</ejb-name>
      <jndi-name>my/calcs</jndi-name>

      </enterprise-beans>



      ------ auth.conf in JBOSS_HOME/conf/default
      EricSecurityDomain {
      // A properties file LoginModule that supports CallerPrincipal mapping
      org.jboss.security.auth.spi.UsersRolesLoginModule required;
      };



      ------ ejb-jar.xml
      <?xml version="1.0" encoding="UTF-8"?>

      <ejb-jar>
      Calc Sample Application
      <display-name>Calc EJB</display-name>
      <enterprise-beans>

      <ejb-name>Calc</ejb-name>
      my.CalcHome
      my.Calc
      <ejb-class>my.CalcBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      </enterprise-beans>

      <assembly-descriptor>
      <security-role>
      <role-name>ROLE1</role-name>
      </security-role>

      <method-permission>
      <role-name>ROLE1</role-name>

      <ejb-name>Calc</ejb-name>
      <method-name>*</method-name>

      </method-permission>

      <method-permission>
      <role-name>ROLE2</role-name>

      <ejb-name>Calc</ejb-name>
      <method-name>create</method-name>


      <ejb-name>Calc</ejb-name>
      <method-name>remove</method-name>


      <ejb-name>Calc</ejb-name>
      <method-name>method1</method-name>

      </method-permission>
      </assembly-descriptor>
      </ejb-jar>




      -------- roles.properties
      user1=ROLE1
      user2=ROLE2
      user1.CallerPrincipal=caller_user1
      user2.CallerPrincipal=caller_user2


      ------- user.properties
      user1=123456
      user2=123456



      When I called the Client(Console application), it raiesd the following exception:

      java.lang.SecurityException: Unable to locate a login configuration
      at com.sun.security.auth.login.ConfigFile.getAppConfigurationEntry(ConfigFile.java:221)
      at javax.security.auth.login.LoginContext.init(LoginContext.java:172)
      at javax.security.auth.login.LoginContext.(LoginContext.java:319)
      at Bonus.(Bonus.java:25)
      at Bonus.main(Bonus.java:74)




      Eric