2 Replies Latest reply on Oct 7, 2002 8:12 AM by vikas sehgal

    "principal=null" after successeful authorization in Database

    Roman Newbie

      The problem is : the DatabaseServerLoginModule configured and works. I'm login on server from MBean successfully using org.jboss.security.ClientLoginModule.

      BUT during call of ejb-create from this MBean the exception occur:

      Received throwable with Message: checkSecurityAssociation; nested exception is:
      java.lang.SecurityException: Authentication exception, principal=null
      java.rmi.RemoteException: checkSecurityAssociation; nested exception is:
      java.lang.SecurityException: Authentication exception, principal=null
      java.lang.SecurityException: Authentication exception, principal=null
      at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(SecurityInterceptor.java:213)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:144)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
      at org.jboss.ejb.StatelessSessionContainer.invokeHome(StatelessSessionContainer.java:253)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:436)
      at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:212)
      at $Proxy43.create(Unknown Source)
      at ua.kiev.softline.forex.quotation.startup.QuoteService.start(QuoteService.java:70)

      what's wrong?
      The login performed by CallbackHandler from "HOW-TO" like this:

      public void loginUser(String userName, String password)throws RealmException{
      try {
      CallbackHandlerImpl handler = new CallbackHandlerImpl(userName, password);
      LoginContext lc = new LoginContext("client-login", handler);
      } catch (LoginException e) {
      throw new RealmException(RealmException.AUTHENTICATION_FAILED);

      private class CallbackHandlerImpl implements CallbackHandler{
      private String login= null;
      private String password = null;

      protected CallbackHandlerImpl(String login, String password){
      this.login= login;
      this.password = password;

      public void handle(Callback[] callbacks) throws
      java.io.IOException, UnsupportedCallbackException{
      for (int i = 0; i < callbacks.length; i++){
      if (callbacks instanceof NameCallback){
      NameCallback nc = (NameCallback)callbacks
      }else if (callbacks instanceof PasswordCallback){
      PasswordCallback pc = (PasswordCallback)callbacks
      throw new UnsupportedCallbackException(callbacks, "Unrecognized Callback");


      the auth.conf is:

      simple {
      // Very simple login module:
      // any user name is accepted.
      // password should either coincide with user name or be null,
      // all users have role "guest",
      // users with non-null password also have role "user"
      org.jboss.security.auth.spi.SimpleServerLoginModule required;

      // Used by clients within the application server VM such as
      // mbeans and servlets that access EJBs.
      client-login {
      org.jboss.security.ClientLoginModule required;

      // The default server login module
      org.jboss.security.auth.spi.DatabaseServerLoginModule required
      rolesQuery="SELECT role.code, 'Roles' FROM ad_SYSUSER sys, CD_SUBJROLE sr, CD_GRANDOBJECT role WHERE sys.PERSON_ID = sr.subject AND sr.role = role.id AND sys.USERNAME=?"