From 3f6d846af229fc0f48987a4eb583a8c2799972ce Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Thu, 21 Oct 2021 14:56:20 +0200 Subject: [PATCH] Simplify unnecessary flatMap in demo --- .../webauthn/InMemoryRegistrationStorage.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/webauthn-server-demo/src/main/java/demo/webauthn/InMemoryRegistrationStorage.java b/webauthn-server-demo/src/main/java/demo/webauthn/InMemoryRegistrationStorage.java index 4fefd3e31..72c99132f 100644 --- a/webauthn-server-demo/src/main/java/demo/webauthn/InMemoryRegistrationStorage.java +++ b/webauthn-server-demo/src/main/java/demo/webauthn/InMemoryRegistrationStorage.java @@ -94,15 +94,14 @@ public Optional lookup(ByteArray credentialId, ByteArray u credentialId, userHandle, registrationMaybe); - return registrationMaybe.flatMap( + return registrationMaybe.map( registration -> - Optional.of( - RegisteredCredential.builder() - .credentialId(registration.getCredential().getCredentialId()) - .userHandle(registration.getUserIdentity().getId()) - .publicKeyCose(registration.getCredential().getPublicKeyCose()) - .signatureCount(registration.getCredential().getSignatureCount()) - .build())); + RegisteredCredential.builder() + .credentialId(registration.getCredential().getCredentialId()) + .userHandle(registration.getUserIdentity().getId()) + .publicKeyCose(registration.getCredential().getPublicKeyCose()) + .signatureCount(registration.getCredential().getSignatureCount()) + .build()); } @Override