37
37
import org .springframework .security .web .authentication .preauth .x509 .X509AuthenticationFilter ;
38
38
import org .springframework .security .web .authentication .preauth .x509 .X509PrincipalExtractor ;
39
39
import org .springframework .security .web .context .RequestAttributeSecurityContextRepository ;
40
+ import org .springframework .util .Assert ;
40
41
41
42
/**
42
43
* Adds X509 based pre authentication to an application. Since validating the certificate
@@ -105,6 +106,7 @@ public X509Configurer() {
105
106
* @return the {@link X509Configurer} for further customizations
106
107
*/
107
108
public X509Configurer <H > x509AuthenticationFilter (X509AuthenticationFilter x509AuthenticationFilter ) {
109
+ Assert .notNull (x509AuthenticationFilter , "x509AuthenticationFilter cannot be null" );
108
110
this .x509AuthenticationFilter = x509AuthenticationFilter ;
109
111
return this ;
110
112
}
@@ -115,6 +117,7 @@ public X509Configurer<H> x509AuthenticationFilter(X509AuthenticationFilter x509A
115
117
* @return the {@link X509Configurer} to use
116
118
*/
117
119
public X509Configurer <H > x509PrincipalExtractor (X509PrincipalExtractor x509PrincipalExtractor ) {
120
+ Assert .notNull (x509PrincipalExtractor , "x509PrincipalExtractor cannot be null" );
118
121
this .x509PrincipalExtractor = x509PrincipalExtractor ;
119
122
return this ;
120
123
}
@@ -126,6 +129,7 @@ public X509Configurer<H> x509PrincipalExtractor(X509PrincipalExtractor x509Princ
126
129
*/
127
130
public X509Configurer <H > authenticationDetailsSource (
128
131
AuthenticationDetailsSource <HttpServletRequest , PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails > authenticationDetailsSource ) {
132
+ Assert .notNull (authenticationDetailsSource , "authenticationDetailsSource cannot be null" );
129
133
this .authenticationDetailsSource = authenticationDetailsSource ;
130
134
return this ;
131
135
}
@@ -138,6 +142,7 @@ public X509Configurer<H> authenticationDetailsSource(
138
142
* @return the {@link X509Configurer} for further customizations
139
143
*/
140
144
public X509Configurer <H > userDetailsService (UserDetailsService userDetailsService ) {
145
+ Assert .notNull (userDetailsService , "userDetailsService cannot be null" );
141
146
UserDetailsByNameServiceWrapper <PreAuthenticatedAuthenticationToken > authenticationUserDetailsService = new UserDetailsByNameServiceWrapper <>();
142
147
authenticationUserDetailsService .setUserDetailsService (userDetailsService );
143
148
return authenticationUserDetailsService (authenticationUserDetailsService );
@@ -152,6 +157,7 @@ public X509Configurer<H> userDetailsService(UserDetailsService userDetailsServic
152
157
*/
153
158
public X509Configurer <H > authenticationUserDetailsService (
154
159
AuthenticationUserDetailsService <PreAuthenticatedAuthenticationToken > authenticationUserDetailsService ) {
160
+ Assert .notNull (authenticationUserDetailsService , "authenticationUserDetailsService cannot be null" );
155
161
this .authenticationUserDetailsService = authenticationUserDetailsService ;
156
162
return this ;
157
163
}
0 commit comments