Skip to content

Commit 66e614c

Browse files
franticticktickrwinch
authored andcommitted
WebAuthnConfigurer Code Cleanup
Signed-off-by: Max Batischev <[email protected]>
1 parent 421fcae commit 66e614c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/configurers/WebAuthnConfigurer.java

+5-9
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,8 @@ public WebAuthnConfigurer<H> creationOptionsRepository(
152152

153153
@Override
154154
public void configure(H http) throws Exception {
155-
UserDetailsService userDetailsService = getSharedOrBean(http, UserDetailsService.class).orElseGet(() -> {
156-
throw new IllegalStateException("Missing UserDetailsService Bean");
157-
});
155+
UserDetailsService userDetailsService = getSharedOrBean(http, UserDetailsService.class)
156+
.orElseThrow(() -> new IllegalStateException("Missing UserDetailsService Bean"));
158157
PublicKeyCredentialUserEntityRepository userEntities = getSharedOrBean(http,
159158
PublicKeyCredentialUserEntityRepository.class)
160159
.orElse(userEntityRepository());
@@ -244,12 +243,9 @@ private WebAuthnRelyingPartyOperations webAuthnRelyingPartyOperations(
244243
PublicKeyCredentialUserEntityRepository userEntities, UserCredentialRepository userCredentials) {
245244
Optional<WebAuthnRelyingPartyOperations> webauthnOperationsBean = getBeanOrNull(
246245
WebAuthnRelyingPartyOperations.class);
247-
if (webauthnOperationsBean.isPresent()) {
248-
return webauthnOperationsBean.get();
249-
}
250-
Webauthn4JRelyingPartyOperations result = new Webauthn4JRelyingPartyOperations(userEntities, userCredentials,
251-
PublicKeyCredentialRpEntity.builder().id(this.rpId).name(this.rpName).build(), this.allowedOrigins);
252-
return result;
246+
return webauthnOperationsBean.orElseGet(() -> new Webauthn4JRelyingPartyOperations(userEntities,
247+
userCredentials, PublicKeyCredentialRpEntity.builder().id(this.rpId).name(this.rpName).build(),
248+
this.allowedOrigins));
253249
}
254250

255251
}

0 commit comments

Comments
 (0)