I thought I am doing a JAAS login - from what I read in section 3.2.1.2. in 
JBoss 4.0.1 AS guide, LoginInitialContextFactory does a JAAS login under the 
hood. Nevertheless, I have tried using JAAS login directly:


  | public void ejbTimeout(Timer timer) {
  |     final OptInfo info = (OptInfo)timer.getInfo();
  |     try {
  |             Properties p = new Properties();
  |             
  |             p.put(Context.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory");   //$NON-NLS-1$
  |             p.put(Context.URL_PKG_PREFIXES, 
"org.jboss.naming:org.jnp.interfaces");   //$NON-NLS-1$
  |             p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
  |             
  |             try {
  |                     LoginContext ctxLogin = new 
LoginContext("client-login", new CallbackHandler() {
  |                             public void handle(Callback[] callbacks) throws 
IOException, UnsupportedCallbackException {
  |                             for (int i = 0; i < callbacks.length; i++) {
  |                                 if (callbacks[ i ] instanceof NameCallback) 
{
  |                                     NameCallback nc = 
(NameCallback)callbacks[ i ];
  |                                     nc.setName(info.user.username);
  |                                 } else if (callbacks[ i ] instanceof 
PasswordCallback) {
  |                                     PasswordCallback pc = 
(PasswordCallback)callbacks[ i ];
  |                                     
pc.setPassword(info.user.password.toCharArray());
  |                                 } else {
  |                                     throw new 
UnsupportedCallbackException(callbacks[ i ], "Unrecognized Callback");
  |                                 }
  |                             }
  |                         }
  |                     });
  |                     ctxLogin.login();
  |                             
  |                     InitialContext ctx = new InitialContext(p);
  |             InitialContext ctx = new InitialContext(p);
  |             Object home = ctx.lookup(WalkOptimizerHome.JNDI_NAME);
  | 
  |             WalkOptimizerHome optimizerHome = 
(WalkOptimizerHome)PortableRemoteObject.narrow(home, WalkOptimizerHome.class);
  |             WalkOptimizer optimizer = optimizerHome.create();
  | 
  |             optimizer.runOptimization(info);
  |     } catch (NamingException e) {
  |             Category.getInstance("WalkOptimizer").error("login failed 
(naming): " + e.getMessage());
  | (remote): " + e.getMessage());
  |     } catch (CreateException e) {
  |             Category.getInstance("WalkOptimizer").error("login failed 
(create): " + e.getMessage());
  |     } catch (SessionException e) {
  |             Category.getInstance("WalkOptimizer").error("login failed 
(session): " + e.getMessage());
  |     }
  | }
  | 



 but with no effect.

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

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


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to