Hi,
Dont depend too much on these LoginModules , there is a nice way of writing ur own by 
extending the AbstractServerLoginModule....then when ur implementing ur own 
LoginModule u will get know the important aspects of this LoginMechanism just a simple 
one will help u

But any way try the follwoing code if it helps using different callback handler

  |  protected String[] getUsernameAndPassword() throws LoginException
  |  {
  |     String[] info = {null, null};
  |     // prompt for a username and password
  |     if( callbackHandler == null )
  |     {
  |        throw new LoginException("Error: no CallbackHandler available " +
  |        "to collect authentication information");
  |     }
  |     String username = null;
  |     String password = null;
  |     SecurityAssociationCallback sac = new SecurityAssociationCallback();
  |     Callback[] callbacks = { sac };
  |     try
  |     {
  |       callbackHandler.handle(callbacks);
  |       if(sac.getPrincipal() != null)username = sac.getPrincipal().getName();
  |       if(sac.getCredential() != null)
  |       {
  |         password = new String((char[]) sac.getCredential());
  |       }
  |       SecurityAssociation.setPrincipal(sac.getPrincipal());
  |       SecurityAssociation.setCredential(sac.getCredential());
  |       SecurityAssociation.setSubject(subject);
  |     }
  |     catch(java.io.IOException ioe)
  |     {
  |        throw new LoginException(ioe.toString());
  |     }
  |     catch(UnsupportedCallbackException uce)
  |     {
  |        throw new LoginException("CallbackHandler does not support: " + 
uce.getCallback());
  |     }
  |     info[0] = username;
  |     info[1] = password;
  | // or even add here ur product or any other stuff u need and dont forget //to 
check the instance of the Principal class u r getting above if it is the //same as u 
sent it from the client
  |     return info;
  |  }
  | 
regards
jani

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3834649#3834649

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3834649


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to