[jboss-user] [Security & JAAS/JBoss] - Custom credential object and cache

piotr.koper do-not-reply at jboss.com
Tue Oct 23 07:20:46 EDT 2007


Hi all.

I'd like to use my own credential object in my login module. Everything works perfectly, but there is no cache and every logging lasts almost 2 seconds. Earlier, when i used PasswordCallback and simply String password as credential - cache was working normally and I was very, very happy. I'd like to know is there any possibility to enable cache with my custom credential object? If yes - how, If not... at least i will know that is a feature.

What i have/use is:
* jboss-4.2.1.GA on Windows XP Professional SP2
* my own login module:

  | public class MyLoginModule extends AbstractServerLoginModule
  | {
  | 
  | 	// my login method
  | 	public boolean login() throws LoginException
  | 	{
  | 		super.loginOk = false;
  | 		
  | 		NameCallback nameCallback = new NameCallback("login: ");
  | 		ObjectCallback objectCallback = new ObjectCallback("ObjectCallback");
  | 		try
  | 		{
  | 			callbackHandler.handle(new Callback[]{ nameCallback, objectCallback});
  | 			identity = new SimplePrincipal(nameCallback.getName());
  | 			credential = (MyCredential) objectCallback.getCredential();
  | 			
  | 			SecurityAssociation.setPrincipal(identity);
  | 			SecurityAssociation.setCredential(credential);
  | 		}
  | 		catch (IOException e)
  | 		{
  | 			e.printStackTrace();
  | 		}
  | 		catch (UnsupportedCallbackException e)
  | 		{
  | 			e.printStackTrace();
  | 		}
  | 		
  | 		// now i use other some class to verify data
  | 		super.loginOk = true;
  | 	}
  | 
  | 	// more code here, but it's not important here
  | 
  | }
  | 
* I don't use cache-controll file jboss-service.xml
* In my secured ejb:
@EJB
  | @SecurityDomain("sec-domain")
  | public class HelloBean implements HelloLocal, HelloRemote
  | {
  | 	// implementations of Local and Remote interfaces
  | }

* In my servlet:
LoginContext lc = new LoginContext("sec-domain", instanceOfCallbackHandler);
  | lc.login();

Thanks for any help or suggestions
piotr.koper

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

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



More information about the jboss-user mailing list