[jboss-user] [Security & JAAS/JBoss] - Authentication on standalone client

elgabo do-not-reply at jboss.com
Fri Feb 1 15:51:30 EST 2008


Hi,

I have a little doubt about the ClientLoginModule.  I am able to use this module on my standalone client, but it works in a different way than the expected.  The AA is been done when a method from an EJB (properly configured) is called, but not when I call the LoginContext.login method.

Can some one give me an example of how to combine this ClientLoginModule with another LoginModule so the authorization is performed on the LoginContext.login method?

What I have up until now is the following:

--- on the standalone client ---
[other.conf]

  | other {
  |    // jBoss LoginModule
  |    org.jboss.security.ClientLoginModule  required
  |    ;
  | 
  |    // Put your login modules that need jBoss here
  | };
  | 
[TestLogin.java]

  | try {
  | 	System.setProperty("java.security.auth.login.config", "other.conf");
  | 
  | 	CallbackHandler handler=new UsernamePasswordHandler("user","1234567");
  | 	LoginContext context=new LoginContext("srp-client", handler);
  | 	context.login();
  | 			
  | 	InitialContext initCtx=new InitialContext();
  | 	ImportadorEsAgilRemote bean=(ImportadorEsAgilRemote) initCtx.lookup("ImportadorEsAgilBean/remote");
  | 	bean.importarPrecios("hola mundo");
  | } catch (LoginException e) {
  | 	// TODO Auto-generated catch block
  | 	e.printStackTrace();
  | } catch (NamingException e) {
  | 	// TODO Auto-generated catch block
  | 	e.printStackTrace();
  | }
  | 
--- on my ejb project ---
[jboss.xml]

  | <?xml version="1.0" encoding="UTF-8"?>
  | <jboss>
  | 	<security-domain>java:/jaas/other</security-domain>
  | </jboss>
  | 
[login-config.xml]

  |     <application-policy name = "other">
  |        <authentication>
  |           <login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
  |              flag = "required" />
  |        </authentication>
  |     </application-policy>
  | 

Thanks for all your help

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

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



More information about the jboss-user mailing list