46
46
import org .springframework .security .web .webauthn .registration .PublicKeyCredentialCreationOptionsFilter ;
47
47
import org .springframework .security .web .webauthn .registration .PublicKeyCredentialCreationOptionsRepository ;
48
48
import org .springframework .security .web .webauthn .registration .WebAuthnRegistrationFilter ;
49
+ import org .springframework .util .Assert ;
49
50
50
51
/**
51
52
* Configures WebAuthn for Spring Security applications
@@ -75,6 +76,7 @@ public class WebAuthnConfigurer<H extends HttpSecurityBuilder<H>>
75
76
* @return the {@link WebAuthnConfigurer} for further customization
76
77
*/
77
78
public WebAuthnConfigurer <H > rpId (String rpId ) {
79
+ Assert .hasText (rpId , "rpId be null or empty" );
78
80
this .rpId = rpId ;
79
81
return this ;
80
82
}
@@ -85,6 +87,7 @@ public WebAuthnConfigurer<H> rpId(String rpId) {
85
87
* @return the {@link WebAuthnConfigurer} for further customization
86
88
*/
87
89
public WebAuthnConfigurer <H > rpName (String rpName ) {
90
+ Assert .hasText (rpName , "rpName can't be null or empty" );
88
91
this .rpName = rpName ;
89
92
return this ;
90
93
}
@@ -106,6 +109,7 @@ public WebAuthnConfigurer<H> allowedOrigins(String... allowedOrigins) {
106
109
* @see #allowedOrigins(String...)
107
110
*/
108
111
public WebAuthnConfigurer <H > allowedOrigins (Set <String > allowedOrigins ) {
112
+ Assert .notNull (allowedOrigins , "allowedOrigins can't be null" );
109
113
this .allowedOrigins = allowedOrigins ;
110
114
return this ;
111
115
}
@@ -129,6 +133,7 @@ public WebAuthnConfigurer<H> disableDefaultRegistrationPage(boolean disable) {
129
133
* @return the {@link WebAuthnConfigurer} for further customization
130
134
*/
131
135
public WebAuthnConfigurer <H > messageConverter (HttpMessageConverter <Object > converter ) {
136
+ Assert .notNull (converter , "converter can't be null" );
132
137
this .converter = converter ;
133
138
return this ;
134
139
}
@@ -140,6 +145,7 @@ public WebAuthnConfigurer<H> messageConverter(HttpMessageConverter<Object> conve
140
145
*/
141
146
public WebAuthnConfigurer <H > creationOptionsRepository (
142
147
PublicKeyCredentialCreationOptionsRepository creationOptionsRepository ) {
148
+ Assert .notNull (creationOptionsRepository , "creationOptionsRepository can't be null" );
143
149
this .creationOptionsRepository = creationOptionsRepository ;
144
150
return this ;
145
151
}
0 commit comments