Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accesing spring context from jaas LoginModule [closed]

I've implemented a Jaas Login Module, in order to perform authentication. I must access database to retrieve user/pass information within this module.

In the same project, there exists some DAO bean's implemented, but it's impossible to access Spring context from the jaas login module, to retrieve the DAO bean.

¿Anyone could help me please?

I'm using Spring Security to integrate Jaas in my application.

like image 795
Diego Avatar asked Nov 14 '22 08:11

Diego


1 Answers

If you have access to the LoginModule, simply add the interface ApplicationContextAware and a bean definition for the LoginModule. When the application starts the context will be available within the module.

public class LoginModule implements ApplicationContextAware {
    private ApplicationContext applicationContext;
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    } 
}

Javadoc for the interface: http://static.springsource.org/spring/docs/3.0.5.RELEASE/api/org/springframework/context/ApplicationContextAware.html

like image 69
Paul Gregoire Avatar answered Dec 16 '22 19:12

Paul Gregoire