mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-09 11:53:30 +00:00
Add a getter for the context.
This commit is contained in:
parent
39b7cc3782
commit
064cd3c7bf
@ -89,7 +89,7 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
|
|||||||
InitializingBean, ApplicationContextAware {
|
InitializingBean, ApplicationContextAware {
|
||||||
//~ Instance fields ========================================================
|
//~ Instance fields ========================================================
|
||||||
|
|
||||||
private ApplicationContext ctx;
|
private ApplicationContext context;
|
||||||
private AuthenticationDao authenticationDao;
|
private AuthenticationDao authenticationDao;
|
||||||
private PasswordEncoder passwordEncoder = new PlaintextPasswordEncoder();
|
private PasswordEncoder passwordEncoder = new PlaintextPasswordEncoder();
|
||||||
private SaltSource saltSource;
|
private SaltSource saltSource;
|
||||||
@ -100,7 +100,7 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
|
|||||||
|
|
||||||
public void setApplicationContext(ApplicationContext applicationContext)
|
public void setApplicationContext(ApplicationContext applicationContext)
|
||||||
throws BeansException {
|
throws BeansException {
|
||||||
this.ctx = applicationContext;
|
this.context = applicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthenticationDao(AuthenticationDao authenticationDao) {
|
public void setAuthenticationDao(AuthenticationDao authenticationDao) {
|
||||||
@ -111,6 +111,10 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
|
|||||||
return authenticationDao;
|
return authenticationDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ApplicationContext getContext() {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
public void setForcePrincipalAsString(boolean forcePrincipalAsString) {
|
public void setForcePrincipalAsString(boolean forcePrincipalAsString) {
|
||||||
this.forcePrincipalAsString = forcePrincipalAsString;
|
this.forcePrincipalAsString = forcePrincipalAsString;
|
||||||
}
|
}
|
||||||
@ -189,8 +193,8 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!user.isEnabled()) {
|
if (!user.isEnabled()) {
|
||||||
if (this.ctx != null) {
|
if (this.context != null) {
|
||||||
ctx.publishEvent(new AuthenticationFailureDisabledEvent(
|
context.publishEvent(new AuthenticationFailureDisabledEvent(
|
||||||
authentication, user));
|
authentication, user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,8 +209,8 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isPasswordCorrect(authentication, user)) {
|
if (!isPasswordCorrect(authentication, user)) {
|
||||||
if (this.ctx != null) {
|
if (this.context != null) {
|
||||||
ctx.publishEvent(new AuthenticationFailurePasswordEvent(
|
context.publishEvent(new AuthenticationFailurePasswordEvent(
|
||||||
authentication, user));
|
authentication, user));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,8 +223,8 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
|
|||||||
this.userCache.putUserInCache(user);
|
this.userCache.putUserInCache(user);
|
||||||
|
|
||||||
// As this appears to be an initial login, publish the event
|
// As this appears to be an initial login, publish the event
|
||||||
if (this.ctx != null) {
|
if (this.context != null) {
|
||||||
ctx.publishEvent(new AuthenticationSuccessEvent(
|
context.publishEvent(new AuthenticationSuccessEvent(
|
||||||
authentication, user));
|
authentication, user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user