Add a getter for the context.

This commit is contained in:
Ben Alex 2004-07-13 22:10:52 +00:00
parent 39b7cc3782
commit 064cd3c7bf
1 changed files with 12 additions and 8 deletions

View File

@ -89,7 +89,7 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
InitializingBean, ApplicationContextAware {
//~ Instance fields ========================================================
private ApplicationContext ctx;
private ApplicationContext context;
private AuthenticationDao authenticationDao;
private PasswordEncoder passwordEncoder = new PlaintextPasswordEncoder();
private SaltSource saltSource;
@ -100,7 +100,7 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
this.ctx = applicationContext;
this.context = applicationContext;
}
public void setAuthenticationDao(AuthenticationDao authenticationDao) {
@ -111,6 +111,10 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
return authenticationDao;
}
public ApplicationContext getContext() {
return context;
}
public void setForcePrincipalAsString(boolean forcePrincipalAsString) {
this.forcePrincipalAsString = forcePrincipalAsString;
}
@ -189,8 +193,8 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
}
if (!user.isEnabled()) {
if (this.ctx != null) {
ctx.publishEvent(new AuthenticationFailureDisabledEvent(
if (this.context != null) {
context.publishEvent(new AuthenticationFailureDisabledEvent(
authentication, user));
}
@ -205,8 +209,8 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
}
if (!isPasswordCorrect(authentication, user)) {
if (this.ctx != null) {
ctx.publishEvent(new AuthenticationFailurePasswordEvent(
if (this.context != null) {
context.publishEvent(new AuthenticationFailurePasswordEvent(
authentication, user));
}
@ -219,8 +223,8 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
this.userCache.putUserInCache(user);
// As this appears to be an initial login, publish the event
if (this.ctx != null) {
ctx.publishEvent(new AuthenticationSuccessEvent(
if (this.context != null) {
context.publishEvent(new AuthenticationSuccessEvent(
authentication, user));
}
}