Skip to content

Commit 93adad3

Browse files
committed
Add setter method for userDetailsChecker in CasAuthenticationProvider(#10277)
This commit introduces a setter method for the userDetailsChecker property in the CasAuthenticationProvider class. Previously, the userDetailsChecker was initialized with a default AccountStatusUserDetailsChecker instance, limiting customization options. Now, users can inject their own UserDetailsChecker implementation through the setter method, providing greater flexibility in handling user details validation.
1 parent 746ee27 commit 93adad3

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

cas/src/main/java/org/springframework/security/cas/authentication/CasAuthenticationProvider.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
2+
* Copyright 2004, 2005, 2006, 2024 Acegi Technology Pty Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -56,14 +56,15 @@
5656
*
5757
* @author Ben Alex
5858
* @author Scott Battaglia
59+
* @author Kim Youngwoong
5960
*/
6061
public class CasAuthenticationProvider implements AuthenticationProvider, InitializingBean, MessageSourceAware {
6162

6263
private static final Log logger = LogFactory.getLog(CasAuthenticationProvider.class);
6364

6465
private AuthenticationUserDetailsService<CasAssertionAuthenticationToken> authenticationUserDetailsService;
6566

66-
private final UserDetailsChecker userDetailsChecker = new AccountStatusUserDetailsChecker();
67+
private UserDetailsChecker userDetailsChecker = new AccountStatusUserDetailsChecker();
6768

6869
protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
6970

@@ -187,6 +188,16 @@ public void setAuthenticationUserDetailsService(
187188
this.authenticationUserDetailsService = authenticationUserDetailsService;
188189
}
189190

191+
/**
192+
* Sets the UserDetailsChecker to be used for checking the status of retrieved user details.
193+
* This allows customization of the UserDetailsChecker implementation.
194+
*
195+
* @param userDetailsChecker the UserDetailsChecker to be set
196+
*/
197+
public void setUserDetailsChecker(final UserDetailsChecker userDetailsChecker) {
198+
this.userDetailsChecker = userDetailsChecker;
199+
}
200+
190201
public void setServiceProperties(final ServiceProperties serviceProperties) {
191202
this.serviceProperties = serviceProperties;
192203
}

0 commit comments

Comments
 (0)