[java-idp-plugin-webauthn] branch main updated: Rename CredentialRegistration to CredentialRecord
Phil Smart
philip.smart at jisc.ac.uk
Mon Oct 21 14:56:07 UTC 2024
This is an automated email from the git hooks/post-receive script.
philsmart pushed a commit to branch main
in repository java-idp-plugin-webauthn.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-webauthn.git;a=commit;h=c8b1219b16e259e31ac1ea1db7a5657787a5f4ed
The following commit(s) were added to refs/heads/main by this push:
new c8b1219 Rename CredentialRegistration to CredentialRecord
c8b1219 is described below
commit c8b1219b16e259e31ac1ea1db7a5657787a5f4ed
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Oct 21 15:56:04 2024 +0100
Rename CredentialRegistration to CredentialRecord
- This naming was confusing. A CredentialRegistration contains the
Yubico RegisteredCredential. So making it CredentialRecord helps to
distinguish between the record that is saved, and the actual public key
credential that is registered.
---
.../webauthn/context/BaseWebAuthnContext.java | 10 +--
.../context/WebAuthnAuthenticationContext.java | 16 ++---
.../context/WebAuthnManagementContext.java | 10 +--
.../authn/webauthn/policy/CredentialPolicy.java | 4 +-
...tialRegistration.java => CredentialRecord.java} | 22 +++---
...stration.java => EnhancedCredentialRecord.java} | 38 +++++-----
.../storage/WebAuthnCredentialRepository.java | 12 ++--
.../storage/CredentialRegistrationTest.java | 8 +--
.../admin/impl/DeletePublicKeyCredential.java | 4 +-
.../admin/impl/LookupCredentialsForUser.java | 12 ++--
.../admin/impl/StorePublicKeyCredential.java | 4 +-
.../authn/webauthn/impl/CheckCredentialPolicy.java | 4 +-
.../CreatePublicKeyCredentialRequestOptions.java | 4 +-
.../webauthn/impl/LookupRegisteredCredentials.java | 12 ++--
.../LookupRegisteredCredentialsFromUserHandle.java | 4 +-
.../authn/webauthn/impl/WebAuthnEncoder.java | 4 +-
.../policy/impl/AbstractCredentialPolicyRule.java | 12 ++--
.../policy/impl/ChainingCredentialPolicyRule.java | 4 +-
.../impl/FunctionalCredentialPolicyRule.java | 8 +--
.../impl/SecondFactorOnlyCredentialPolicyRule.java | 4 +-
.../impl/CredentialRegistrationSerializer.java | 12 ++--
.../IdPStorageServiceCredentialRespository.java | 74 +++++++++----------
...eatePublicKeyCredentialCreationOptionsTest.java | 6 +-
.../admin/impl/DeletePublicKeyCredentialTest.java | 4 +-
.../admin/impl/StorePublicKeyCredentialTest.java | 6 +-
.../YubicoWebauthnAuthenticationClientTest.java | 10 +--
.../webauthn/flow/AbstractWebAuthnFlowTest.java | 12 ++--
.../webauthn/flow/TestAdminManagementFlow.java | 6 +-
.../authn/webauthn/flow/TestPasswordlessFlow.java | 4 +-
.../authn/webauthn/flow/TestRegistrationFlow.java | 16 ++---
.../authn/webauthn/flow/TestSecondFactorFlow.java | 6 +-
.../authn/webauthn/flow/TestUsernameslessFlow.java | 24 +++----
.../flow/TestUsernameslessFlowWithPolicy.java | 4 +-
.../authn/webauthn/impl/AbstractWebAuthnTest.java | 8 +--
...kupRegisteredCredentialsFromUserHandleTest.java | 6 +-
.../impl/LookupRegisteredCredentialsTest.java | 6 +-
.../impl/ChainingCredentialPolicyRuleTest.java | 16 +++--
.../SecondFactorOnlyCredentialPolicyRuleTest.java | 4 +-
.../impl/CredentialRegistrationSerializerTest.java | 6 +-
...IdPStorageServiceCredentialRespositoryTest.java | 84 +++++++++++-----------
.../storage/impl/InMemoryRegistrationStorage.java | 30 ++++----
41 files changed, 271 insertions(+), 269 deletions(-)
diff --git a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/BaseWebAuthnContext.java b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/BaseWebAuthnContext.java
index 0e2d3ae..c2a2025 100644
--- a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/BaseWebAuthnContext.java
+++ b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/BaseWebAuthnContext.java
@@ -23,7 +23,7 @@ import org.opensaml.messaging.context.BaseContext;
import com.yubico.webauthn.data.UserVerificationRequirement;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRecord;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
@@ -50,7 +50,7 @@ public class BaseWebAuthnContext extends BaseContext {
* Credentials that have already been registered with the IdP. The authenticator should use these to avoid creating
* duplicate credentials during registration, or to tell the browser which credentials to use during authentication.
*/
- @Nullable private Collection<EnhancedCredentialRegistration> existingCredentials;
+ @Nullable private Collection<EnhancedCredentialRecord> existingCredentials;
/** The challenge sent to the authenticator in both registration and authentication ceremonies.*/
@Nullable private byte[] serverChallenge;
@@ -102,7 +102,7 @@ public class BaseWebAuthnContext extends BaseContext {
* @return this context
*/
@Nonnull public BaseWebAuthnContext setExistingCredentials(
- @Nullable final Collection<EnhancedCredentialRegistration> credentials) {
+ @Nullable final Collection<EnhancedCredentialRecord> credentials) {
existingCredentials = credentials;
return this;
}
@@ -112,8 +112,8 @@ public class BaseWebAuthnContext extends BaseContext {
*
* @return the existing credentials.
*/
- @Nonnull @Unmodifiable @NotLive public Collection<EnhancedCredentialRegistration> getExistingCredentials() {
- final Collection<EnhancedCredentialRegistration> localExistingCredentials = existingCredentials;
+ @Nonnull @Unmodifiable @NotLive public Collection<EnhancedCredentialRecord> getExistingCredentials() {
+ final Collection<EnhancedCredentialRecord> localExistingCredentials = existingCredentials;
if (localExistingCredentials == null) {
return CollectionSupport.emptyList();
}
diff --git a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnAuthenticationContext.java b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnAuthenticationContext.java
index 875c928..63dcaee 100644
--- a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnAuthenticationContext.java
+++ b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnAuthenticationContext.java
@@ -23,7 +23,7 @@ import com.yubico.webauthn.data.ClientAssertionExtensionOutputs;
import com.yubico.webauthn.data.PublicKeyCredential;
import com.yubico.webauthn.data.PublicKeyCredentialRequestOptions;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.logic.Constraint;
@@ -43,7 +43,7 @@ public final class WebAuthnAuthenticationContext extends BaseWebAuthnContext {
/** Are we operating in usernameless mode.*/
private boolean usernameless;
- /** A public key credential with assertion response that is the result of an authentication.*/
+ /** A public key credential with assertion response that is the result of authentication.*/
@Nullable
private PublicKeyCredential<AuthenticatorAssertionResponse, ClientAssertionExtensionOutputs>
publicKeyCredentialAssertionResponse;
@@ -51,8 +51,8 @@ public final class WebAuthnAuthenticationContext extends BaseWebAuthnContext {
/** The public key credential request options for generating an authentication assertion.*/
@Nullable private PublicKeyCredentialRequestOptions publicKeyCredentialRequestOptions;
- /** The authentication credential signalled by the authenticator.*/
- @Nullable private CredentialRegistration authenticationCredential;
+ /** The authentication credential as signalled by the authenticator.*/
+ @Nullable private CredentialRecord authenticationCredential;
/**
* Get the credential Id.
@@ -83,7 +83,7 @@ public final class WebAuthnAuthenticationContext extends BaseWebAuthnContext {
*
* @return this context
*/
- public WebAuthnAuthenticationContext setPublicKeyCredentialRequestOptions(
+ @Nonnull public WebAuthnAuthenticationContext setPublicKeyCredentialRequestOptions(
@Nullable final PublicKeyCredentialRequestOptions options) {
publicKeyCredentialRequestOptions = options;
return this;
@@ -106,7 +106,7 @@ public final class WebAuthnAuthenticationContext extends BaseWebAuthnContext {
*
* @return this context
*/
- public WebAuthnAuthenticationContext setPublicKeyCredentialAssertionResponse(
+ @Nonnull public WebAuthnAuthenticationContext setPublicKeyCredentialAssertionResponse(
@Nullable final PublicKeyCredential<AuthenticatorAssertionResponse, ClientAssertionExtensionOutputs>
pkCredAssertion) {
publicKeyCredentialAssertionResponse = pkCredAssertion;
@@ -194,7 +194,7 @@ public final class WebAuthnAuthenticationContext extends BaseWebAuthnContext {
* @return this context
*/
@Nonnull public WebAuthnAuthenticationContext setAuthenticationCredential(
- @Nullable final CredentialRegistration credential) {
+ @Nullable final CredentialRecord credential) {
authenticationCredential = credential;
return this;
}
@@ -204,7 +204,7 @@ public final class WebAuthnAuthenticationContext extends BaseWebAuthnContext {
*
* @return the authentication credential.
*/
- @Nullable public CredentialRegistration getAuthenticationCredential() {
+ @Nullable public CredentialRecord getAuthenticationCredential() {
return authenticationCredential;
}
diff --git a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnManagementContext.java b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnManagementContext.java
index 7b8ddaf..79e8d8e 100644
--- a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnManagementContext.java
+++ b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/context/WebAuthnManagementContext.java
@@ -21,7 +21,7 @@ import javax.annotation.Nullable;
import org.opensaml.messaging.context.BaseContext;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRecord;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
@@ -38,7 +38,7 @@ public class WebAuthnManagementContext extends BaseContext {
@Nullable private String searchUsername;
/** The located set of credentials registered for the given searchUsername.*/
- @Nullable @Unmodifiable @NotLive private Collection<EnhancedCredentialRegistration> foundCredentials;
+ @Nullable @Unmodifiable @NotLive private Collection<EnhancedCredentialRecord> foundCredentials;
/** The ID of a credential that is going to be removed.*/
@Nullable private byte[] credentialIdToRemove;
@@ -95,7 +95,7 @@ public class WebAuthnManagementContext extends BaseContext {
* @return this context
*/
@Nonnull public WebAuthnManagementContext setFoundCredentials(
- @Nullable final Collection<EnhancedCredentialRegistration> credentials) {
+ @Nullable final Collection<EnhancedCredentialRecord> credentials) {
if (credentials == null) {
foundCredentials = CollectionSupport.emptyList();
} else {
@@ -109,8 +109,8 @@ public class WebAuthnManagementContext extends BaseContext {
*
* @return the credentials.
*/
- @Nonnull @Unmodifiable @NotLive public Collection<EnhancedCredentialRegistration> getFoundCredentials() {
- final Collection<EnhancedCredentialRegistration> localFoundCredentials = foundCredentials;
+ @Nonnull @Unmodifiable @NotLive public Collection<EnhancedCredentialRecord> getFoundCredentials() {
+ final Collection<EnhancedCredentialRecord> localFoundCredentials = foundCredentials;
if (localFoundCredentials == null) {
return CollectionSupport.emptyList();
}
diff --git a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/CredentialPolicy.java b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/CredentialPolicy.java
index 478af5c..3c37cf4 100644
--- a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/CredentialPolicy.java
+++ b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/CredentialPolicy.java
@@ -18,7 +18,7 @@ import javax.annotation.Nonnull;
import org.opensaml.profile.context.ProfileRequestContext;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.component.IdentifiedComponent;
/**
@@ -57,7 +57,7 @@ public interface CredentialPolicy extends IdentifiedComponent {
* @return {@link CredentialPolicyOutcome#ACCEPT} if allowed, {@link CredentialPolicyOutcome#REJECT} if rejected,
* and {@link CredentialPolicyOutcome#IGNORE} otherwise.
*/
- CredentialPolicyOutcome evaluate(@Nonnull final CredentialRegistration credential,
+ CredentialPolicyOutcome evaluate(@Nonnull final CredentialRecord credential,
@Nonnull final ProfileRequestContext prc);
}
diff --git a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRegistration.java b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRecord.java
similarity index 96%
rename from webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRegistration.java
rename to webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRecord.java
index 05fba1f..a84896a 100644
--- a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRegistration.java
+++ b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRecord.java
@@ -43,14 +43,14 @@ import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
/**
- * Registration record used to hold registered credentials.
+ * A credential registration record used to hold registered credentials.
*
* <p>Equality is determined by comparing the wrapped {@link RegisteredCredential credential}.</p>
*/
@ThreadSafe
@Immutable
- at JsonDeserialize(builder = CredentialRegistration.Builder.class)
-public final class CredentialRegistration {
+ at JsonDeserialize(builder = CredentialRecord.Builder.class)
+public final class CredentialRecord {
/** The users identity. */
@Nonnull private final UserIdentity userIdentity;
@@ -94,7 +94,7 @@ public final class CredentialRegistration {
*
* @param builder the builder
*/
- private CredentialRegistration(final Builder builder) {
+ private CredentialRecord(final Builder builder) {
this.userIdentity = builder.userIdentity;
this.username = builder.username;
this.transports = builder.transports;
@@ -278,7 +278,7 @@ public final class CredentialRegistration {
if (getClass() != obj.getClass()) {
return false;
}
- final CredentialRegistration other = (CredentialRegistration) obj;
+ final CredentialRecord other = (CredentialRecord) obj;
return Objects.equals(credential, other.credential);
}
@@ -288,11 +288,11 @@ public final class CredentialRegistration {
*
* @param newRegisteredCred the new credential
*
- * @return a new {@link CredentialRegistration} instance
+ * @return a new {@link CredentialRecord} instance
*/
@JsonIgnore
- public CredentialRegistration withCredential(@Nonnull final RegisteredCredential newRegisteredCred) {
- return CredentialRegistration.builder()
+ public CredentialRecord withCredential(@Nonnull final RegisteredCredential newRegisteredCred) {
+ return CredentialRecord.builder()
.withUserIdentity(userIdentity)
.withUsername(username)
.withTransports(transports)
@@ -415,7 +415,7 @@ public final class CredentialRegistration {
* Build this credential registration.
* @return a credential registration
*/
- @Nonnull public CredentialRegistration build();
+ @Nonnull public CredentialRecord build();
}
/** Builder.*/
@@ -519,8 +519,8 @@ public final class CredentialRegistration {
}
@Override
- @Nonnull public CredentialRegistration build() {
- return new CredentialRegistration(this);
+ @Nonnull public CredentialRecord build() {
+ return new CredentialRecord(this);
}
@Override
diff --git a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/EnhancedCredentialRegistration.java b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/EnhancedCredentialRecord.java
similarity index 85%
rename from webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/EnhancedCredentialRegistration.java
rename to webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/EnhancedCredentialRecord.java
index 1437df2..2206abc 100644
--- a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/EnhancedCredentialRegistration.java
+++ b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/EnhancedCredentialRecord.java
@@ -33,13 +33,13 @@ import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
/**
- * An ephemeral wrapper class that holds a {@link CredentialRegistration} and any associated metadata. Created and
+ * An ephemeral wrapper class that holds a {@link CredentialRecord} and any associated metadata. Created and
* used during registration or authentication and then discarded. This is not meant to be serialised or stored.
*/
-public final class EnhancedCredentialRegistration {
+public final class EnhancedCredentialRecord {
/** The wrapped credential registration.*/
- @Nonnull private final CredentialRegistration credentialRegistration;
+ @Nonnull private final CredentialRecord credentialRegistration;
/** Optional metadata about the authenticator. Will be an empty set if not used. */
@Nonnull @Unmodifiable @NonnullElements @NotLive private final Set<MetadataBLOBPayloadEntry> authenticatorMetadata;
@@ -56,18 +56,18 @@ public final class EnhancedCredentialRegistration {
*
* @param builder the builder to construct this instance from
*/
- private EnhancedCredentialRegistration(final Builder builder) {
- this.credentialRegistration = builder.credentialRegistration;
+ private EnhancedCredentialRecord(final Builder builder) {
+ this.credentialRegistration = builder.credentialRecord;
this.authenticatorMetadata = builder.authenticatorMetadata;
this.aaguidMetadata = builder.aaguidMetadata;
}
/**
- * Get the wrapped credential registration.
+ * Get the wrapped credential record.
*
- * @return the wrapped credentialRegistration.
+ * @return the wrapped credential record.
*/
- public CredentialRegistration getCredentialRegistration() {
+ public CredentialRecord getCredentialRegistration() {
return credentialRegistration;
}
@@ -148,13 +148,13 @@ public final class EnhancedCredentialRegistration {
*/
public interface ICredentialRegistrationStage {
/**
- * Set the credential registration.
+ * Set the credential record.
*
- * @param credentialRegistration the registration
+ * @param credentialRecord the record
*
* @return the next stage
*/
- public IBuildStage withCredentialRegistration(@Nonnull final CredentialRegistration credentialRegistration);
+ public IBuildStage withCredentialRecord(@Nonnull final CredentialRecord credentialRecord);
}
/**
@@ -187,15 +187,15 @@ public final class EnhancedCredentialRegistration {
*
* @return an instance of this object
*/
- public EnhancedCredentialRegistration build();
+ public EnhancedCredentialRecord build();
}
/**
* The builder.
*/
public static final class Builder implements ICredentialRegistrationStage, IBuildStage {
- /** The wrapped credential registration.*/
- @NonnullAfterInit private CredentialRegistration credentialRegistration;
+ /** The wrapped credential record.*/
+ @NonnullAfterInit private CredentialRecord credentialRecord;
/** Optional metadata about the authenticator. Will be an empty set if not used. */
@Nonnull @Unmodifiable @NonnullElements @NotLive
private Set<MetadataBLOBPayloadEntry> authenticatorMetadata;
@@ -211,9 +211,9 @@ public final class EnhancedCredentialRegistration {
}
@Override
- public IBuildStage withCredentialRegistration(
- @Nonnull final CredentialRegistration registration) {
- credentialRegistration = Constraint.isNotNull(registration, "Registration can not be null");
+ public IBuildStage withCredentialRecord(
+ @Nonnull final CredentialRecord record) {
+ credentialRecord = Constraint.isNotNull(record, "Credential record can not be null");
return this;
}
@@ -235,8 +235,8 @@ public final class EnhancedCredentialRegistration {
}
@Override
- public EnhancedCredentialRegistration build() {
- return new EnhancedCredentialRegistration(this);
+ public EnhancedCredentialRecord build() {
+ return new EnhancedCredentialRecord(this);
}
}
diff --git a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/WebAuthnCredentialRepository.java b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/WebAuthnCredentialRepository.java
index e85faf9..15d5f9f 100644
--- a/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/WebAuthnCredentialRepository.java
+++ b/webauthn-api/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/WebAuthnCredentialRepository.java
@@ -44,7 +44,7 @@ public interface WebAuthnCredentialRepository extends CredentialRepository {
* @return the set of registered credentials associated to the user
*/
@Nonnull @NonnullElements @NotLive
- Set<CredentialRegistration> getRegistrationsByUsername(@Nonnull final String username);
+ Set<CredentialRecord> getRegistrationsByUsername(@Nonnull final String username);
/**
* Add a new credential registration for a given user, by their username.
@@ -54,7 +54,7 @@ public interface WebAuthnCredentialRepository extends CredentialRepository {
*
* @return true iff the registration was added. False otherwise.
*/
- boolean addRegistrationByUsername(@Nonnull final String username, @Nonnull final CredentialRegistration credential);
+ boolean addRegistrationByUsername(@Nonnull final String username, @Nonnull final CredentialRecord credential);
/**
* Update the signature counter of the credential that belongs to the given user.
@@ -77,7 +77,7 @@ public interface WebAuthnCredentialRepository extends CredentialRepository {
*
* @return the credential if found, otherwise an empty {@link Optional}.
*/
- @Nonnull Optional<CredentialRegistration> getRegistrationByUsernameAndCredentialId(@Nonnull final String username,
+ @Nonnull Optional<CredentialRecord> getRegistrationByUsernameAndCredentialId(@Nonnull final String username,
@Nonnull final ByteArray credentialId);
@@ -89,7 +89,7 @@ public interface WebAuthnCredentialRepository extends CredentialRepository {
*
* @return the credential registration if found.
*/
- Optional<CredentialRegistration> getRegistrationByUserHandleAndCredentialId(@Nonnull final ByteArray credentialId,
+ Optional<CredentialRecord> getRegistrationByUserHandleAndCredentialId(@Nonnull final ByteArray credentialId,
@Nonnull final ByteArray userHandle);
/**
@@ -101,7 +101,7 @@ public interface WebAuthnCredentialRepository extends CredentialRepository {
* @return true iff the credential was removed, false otherwise.
*/
boolean removeRegistrationByUsername(@Nonnull final String username,
- @Nonnull final CredentialRegistration credentialRegistration);
+ @Nonnull final CredentialRecord credentialRegistration);
/**
@@ -122,7 +122,7 @@ public interface WebAuthnCredentialRepository extends CredentialRepository {
*
* @return all credential registrations known to the system.
*/
- @Nonnull @NotLive @Unmodifiable Set<CredentialRegistration> getAllRegistrations();
+ @Nonnull @NotLive @Unmodifiable Set<CredentialRecord> getAllRegistrations();
/**
* Remove the credential with the given credential Id for the given user.
diff --git a/webauthn-api/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRegistrationTest.java b/webauthn-api/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRegistrationTest.java
index 5ec41e9..835f8e7 100644
--- a/webauthn-api/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRegistrationTest.java
+++ b/webauthn-api/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/CredentialRegistrationTest.java
@@ -26,16 +26,16 @@ import com.yubico.webauthn.data.UserIdentity;
import net.shibboleth.shared.logic.ConstraintViolationException;
/**
- * Tests for {@link CredentialRegistration}
+ * Tests for {@link CredentialRecord}
*/
public class CredentialRegistrationTest {
- private CredentialRegistration credReg;
+ private CredentialRecord credReg;
@SuppressWarnings("null")
@Test(expectedExceptions = ConstraintViolationException.class)
public void testCredentialRegistrationBuilder_NullIdentity() {
- CredentialRegistration.builder()
+ CredentialRecord.builder()
.withUserIdentity(null)
.withUsername(null)
.withTransports(new TreeSet<AuthenticatorTransport>())
@@ -46,7 +46,7 @@ public class CredentialRegistrationTest {
@SuppressWarnings("null")
@Test(expectedExceptions = ConstraintViolationException.class)
public void testCredentialRegistrationBuilder_NullCredential() {
- CredentialRegistration.builder()
+ CredentialRecord.builder()
.withUserIdentity(UserIdentity.builder().name("test")
.displayName("person")
.id(ByteArray.fromBase64("OjdT61K6rono3rZCXCRnSQ=="))
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java
index b3065fe..269f42a 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredential.java
@@ -29,7 +29,7 @@ import com.yubico.webauthn.data.ByteArray;
import net.shibboleth.idp.plugin.authn.webauthn.admin.WebAuthnRegistrationEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.audit.impl.AbstractWebAuthnAuditingAction;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.storage.WebAuthnCredentialRepository;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.codec.Base64Support;
@@ -89,7 +89,7 @@ public class DeletePublicKeyCredential extends AbstractWebAuthnAuditingAction<We
return;
}
- final Optional<CredentialRegistration> credential =
+ final Optional<CredentialRecord> credential =
repository.getRegistrationByUsernameAndCredentialId(
username, new ByteArray(credentialId));
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/LookupCredentialsForUser.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/LookupCredentialsForUser.java
index a30626a..530841e 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/LookupCredentialsForUser.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/LookupCredentialsForUser.java
@@ -30,9 +30,9 @@ import com.yubico.webauthn.data.ByteArray;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnManagementContext;
import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnAction;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRegistration;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRegistration.IBuildStage;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRecord;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRecord.IBuildStage;
import net.shibboleth.idp.plugin.authn.webauthn.storage.WebAuthnCredentialRepository;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.collection.CollectionSupport;
@@ -83,15 +83,15 @@ public class LookupCredentialsForUser extends AbstractWebAuthnAction<WebAuthnMan
} else {
log.trace("{} Finding registered credentials for '{}'",getLogPrefix(), userToSearchFor);
assert userToSearchFor != null;
- final Collection<CredentialRegistration> credentials =
+ final Collection<CredentialRecord> credentials =
repository.getRegistrationsByUsername(userToSearchFor);
log.debug("{} Found '{}' credentials", getLogPrefix(), credentials.size());
- final Collection<EnhancedCredentialRegistration> enhancedCredentialRegistrations =
+ final Collection<EnhancedCredentialRecord> enhancedCredentialRegistrations =
new HashSet<>(credentials.size());
credentials.stream().filter(Objects::nonNull).forEach(cred -> {
- final IBuildStage builder = EnhancedCredentialRegistration.builder().withCredentialRegistration(cred);
+ final IBuildStage builder = EnhancedCredentialRecord.builder().withCredentialRecord(cred);
final byte[] aaguid = cred.getAaguid();
if (aaguid != null && aaguid.length == 16) {
builder.withAuthenticatorMetadata(getAuthenticatorMetadata(new ByteArray(aaguid)));
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java
index 22a5447..88ef6ed 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredential.java
@@ -34,7 +34,7 @@ import net.shibboleth.idp.plugin.authn.webauthn.admin.RegistrationResult;
import net.shibboleth.idp.plugin.authn.webauthn.admin.WebAuthnRegistrationEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.audit.impl.AbstractWebAuthnAuditingAction;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.storage.WebAuthnCredentialRepository;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.codec.Base64Support;
@@ -132,7 +132,7 @@ public class StorePublicKeyCredential extends AbstractWebAuthnAuditingAction<Web
final Optional<Boolean> isDiscoverable = registrationResult.isDiscoverable();
final ByteArray aaguid = registrationResult.getAaguid();
- final CredentialRegistration registration = CredentialRegistration.builder()
+ final CredentialRecord registration = CredentialRecord.builder()
.withUserIdentity(user)
.withUsername(username)
.withTransports(registrationResult.getKeyId().getTransports().orElse(new TreeSet<>()))
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CheckCredentialPolicy.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CheckCredentialPolicy.java
index 2d287ec..bd4cc23 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CheckCredentialPolicy.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CheckCredentialPolicy.java
@@ -36,7 +36,7 @@ import net.shibboleth.idp.plugin.authn.webauthn.authn.WebAuthnAuthenticationEven
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.policy.CredentialPolicy;
import net.shibboleth.idp.plugin.authn.webauthn.policy.CredentialPolicy.CredentialPolicyOutcome;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.storage.WebAuthnCredentialRepository;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NonnullBeforeExec;
@@ -139,7 +139,7 @@ public class CheckCredentialPolicy extends AbstractWebAuthnAction<WebAuthnAuthen
return;
}
- final Optional<CredentialRegistration> credential =
+ final Optional<CredentialRecord> credential =
repository.getRegistrationByUserHandleAndCredentialId(assertion.getId(), userHandle.get());
if (credential.isEmpty()) {
log.trace("{} UserHandle '{}' has no registered credential",getLogPrefix(), userHandle.get().getHex());
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java
index 14683cd..72cc0b9 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/CreatePublicKeyCredentialRequestOptions.java
@@ -37,7 +37,7 @@ import net.shibboleth.idp.plugin.authn.webauthn.authn.CredentialRequestOptionsPa
import net.shibboleth.idp.plugin.authn.webauthn.client.WebAuthnAuthenticationClient;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.exception.WebAuthnAuthenticationClientException;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRecord;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.primitive.LoggerFactory;
@@ -79,7 +79,7 @@ public class CreatePublicKeyCredentialRequestOptions extends AbstractWebAuthnAct
}
try {
- final Collection<EnhancedCredentialRegistration> existingCredentials = context.getExistingCredentials();
+ final Collection<EnhancedCredentialRecord> existingCredentials = context.getExistingCredentials();
final List<PublicKeyCredentialDescriptor> existingCredentialDescriptors = existingCredentials.stream()
.map(cred -> cred.getCredentialRegistration())
.map(cred -> cred.toPublicKeyCredentialDescriptor())
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentials.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentials.java
index 745c3ca..284c620 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentials.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentials.java
@@ -35,9 +35,9 @@ import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.authn.WebAuthnAuthenticationEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.context.BaseWebAuthnContext;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRegistration;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRegistration.IBuildStage;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRecord;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRecord.IBuildStage;
import net.shibboleth.idp.plugin.authn.webauthn.storage.WebAuthnCredentialRepository;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
@@ -170,16 +170,16 @@ public class LookupRegisteredCredentials extends AbstractWebAuthnAction<BaseWebA
return;
}
- final Collection<CredentialRegistration> credentials =
+ final Collection<CredentialRecord> credentials =
repository.getRegistrationsByUsername(username);
log.debug("{} Found '{}' registered credentials for '{}'", getLogPrefix(), credentials.size(), username);
- final Collection<EnhancedCredentialRegistration> enhancedCredentialRegistrations =
+ final Collection<EnhancedCredentialRecord> enhancedCredentialRegistrations =
new HashSet<>(credentials.size());
credentials.stream().filter(Objects::nonNull).forEach(cred -> {
- final IBuildStage builder = EnhancedCredentialRegistration.builder().withCredentialRegistration(cred);
+ final IBuildStage builder = EnhancedCredentialRecord.builder().withCredentialRecord(cred);
if (cred.getAaguid() != null) {
builder.withAuthenticatorMetadata(getAuthenticatorMetadata(new ByteArray(cred.getAaguid())));
builder.withAaguidMetadata(getAaguidMetadata(new AAGUID(new ByteArray(cred.getAaguid()))));
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsFromUserHandle.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsFromUserHandle.java
index 96ff730..d17e8d4 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsFromUserHandle.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsFromUserHandle.java
@@ -35,7 +35,7 @@ import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.authn.WebAuthnAuthenticationEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.storage.WebAuthnCredentialRepository;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
@@ -157,7 +157,7 @@ public class LookupRegisteredCredentialsFromUserHandle extends AbstractWebAuthnA
return;
}
- final Collection<CredentialRegistration> credentials =
+ final Collection<CredentialRecord> credentials =
repository.getRegistrationsByUsername(potentialUsername.get());
if (credentials.isEmpty()) {
log.debug("{} Could not find any registered credentials for userHandle '{}'", getLogPrefix(),
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/WebAuthnEncoder.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/WebAuthnEncoder.java
index 79f165d..7bfda9d 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/WebAuthnEncoder.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/impl/WebAuthnEncoder.java
@@ -32,7 +32,7 @@ import com.yubico.webauthn.data.AuthenticatorTransport;
import com.yubico.webauthn.data.PublicKeyCredentialCreationOptions;
import com.yubico.webauthn.data.PublicKeyCredentialRequestOptions;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRecord;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.primitive.LoggerFactory;
@@ -136,7 +136,7 @@ public final class WebAuthnEncoder {
* @param cred the credential to check
* @return true if the credential has metadata, false otherwise.
*/
- public static boolean isAuthenticatorMetadataAttached(final EnhancedCredentialRegistration cred) {
+ public static boolean isAuthenticatorMetadataAttached(final EnhancedCredentialRecord cred) {
if (cred == null) {
return false;
}
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/AbstractCredentialPolicyRule.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/AbstractCredentialPolicyRule.java
index 605b34b..5b06b99 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/AbstractCredentialPolicyRule.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/AbstractCredentialPolicyRule.java
@@ -29,7 +29,7 @@ import com.yubico.fido.metadata.FidoMetadataService;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.policy.CredentialPolicy;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.annotation.constraint.ThreadSafeAfterInit;
import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
import net.shibboleth.shared.logic.Constraint;
@@ -54,7 +54,7 @@ public abstract class AbstractCredentialPolicyRule extends AbstractIdentifiableI
@Nullable private FidoMetadataService fidoMetadataService;
/** Does this policy rule apply? Default is true. */
- @Nonnull private BiPredicate<CredentialRegistration, ProfileRequestContext> activationCondition;
+ @Nonnull private BiPredicate<CredentialRecord, ProfileRequestContext> activationCondition;
/** Lookup strategy to locate the WebAuthn context. */
@Nonnull private Function<ProfileRequestContext,WebAuthnAuthenticationContext> webauthnContextLookupStrategy;
@@ -87,7 +87,7 @@ public abstract class AbstractCredentialPolicyRule extends AbstractIdentifiableI
* @param condition condition to set
*/
public void setActivationConditionStrategy(
- @Nonnull final BiPredicate<CredentialRegistration, ProfileRequestContext> condition) {
+ @Nonnull final BiPredicate<CredentialRecord, ProfileRequestContext> condition) {
checkSetterPreconditions();
activationCondition = Constraint.isNotNull(condition, "Activation condition cannot be null");
}
@@ -130,7 +130,7 @@ public abstract class AbstractCredentialPolicyRule extends AbstractIdentifiableI
*/
@Override
public CredentialPolicyOutcome evaluate(
- @Nonnull final CredentialRegistration credential, @Nonnull final ProfileRequestContext prc) {
+ @Nonnull final CredentialRecord credential, @Nonnull final ProfileRequestContext prc) {
if (!activationCondition.test(credential, prc)) {
//not active for this request
log.trace("CredentialPolicy rule '{}' not active for this request", getId());
@@ -146,14 +146,14 @@ public abstract class AbstractCredentialPolicyRule extends AbstractIdentifiableI
/**
* Execute the policy. Implementations should override this method.
*
- * @param credential the credential the check the policy rules for
+ * @param credential the credential to check the policy rules for
* @param prc the profile request context
* @param webAuthnContext the WebAuthn authentication context
*
* @return the credential policy outcome
*/
protected abstract CredentialPolicyOutcome doEvaluate(
- @Nonnull final CredentialRegistration credential, @Nonnull final ProfileRequestContext prc,
+ @Nonnull final CredentialRecord credential, @Nonnull final ProfileRequestContext prc,
@Nonnull final WebAuthnAuthenticationContext webAuthnContext);
}
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/ChainingCredentialPolicyRule.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/ChainingCredentialPolicyRule.java
index faf6e32..1a8b8dd 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/ChainingCredentialPolicyRule.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/ChainingCredentialPolicyRule.java
@@ -24,7 +24,7 @@ import org.slf4j.Logger;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.policy.CredentialPolicy;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.primitive.LoggerFactory;
@@ -69,7 +69,7 @@ public class ChainingCredentialPolicyRule extends AbstractCredentialPolicyRule {
/** {@inheritDoc} */
@Override
protected CredentialPolicyOutcome doEvaluate(
- @Nonnull final CredentialRegistration credential, @Nonnull final ProfileRequestContext prc,
+ @Nonnull final CredentialRecord credential, @Nonnull final ProfileRequestContext prc,
@Nonnull final WebAuthnAuthenticationContext webAuthnContext) {
for (final CredentialPolicy policy : credentialPolicyChain) {
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/FunctionalCredentialPolicyRule.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/FunctionalCredentialPolicyRule.java
index 2f1786a..f81b026 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/FunctionalCredentialPolicyRule.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/FunctionalCredentialPolicyRule.java
@@ -22,7 +22,7 @@ import org.slf4j.Logger;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.policy.CredentialPolicy;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.LoggerFactory;
@@ -36,7 +36,7 @@ public class FunctionalCredentialPolicyRule extends AbstractCredentialPolicyRule
@Nonnull private final Logger log = LoggerFactory.getLogger(FunctionalCredentialPolicyRule.class);
/** The function to run. By default this returns {@link CredentialPolicyOutcome#IGNORE}.*/
- @Nonnull private BiFunction<CredentialRegistration, FunctionalRuleContext, CredentialPolicyOutcome> rule;
+ @Nonnull private BiFunction<CredentialRecord, FunctionalRuleContext, CredentialPolicyOutcome> rule;
/** Constructor.*/
public FunctionalCredentialPolicyRule() {
@@ -49,14 +49,14 @@ public class FunctionalCredentialPolicyRule extends AbstractCredentialPolicyRule
* @param function the rule to set.
*/
public void setRule(@Nonnull
- final BiFunction<CredentialRegistration, FunctionalRuleContext, CredentialPolicyOutcome> function) {
+ final BiFunction<CredentialRecord, FunctionalRuleContext, CredentialPolicyOutcome> function) {
checkSetterPreconditions();
rule = Constraint.isNotNull(function, "Rule function can not be null");
}
/** {@inheritDoc} */
@Override
- protected CredentialPolicyOutcome doEvaluate(final CredentialRegistration credential,
+ protected CredentialPolicyOutcome doEvaluate(final CredentialRecord credential,
final ProfileRequestContext prc, final WebAuthnAuthenticationContext webAuthnContext) {
log.debug("Running CredentialPolicy rule function '{}'", this.getId());
return rule.apply(credential, new FunctionalRuleContext(prc, getFidoMetadataService()));
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/SecondFactorOnlyCredentialPolicyRule.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/SecondFactorOnlyCredentialPolicyRule.java
index 99b917f..266a016 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/SecondFactorOnlyCredentialPolicyRule.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/SecondFactorOnlyCredentialPolicyRule.java
@@ -24,7 +24,7 @@ import org.slf4j.Logger;
import net.shibboleth.idp.plugin.authn.webauthn.admin.policy.impl.SecondFactorOnlyAuthenticatorInspector;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.policy.CredentialPolicy;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.codec.Base64Support;
import net.shibboleth.shared.codec.EncodingException;
import net.shibboleth.shared.primitive.LoggerFactory;
@@ -41,7 +41,7 @@ public class SecondFactorOnlyCredentialPolicyRule extends AbstractCredentialPoli
/** {@inheritDoc} */
@Override
public CredentialPolicyOutcome doEvaluate(
- @Nonnull final CredentialRegistration credential, @Nonnull final ProfileRequestContext prc,
+ @Nonnull final CredentialRecord credential, @Nonnull final ProfileRequestContext prc,
@Nonnull final WebAuthnAuthenticationContext webAuthnContext) {
final Map<String,String> capabilities = credential.getAuthenticatorCapabilities();
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/CredentialRegistrationSerializer.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/CredentialRegistrationSerializer.java
index 594cbaf..1a04a4f 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/CredentialRegistrationSerializer.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/CredentialRegistrationSerializer.java
@@ -30,7 +30,7 @@ import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.collection.CollectionSupport;
@@ -41,7 +41,7 @@ import net.shibboleth.shared.component.AbstractInitializableComponent;
* Serialize the WebauthnPublicKeyCredentialRecord to a string using Hex encoding.
*/
public class CredentialRegistrationSerializer extends AbstractInitializableComponent
- implements StorageSerializer<Set<CredentialRegistration>> {
+ implements StorageSerializer<Set<CredentialRecord>> {
/** The CBOR friendly json mapper.*/
private final ObjectMapper jsonMapper;
@@ -58,7 +58,7 @@ public class CredentialRegistrationSerializer extends AbstractInitializableCompo
}
@Override
- public String serialize(final Set<CredentialRegistration> instance) throws IOException {
+ public String serialize(final Set<CredentialRecord> instance) throws IOException {
checkComponentActive();
final String valueAsString = jsonMapper.writeValueAsString(instance);
if (valueAsString == null) {
@@ -69,13 +69,13 @@ public class CredentialRegistrationSerializer extends AbstractInitializableCompo
@Override
@Nonnull @Unmodifiable @NotLive
- public Set<CredentialRegistration> deserialize(final long version, final String context, final String key,
+ public Set<CredentialRecord> deserialize(final long version, final String context, final String key,
final String value, final Long expiration) throws IOException {
checkComponentActive();
try {
//TODO the other properties?
- final Set<CredentialRegistration> registrations =
- jsonMapper.readValue(value, new TypeReference<Set<CredentialRegistration>>() {});
+ final Set<CredentialRecord> registrations =
+ jsonMapper.readValue(value, new TypeReference<Set<CredentialRecord>>() {});
if (registrations == null) {
// Unlikely it gets here
throw new IOException("Unable to read credential registrations");
diff --git a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespository.java b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespository.java
index 7250576..e03852e 100644
--- a/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespository.java
+++ b/webauthn-impl/src/main/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespository.java
@@ -43,7 +43,7 @@ import com.yubico.webauthn.data.ByteArray;
import com.yubico.webauthn.data.PublicKeyCredentialDescriptor;
import net.shibboleth.idp.plugin.authn.webauthn.exception.CredentialRepositoryException;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.storage.WebAuthnCredentialRepository;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
@@ -61,7 +61,7 @@ import net.shibboleth.shared.primitive.LoggerFactory;
* A {@link CredentialRepository} adaptor for the Shibboleth {@link StorageService}.
*
* <p>The IdP username (which might have been canonicalized by this point) is used as the key to the storage context.
- * The object to store (value of the storage record) is a set of {@link CredentialRegistration registered credentials}.
+ * The object to store (value of the storage record) is a set of {@link CredentialRecord registered credentials}.
* Storage records do not expire.</p>
*
* <p>Note, any exception is wrapped in an unchecked {@link CredentialRepositoryException}. If the caller does not deem
@@ -80,7 +80,7 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
@Nonnull private final Logger log = LoggerFactory.getLogger(IdPStorageServiceCredentialRespository.class);
/** Storage record serializer. */
- @NonnullAfterInit private StorageSerializer<Set<CredentialRegistration>> serializer;
+ @NonnullAfterInit private StorageSerializer<Set<CredentialRecord>> serializer;
/** The composed storage Service.*/
@NonnullAfterInit private EnumeratableStorageService storageService;
@@ -118,11 +118,11 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
}
/**
- * Set the storage service serializer to handle {@link CredentialRegistration}s.
+ * Set the storage service serializer to handle {@link CredentialRecord}s.
*
* @param storageSerializer the serializer to set.
*/
- public void setSerializer(@Nonnull final StorageSerializer<Set<CredentialRegistration>> storageSerializer) {
+ public void setSerializer(@Nonnull final StorageSerializer<Set<CredentialRecord>> storageSerializer) {
checkSetterPreconditions();
serializer = Constraint.isNotNull(storageSerializer, "serializer can not be null");
}
@@ -189,7 +189,7 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
final Lock readLock = lock.readLock();
try {
readLock.lock();
- return getRegistrationsByUserHandle(userHandle).stream().findAny().map(CredentialRegistration::getUsername);
+ return getRegistrationsByUserHandle(userHandle).stream().findAny().map(CredentialRecord::getUsername);
} finally {
readLock.unlock();
}
@@ -218,17 +218,17 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
*
* @return registrations that match that userHandle from any user.
*/
- private Collection<CredentialRegistration> getRegistrationsByUserHandle(final ByteArray userHandle) {
+ private Collection<CredentialRecord> getRegistrationsByUserHandle(final ByteArray userHandle) {
checkComponentActive();
final Lock readLock = lock.readLock();
try {
readLock.lock();
- final Set<CredentialRegistration> foundCredentials = new HashSet<>();
+ final Set<CredentialRecord> foundCredentials = new HashSet<>();
for (final Iterator<String> i = storageService.getContextKeys(STORAGE_CONTEXT, null).iterator();
i.hasNext();) {
final String usernameKey = i.next();
assert usernameKey != null;
- final Set<CredentialRegistration> foundCredentialsForUser =
+ final Set<CredentialRecord> foundCredentialsForUser =
getRegistrationsByUsername(usernameKey)
.stream()
.filter(cred -> userHandle.equals(cred.getUserIdentity().getId()))
@@ -259,7 +259,7 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
getRegistrationsByUsername(usernameKey)
.stream()
.filter(reg -> reg.getCredential().getCredentialId().equals(credentialId))
- .map(CredentialRegistration::getCredential)
+ .map(CredentialRecord::getCredential)
.collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableSet())).get();
foundCredentials.addAll(foundCredentialsForUser);
}
@@ -273,12 +273,12 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
/** {@inheritDoc} */
@Override
- @Nonnull public Set<CredentialRegistration> getRegistrationsByUsername(final String username) {
+ @Nonnull public Set<CredentialRecord> getRegistrationsByUsername(final String username) {
checkComponentActive();
final Lock readLock = lock.readLock();
try {
readLock.lock();
- final StorageRecord<Set<CredentialRegistration>> registration =
+ final StorageRecord<Set<CredentialRecord>> registration =
storageService.read(STORAGE_CONTEXT, username);
if (registration != null) {
return registration.getValue(serializer, STORAGE_CONTEXT, username);
@@ -293,14 +293,14 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
/** {@inheritDoc} */
@Override
- @Nonnull public Optional<CredentialRegistration> getRegistrationByUsernameAndCredentialId(
+ @Nonnull public Optional<CredentialRecord> getRegistrationByUsernameAndCredentialId(
final String username, final ByteArray id) {
checkComponentActive();
final Lock readLock = lock.readLock();
try {
readLock.lock();
- final Set<CredentialRegistration> existingRegistrations = getRegistrationsByUsername(username);
- final Optional<CredentialRegistration> registration = existingRegistrations.stream()
+ final Set<CredentialRecord> existingRegistrations = getRegistrationsByUsername(username);
+ final Optional<CredentialRecord> registration = existingRegistrations.stream()
.filter(credReg -> id.equals(credReg.getCredential().getCredentialId()))
.findFirst();
assert registration != null;
@@ -312,14 +312,14 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
/** {@inheritDoc} */
@Override
- @Nonnull public Optional<CredentialRegistration> getRegistrationByUserHandleAndCredentialId(
+ @Nonnull public Optional<CredentialRecord> getRegistrationByUserHandleAndCredentialId(
final ByteArray credentialId, final ByteArray userHandle) {
checkComponentActive();
final Lock readLock = lock.readLock();
try {
readLock.lock();
- final Collection<CredentialRegistration> existingRegistrations = getRegistrationsByUserHandle(userHandle);
- final Optional<CredentialRegistration> registration = existingRegistrations.stream()
+ final Collection<CredentialRecord> existingRegistrations = getRegistrationsByUserHandle(userHandle);
+ final Optional<CredentialRecord> registration = existingRegistrations.stream()
.filter(credReg -> credentialId.equals(credReg.getCredential().getCredentialId()))
.findFirst();
assert registration != null;
@@ -332,19 +332,19 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
/** {@inheritDoc} */
@Override
public boolean addRegistrationByUsername(
- @Nonnull final String username, @Nonnull final CredentialRegistration reg) {
+ @Nonnull final String username, @Nonnull final CredentialRecord reg) {
checkComponentActive();
final Lock writeLock = lock.writeLock();
try {
writeLock.lock();
- final Set<CredentialRegistration> existingRegistrations = getRegistrationsByUsername(username);
+ final Set<CredentialRecord> existingRegistrations = getRegistrationsByUsername(username);
if (!existingRegistrations.isEmpty()) {
- final Set<CredentialRegistration> updateSet = new LinkedHashSet<>(existingRegistrations);
+ final Set<CredentialRecord> updateSet = new LinkedHashSet<>(existingRegistrations);
updateSet.add(reg);
return storageService.update(STORAGE_CONTEXT, username, updateSet, serializer, null);
} else {
- final Set<CredentialRegistration> addSet = new LinkedHashSet<>(1);
+ final Set<CredentialRecord> addSet = new LinkedHashSet<>(1);
addSet.add(reg);
return storageService.create(STORAGE_CONTEXT, username, addSet, serializer, null);
}
@@ -358,14 +358,14 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
/** {@inheritDoc} */
@Override
public boolean removeRegistrationByUsername(
- final String username, final CredentialRegistration credentialRegistration) {
+ final String username, final CredentialRecord credentialRegistration) {
checkComponentActive();
final Lock writeLock = lock.writeLock();
try {
writeLock.lock();
- final Set<CredentialRegistration> existingRegistrations = getRegistrationsByUsername(username);
+ final Set<CredentialRecord> existingRegistrations = getRegistrationsByUsername(username);
if (!existingRegistrations.isEmpty()) {
- final Set<CredentialRegistration> updateSet = new LinkedHashSet<>(existingRegistrations);
+ final Set<CredentialRecord> updateSet = new LinkedHashSet<>(existingRegistrations);
updateSet.remove(credentialRegistration);
if (updateSet.isEmpty()) {
//remove the entire storage record
@@ -399,7 +399,7 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
final String usernameKey = i.next();
assert usernameKey != null;
- final Set<CredentialRegistration> existingRegistrations = getRegistrationsByUsername(usernameKey);
+ final Set<CredentialRecord> existingRegistrations = getRegistrationsByUsername(usernameKey);
if (existingRegistrations.isEmpty()) {
log.trace("No existing registrations, nothing to remove");
@@ -408,7 +408,7 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
}
// Find an matching credential from the existing registration
- final List<CredentialRegistration> matchingRegistrations = existingRegistrations.stream()
+ final List<CredentialRecord> matchingRegistrations = existingRegistrations.stream()
.filter(reg -> reg.getCredential().getCredentialId().equals(credentialId))
.collect(CollectionSupport.nonnullCollector(Collectors.toList())).get();
@@ -416,9 +416,9 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
// If no match, there is nothing to remove
continue;
}
- final CredentialRegistration registrationToRemove = matchingRegistrations.get(0);
+ final CredentialRecord registrationToRemove = matchingRegistrations.get(0);
- final Set<CredentialRegistration> updateSet = new LinkedHashSet<>(existingRegistrations);
+ final Set<CredentialRecord> updateSet = new LinkedHashSet<>(existingRegistrations);
updateSet.remove(registrationToRemove);
if (updateSet.isEmpty()) {
//remove the entire storage record
@@ -450,12 +450,12 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
final Lock writeLock = lock.writeLock();
try {
writeLock.lock();
- final Set<CredentialRegistration> existingRegistrations = getRegistrationsByUsername(username);
+ final Set<CredentialRecord> existingRegistrations = getRegistrationsByUsername(username);
if (!existingRegistrations.isEmpty()) {
- final Set<CredentialRegistration> updateSet = new LinkedHashSet<>(existingRegistrations);
+ final Set<CredentialRecord> updateSet = new LinkedHashSet<>(existingRegistrations);
// Find an matching credential from the existing registration
- final List<CredentialRegistration> matchingRegistrations = existingRegistrations.stream()
+ final List<CredentialRecord> matchingRegistrations = existingRegistrations.stream()
.filter(reg -> reg.getCredential().getCredentialId().equals(credentialId))
.collect(CollectionSupport.nonnullCollector(Collectors.toList())).get();
@@ -491,7 +491,7 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
final Lock writeLock = lock.writeLock();
try {
writeLock.lock();
- final Optional<CredentialRegistration> credential =
+ final Optional<CredentialRecord> credential =
getRegistrationByUsernameAndCredentialId(username, credentialId);
if (credential.isEmpty()) {
log.warn("Can not update signature count for user '{}' and credential '{}'. "
@@ -505,10 +505,10 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
assert updatedCredential != null;
// Create a new credential from the existing credential, keeping the all the fields the same other than
// the registered credential (which itself should only have the signature counter updated).
- final CredentialRegistration updatedRegistration = credential.get().withCredential(updatedCredential);
+ final CredentialRecord updatedRegistration = credential.get().withCredential(updatedCredential);
// Remove the old
- final CredentialRegistration existingCredential = credential.get();
+ final CredentialRecord existingCredential = credential.get();
assert existingCredential != null && updatedRegistration != null;
if (!removeRegistrationByUsername(username, existingCredential)) {
@@ -530,12 +530,12 @@ public class IdPStorageServiceCredentialRespository extends AbstractIdentifiable
/** {@inheritDoc} */
@Override
- @Nonnull @NotLive @Unmodifiable public Set<CredentialRegistration> getAllRegistrations() {
+ @Nonnull @NotLive @Unmodifiable public Set<CredentialRecord> getAllRegistrations() {
checkComponentActive();
final Lock readLock = lock.readLock();
try {
readLock.lock();
- final Set<CredentialRegistration> allCredentials = new HashSet<>();
+ final Set<CredentialRecord> allCredentials = new HashSet<>();
for (final Iterator<String> i = storageService.getContextKeys(STORAGE_CONTEXT, null).iterator();
i.hasNext();) {
final String usernameKey = i.next();
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptionsTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptionsTest.java
index 2b7935b..532b764 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptionsTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/CreatePublicKeyCredentialCreationOptionsTest.java
@@ -31,7 +31,7 @@ import com.yubico.webauthn.data.UserVerificationRequirement;
import net.shibboleth.idp.plugin.authn.webauthn.admin.WebAuthnRegistrationEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnTest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.EnhancedCredentialRecord;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
@@ -97,8 +97,8 @@ public class CreatePublicKeyCredentialCreationOptionsTest extends AbstractWebAut
context.setServerChallenge(generateRandomBytes(17));
action.initialize();
- context.setExistingCredentials(CollectionSupport.setOf(EnhancedCredentialRegistration.builder()
- .withCredentialRegistration(createCredentialRegistration()).build()));
+ context.setExistingCredentials(CollectionSupport.setOf(EnhancedCredentialRecord.builder()
+ .withCredentialRecord(createCredentialRegistration()).build()));
final Event result = action.execute(src);
assertNull(result);
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredentialTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredentialTest.java
index de4afc9..980a91d 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredentialTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/DeletePublicKeyCredentialTest.java
@@ -27,7 +27,7 @@ import com.yubico.webauthn.RegisteredCredential;
import net.shibboleth.idp.plugin.authn.webauthn.admin.WebAuthnRegistrationEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnTest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.component.ComponentInitializationException;
/**
@@ -41,7 +41,7 @@ public class DeletePublicKeyCredentialTest extends AbstractWebAuthnTest {
private RegisteredCredential credential;
- private CredentialRegistration reg;
+ private CredentialRecord reg;
@Override
@BeforeMethod
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredentialTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredentialTest.java
index 0b31c10..175b204 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredentialTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/admin/impl/StorePublicKeyCredentialTest.java
@@ -34,7 +34,7 @@ import net.shibboleth.idp.plugin.authn.webauthn.admin.RegistrationResult;
import net.shibboleth.idp.plugin.authn.webauthn.admin.WebAuthnRegistrationEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnTest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.component.ComponentInitializationException;
/**
@@ -111,7 +111,7 @@ public class StorePublicKeyCredentialTest extends AbstractWebAuthnTest {
final Event result = action.execute(src);
assertNull(result);
- final Optional<CredentialRegistration> credReg =
+ final Optional<CredentialRecord> credReg =
credentialRepo.getRegistrationByUsernameAndCredentialId("jdoe", cred.getId());
assertTrue(credReg.isPresent());
assertEquals(credReg.get().getUsername(), "jdoe");
@@ -129,7 +129,7 @@ public class StorePublicKeyCredentialTest extends AbstractWebAuthnTest {
final Event result = action.execute(src);
assertNull(result);
- final Optional<CredentialRegistration> credReg =
+ final Optional<CredentialRecord> credReg =
credentialRepo.getRegistrationByUsernameAndCredentialId("different", cred.getId());
assertTrue(credReg.isEmpty());
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/client/impl/YubicoWebauthnAuthenticationClientTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/client/impl/YubicoWebauthnAuthenticationClientTest.java
index eb7244d..ac153fd 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/client/impl/YubicoWebauthnAuthenticationClientTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/client/impl/YubicoWebauthnAuthenticationClientTest.java
@@ -45,7 +45,7 @@ import net.shibboleth.idp.plugin.authn.webauthn.authn.AssertionResult;
import net.shibboleth.idp.plugin.authn.webauthn.exception.AssertionFailureException;
import net.shibboleth.idp.plugin.authn.webauthn.exception.RegistrationFailureException;
import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnTest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.storage.impl.InMemoryRegistrationStorage;
import net.shibboleth.idp.plugin.authn.webauthn.storage.impl.MockAuthenticator;
import net.shibboleth.shared.codec.Base64Support;
@@ -182,7 +182,7 @@ public class YubicoWebauthnAuthenticationClientTest extends AbstractWebAuthnTest
.build();
- final CredentialRegistration reg =CredentialRegistration.builder()
+ final CredentialRecord reg =CredentialRecord.builder()
.withUserIdentity(userIdentity)
.withUsername(USERNAME)
.withTransports(new TreeSet<AuthenticatorTransport>())
@@ -255,7 +255,7 @@ public class YubicoWebauthnAuthenticationClientTest extends AbstractWebAuthnTest
.getAttestedCredentialData().get().getCredentialPublicKey())
.build();
- final CredentialRegistration reg =CredentialRegistration.builder()
+ final CredentialRecord reg =CredentialRecord.builder()
.withUserIdentity(userIdentity)
.withUsername(USERNAME)
.withTransports(new TreeSet<AuthenticatorTransport>())
@@ -300,7 +300,7 @@ public class YubicoWebauthnAuthenticationClientTest extends AbstractWebAuthnTest
.getAttestedCredentialData().get().getCredentialPublicKey())
.build();
- final CredentialRegistration reg =CredentialRegistration.builder()
+ final CredentialRecord reg =CredentialRecord.builder()
.withUserIdentity(userIdentity)
.withUsername(USERNAME)
.withTransports(new TreeSet<AuthenticatorTransport>())
@@ -346,7 +346,7 @@ public class YubicoWebauthnAuthenticationClientTest extends AbstractWebAuthnTest
.getAttestedCredentialData().get().getCredentialPublicKey())
.build();
- final CredentialRegistration reg =CredentialRegistration.builder()
+ final CredentialRecord reg =CredentialRecord.builder()
.withUserIdentity(userIdentity)
.withUsername(USERNAME)
.withTransports(new TreeSet<AuthenticatorTransport>())
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/AbstractWebAuthnFlowTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/AbstractWebAuthnFlowTest.java
index c672cfa..0f51b35 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/AbstractWebAuthnFlowTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/AbstractWebAuthnFlowTest.java
@@ -81,7 +81,7 @@ import net.shibboleth.idp.authn.principal.UsernamePrincipal;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
import net.shibboleth.idp.plugin.authn.webauthn.principal.WebAuthnUserIdPrinicpal;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.storage.impl.IdPStorageServiceCredentialRespository;
import net.shibboleth.idp.plugin.authn.webauthn.storage.impl.InMemoryRegistrationStorage;
import net.shibboleth.idp.plugin.authn.webauthn.storage.impl.MockAuthenticator;
@@ -178,8 +178,8 @@ public abstract class AbstractWebAuthnFlowTest extends AbstractFlowTest {
fail("Can not initialise mock authenticator");
}
// remove any exist credentials from repo
- final Set<CredentialRegistration> registrations = credentialRepo.getAllRegistrations();
- for (final CredentialRegistration reg : registrations) {
+ final Set<CredentialRecord> registrations = credentialRepo.getAllRegistrations();
+ for (final CredentialRecord reg : registrations) {
credentialRepo.removeRegistrationByUsernameAndCredentialId(reg.getUsername(),
reg.getCredential().getCredentialId());
}
@@ -214,7 +214,7 @@ public abstract class AbstractWebAuthnFlowTest extends AbstractFlowTest {
*
* @throws Exception on error
*/
- protected CredentialRegistration createCredentialRegistration(final String username, final String displayName,
+ protected CredentialRecord createCredentialRegistration(final String username, final String displayName,
final String userHandleB64) throws Exception {
return createCredentialRegistration(username, displayName, userHandleB64, null);
@@ -231,7 +231,7 @@ public abstract class AbstractWebAuthnFlowTest extends AbstractFlowTest {
*
* @throws Exception on error
*/
- protected CredentialRegistration createCredentialRegistration(final String username, final String displayName,
+ protected CredentialRecord createCredentialRegistration(final String username, final String displayName,
final String userHandleB64, final Map<String,String> capabilities) throws Exception {
final var user = UserIdentity.builder()
@@ -256,7 +256,7 @@ public abstract class AbstractWebAuthnFlowTest extends AbstractFlowTest {
.getAttestedCredentialData().get().getCredentialPublicKey())
.build();
- final var reg = CredentialRegistration.builder()
+ final var reg = CredentialRecord.builder()
.withUserIdentity(user)
.withUsername(username)
.withTransports(new TreeSet<AuthenticatorTransport>())
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestAdminManagementFlow.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestAdminManagementFlow.java
index bca893c..9e9f190 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestAdminManagementFlow.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestAdminManagementFlow.java
@@ -38,7 +38,7 @@ import net.shibboleth.idp.plugin.authn.webauthn.admin.impl.ExtractKeyInformation
import net.shibboleth.idp.plugin.authn.webauthn.admin.impl.ExtractUsernameSearchFromFormRequest;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.impl.ExtractPublicKeyCredentialAssertionFromFormRequest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.collection.Pair;
/**
@@ -74,7 +74,7 @@ public class TestAdminManagementFlow extends AbstractWebAuthnFlowTest{
@Test
public void testManagementFlow_RemoveCredential() throws Exception {
//Register a credential for use and to delete.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
@@ -123,7 +123,7 @@ public class TestAdminManagementFlow extends AbstractWebAuthnFlowTest{
@SuppressWarnings("null")
private void doAuthenticationDance(final Pair<FlowExecutionResult, FlowExecutionImpl> result,
- final CredentialRegistration registration) throws Exception {
+ final CredentialRecord registration) throws Exception {
// Do authentication part
assertFlowExecutionActive(result.getSecond());
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestPasswordlessFlow.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestPasswordlessFlow.java
index 7d05b2d..d4301a4 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestPasswordlessFlow.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestPasswordlessFlow.java
@@ -33,7 +33,7 @@ import com.yubico.webauthn.data.PublicKeyCredential;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.impl.ExtractPublicKeyCredentialAssertionFromFormRequest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.collection.Pair;
@@ -66,7 +66,7 @@ public class TestPasswordlessFlow extends AbstractWebAuthnFlowTest{
@Test
public void testPasswordlessFlow() throws Exception {
//Register a credential for use.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestRegistrationFlow.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestRegistrationFlow.java
index 82652e2..f629a0e 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestRegistrationFlow.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestRegistrationFlow.java
@@ -43,7 +43,7 @@ import net.shibboleth.idp.plugin.authn.webauthn.admin.impl.ExtractPublicKeyCrede
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
import net.shibboleth.idp.plugin.authn.webauthn.impl.ExtractPublicKeyCredentialAssertionFromFormRequest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.collection.Pair;
/**
@@ -79,7 +79,7 @@ public class TestRegistrationFlow extends AbstractWebAuthnFlowTest{
@Test
public void testRegistrationFlow_RemoveCredential() throws Exception {
//Register a credential for use and to delete.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
@@ -119,12 +119,12 @@ public class TestRegistrationFlow extends AbstractWebAuthnFlowTest{
@Test
public void testRegistrationFlow_RemoveCredentialFromDifferentUser() throws Exception {
//Register a credential for use
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
// Register another uses credential and try and delete it
- final CredentialRegistration registrationAnotherUser =
+ final CredentialRecord registrationAnotherUser =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername("another-user", registrationAnotherUser);
@@ -160,7 +160,7 @@ public class TestRegistrationFlow extends AbstractWebAuthnFlowTest{
@Test
public void testRegistrationFlow_AddCredential() throws Exception {
//Register a credential for use for authentication.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
@@ -211,14 +211,14 @@ public class TestRegistrationFlow extends AbstractWebAuthnFlowTest{
final var anotherUserUsername = "another-user";
final var anotherUserDisplayName = "another user";
final var anotherUserUserIdB64 = "2fixsNecxhORZpf4LMU9nA==";
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(anotherUserUsername, anotherUserDisplayName, anotherUserUserIdB64);
credentialRepo.addRegistrationByUsername(anotherUserUsername, registration);
assertEquals(credentialRepo.getCredentialIdsForUsername(anotherUserUsername).size(),1);
//Register a credential for the actual user to authenticate with
- final CredentialRegistration registrationCorrectUser =
+ final CredentialRecord registrationCorrectUser =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registrationCorrectUser);
@@ -296,7 +296,7 @@ public class TestRegistrationFlow extends AbstractWebAuthnFlowTest{
@SuppressWarnings("null")
private void doAuthenticationDance(final Pair<FlowExecutionResult, FlowExecutionImpl> result,
- final CredentialRegistration registration) throws Exception {
+ final CredentialRecord registration) throws Exception {
// Do authentication part
assertFlowExecutionActive(result.getSecond());
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestSecondFactorFlow.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestSecondFactorFlow.java
index c2414f0..4fe8b63 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestSecondFactorFlow.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestSecondFactorFlow.java
@@ -37,7 +37,7 @@ import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.MultiFactorAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.impl.ExtractPublicKeyCredentialAssertionFromFormRequest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.collection.Pair;
@@ -69,7 +69,7 @@ public class TestSecondFactorFlow extends AbstractWebAuthnFlowTest{
@Test
public void testSecondFactorFlow() throws Exception {
//Register a credential for use.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
@@ -118,7 +118,7 @@ public class TestSecondFactorFlow extends AbstractWebAuthnFlowTest{
@Test
public void testSecondFactorFlow_WrongPreviousResult() throws Exception {
//Register a credential for use.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestUsernameslessFlow.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestUsernameslessFlow.java
index 3405580..ed7efea 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestUsernameslessFlow.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestUsernameslessFlow.java
@@ -34,7 +34,7 @@ import com.yubico.webauthn.data.PublicKeyCredential;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.impl.ExtractPublicKeyCredentialAssertionFromFormRequest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.collection.Pair;
@@ -67,7 +67,7 @@ public class TestUsernameslessFlow extends AbstractWebAuthnFlowTest{
public void testUsernamelessFlow() throws Exception {
//Register a credential for use.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
@@ -112,11 +112,11 @@ public class TestUsernameslessFlow extends AbstractWebAuthnFlowTest{
public void testUsernamelessFlow_WebAuthnUsernameDifferentThanIdPUsername() throws Exception {
//Register a credential for use.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
// Now change the username to be different than the user in the WebAuthn identity
- final var regWithDifferentUsername = CredentialRegistration.builder()
+ final var regWithDifferentUsername = CredentialRecord.builder()
.withUserIdentity(registration.getUserIdentity())
.withUsername("different-idp-username")
.withTransports(registration.getTransports())
@@ -170,7 +170,7 @@ public class TestUsernameslessFlow extends AbstractWebAuthnFlowTest{
public void testUsernamelessFlow_UserNotVerified() throws Exception {
//Register a credential for use.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
@@ -217,7 +217,7 @@ public class TestUsernameslessFlow extends AbstractWebAuthnFlowTest{
public void testUsernamelessFlow_BadSignature() throws Exception {
//Register a credential for use.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
@@ -263,7 +263,7 @@ public class TestUsernameslessFlow extends AbstractWebAuthnFlowTest{
public void testUsernamelessFlow_WrongOrigin() throws Exception {
//Register a credential for use.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
@@ -315,14 +315,14 @@ public class TestUsernameslessFlow extends AbstractWebAuthnFlowTest{
public void testUsernamelessFlow_WrongUserHandleForUsername() throws Exception {
//Register a credential for use for the actual/real user.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
//Register a second users credential with different
final var userHandleSecondUserB64 = "2fixsNecxhORZpf4LMU9nA==";
final ByteArray userHandleBytesSecondUser = ByteArray.fromBase64(userHandleSecondUserB64);
- final CredentialRegistration registrationTwo =
+ final CredentialRecord registrationTwo =
createCredentialRegistration("second-user", "second user", userHandleSecondUserB64);
credentialRepo.addRegistrationByUsername("second-user", registrationTwo);
@@ -371,7 +371,7 @@ public class TestUsernameslessFlow extends AbstractWebAuthnFlowTest{
public void testUsernamelessFlow_NoAssertionResponse() throws Exception {
//Register a credential for use.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
@@ -415,7 +415,7 @@ public class TestUsernameslessFlow extends AbstractWebAuthnFlowTest{
public void testUsernamelessFlow_DifferentChallenge() throws Exception {
//Register a credential for use.
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
credentialRepo.addRegistrationByUsername(USERNAME, registration);
@@ -455,7 +455,7 @@ public class TestUsernameslessFlow extends AbstractWebAuthnFlowTest{
public void testUsernamelessFlow_NoRegisteredCredential() throws Exception {
//Create a credential to use, but do not register it
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64);
final var prc = buildProfileRequestContext(false, false, null);
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestUsernameslessFlowWithPolicy.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestUsernameslessFlowWithPolicy.java
index c81e3ca..8e20440 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestUsernameslessFlowWithPolicy.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/flow/TestUsernameslessFlowWithPolicy.java
@@ -32,7 +32,7 @@ import com.yubico.webauthn.data.PublicKeyCredential;
import net.shibboleth.idp.plugin.authn.webauthn.admin.policy.impl.SecondFactorOnlyAuthenticatorInspector;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationContext;
import net.shibboleth.idp.plugin.authn.webauthn.impl.ExtractPublicKeyCredentialAssertionFromFormRequest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.collection.Pair;
@@ -64,7 +64,7 @@ public class TestUsernameslessFlowWithPolicy extends AbstractWebAuthnFlowTest{
@Test
public void testUsernamelessFlow_CredentialRejected_2FAOnly() throws Exception {
//Register a credential for use that is only suitable for 2FA
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createCredentialRegistration(USERNAME, DISPLAY_NAME, USER_HANDLE_B64,
Map.of(SecondFactorOnlyAuthenticatorInspector.CAPABILITY_NAME, "true"));
credentialRepo.addRegistrationByUsername(USERNAME, registration);
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/AbstractWebAuthnTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/AbstractWebAuthnTest.java
index fd34308..0542c7b 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/AbstractWebAuthnTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/AbstractWebAuthnTest.java
@@ -64,7 +64,7 @@ import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnAuthenticationCo
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnManagementContext;
import net.shibboleth.idp.plugin.authn.webauthn.context.WebAuthnRegistrationContext;
import net.shibboleth.idp.plugin.authn.webauthn.metadata.impl.FidoMetadataServiceFactory;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.storage.WebAuthnCredentialRepository;
import net.shibboleth.idp.plugin.authn.webauthn.storage.impl.InMemoryRegistrationStorage;
import net.shibboleth.idp.plugin.authn.webauthn.storage.impl.MockAuthenticator;
@@ -333,7 +333,7 @@ public abstract class AbstractWebAuthnTest {
*
* @throws Exception on error
*/
- protected CredentialRegistration createCredentialRegistration() throws Exception {
+ protected CredentialRecord createCredentialRegistration() throws Exception {
return createCredentialRegistration(null);
}
@@ -344,7 +344,7 @@ public abstract class AbstractWebAuthnTest {
* @return the credential registration
* @throws Exception on error
*/
- protected CredentialRegistration createCredentialRegistration(final Map<String,String> capabilities)
+ protected CredentialRecord createCredentialRegistration(final Map<String,String> capabilities)
throws Exception {
final var user = UserIdentity.builder()
@@ -369,7 +369,7 @@ public abstract class AbstractWebAuthnTest {
.getAttestedCredentialData().get().getCredentialPublicKey())
.build();
- final var reg = CredentialRegistration.builder()
+ final var reg = CredentialRecord.builder()
.withUserIdentity(user)
.withUsername("jdoe")
.withTransports(new TreeSet<AuthenticatorTransport>())
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsFromUserHandleTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsFromUserHandleTest.java
index 6da699b..1b6888a 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsFromUserHandleTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsFromUserHandleTest.java
@@ -38,7 +38,7 @@ import com.yubico.webauthn.data.UserIdentity;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.plugin.authn.webauthn.authn.WebAuthnAuthenticationEventIds;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.storage.impl.MockAuthenticator;
import net.shibboleth.shared.codec.Base64Support;
@@ -91,7 +91,7 @@ public class LookupRegisteredCredentialsFromUserHandleTest extends AbstractWebAu
.build();
- final CredentialRegistration reg =CredentialRegistration.builder()
+ final CredentialRecord reg = CredentialRecord.builder()
.withUserIdentity(userIdentity)
.withUsername(USERNAME)
.withTransports(new TreeSet<AuthenticatorTransport>())
@@ -146,7 +146,7 @@ public class LookupRegisteredCredentialsFromUserHandleTest extends AbstractWebAu
.build();
- final CredentialRegistration reg =CredentialRegistration.builder()
+ final CredentialRecord reg =CredentialRecord.builder()
.withUserIdentity(userIdentity)
.withUsername(USERNAME)
.withTransports(new TreeSet<AuthenticatorTransport>())
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsTest.java
index c35a9c2..bfabb3d 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/impl/LookupRegisteredCredentialsTest.java
@@ -38,7 +38,7 @@ import com.yubico.webauthn.data.PublicKeyCredential;
import com.yubico.webauthn.data.UserIdentity;
import net.shibboleth.idp.plugin.authn.webauthn.context.BaseWebAuthnContext;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.storage.impl.MockAuthenticator;
import net.shibboleth.shared.codec.Base64Support;
import net.shibboleth.shared.component.ComponentInitializationException;
@@ -54,7 +54,7 @@ public class LookupRegisteredCredentialsTest extends AbstractWebAuthnTest {
private RegisteredCredential credential;
- private CredentialRegistration reg;
+ private CredentialRecord reg;
@Override
@BeforeMethod
@@ -88,7 +88,7 @@ public class LookupRegisteredCredentialsTest extends AbstractWebAuthnTest {
.getAttestedCredentialData().get().getCredentialPublicKey())
.build();
- reg = CredentialRegistration.builder()
+ reg = CredentialRecord.builder()
.withUserIdentity(user)
.withUsername("jdoe")
.withTransports(new TreeSet<AuthenticatorTransport>())
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/ChainingCredentialPolicyRuleTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/ChainingCredentialPolicyRuleTest.java
index 49c1d39..fe09d77 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/ChainingCredentialPolicyRuleTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/ChainingCredentialPolicyRuleTest.java
@@ -23,7 +23,7 @@ import org.testng.annotations.Test;
import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnTest;
import net.shibboleth.idp.plugin.authn.webauthn.policy.CredentialPolicy;
import net.shibboleth.idp.plugin.authn.webauthn.policy.CredentialPolicy.CredentialPolicyOutcome;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
@@ -32,9 +32,11 @@ import net.shibboleth.shared.component.ComponentInitializationException;
*/
public class ChainingCredentialPolicyRuleTest extends AbstractWebAuthnTest {
+ /** The policy to check.*/
private ChainingCredentialPolicyRule policy;
- private CredentialRegistration registration;
+ /** The credential registration.*/
+ private CredentialRecord registration;
@Override
@BeforeMethod
@@ -55,7 +57,7 @@ public class ChainingCredentialPolicyRuleTest extends AbstractWebAuthnTest {
}
@Override
- public CredentialPolicyOutcome evaluate(final CredentialRegistration cred, final ProfileRequestContext prc) {
+ public CredentialPolicyOutcome evaluate(final CredentialRecord cred, final ProfileRequestContext prc) {
return CredentialPolicyOutcome.ACCEPT;
}
}));
@@ -76,7 +78,7 @@ public class ChainingCredentialPolicyRuleTest extends AbstractWebAuthnTest {
}
@Override
- public CredentialPolicyOutcome evaluate(final CredentialRegistration cred, final ProfileRequestContext prc) {
+ public CredentialPolicyOutcome evaluate(final CredentialRecord cred, final ProfileRequestContext prc) {
return CredentialPolicyOutcome.REJECT;
}
}));
@@ -97,7 +99,7 @@ public class ChainingCredentialPolicyRuleTest extends AbstractWebAuthnTest {
}
@Override
- public CredentialPolicyOutcome evaluate(final CredentialRegistration cred, final ProfileRequestContext prc) {
+ public CredentialPolicyOutcome evaluate(final CredentialRecord cred, final ProfileRequestContext prc) {
return CredentialPolicyOutcome.ACCEPT;
}
}, new CredentialPolicy() {
@@ -108,7 +110,7 @@ public class ChainingCredentialPolicyRuleTest extends AbstractWebAuthnTest {
}
@Override
- public CredentialPolicyOutcome evaluate(final CredentialRegistration cred, final ProfileRequestContext prc) {
+ public CredentialPolicyOutcome evaluate(final CredentialRecord cred, final ProfileRequestContext prc) {
return CredentialPolicyOutcome.REJECT;
}
}));
@@ -129,7 +131,7 @@ public class ChainingCredentialPolicyRuleTest extends AbstractWebAuthnTest {
}
@Override
- public CredentialPolicyOutcome evaluate(final CredentialRegistration cred, final ProfileRequestContext prc) {
+ public CredentialPolicyOutcome evaluate(final CredentialRecord cred, final ProfileRequestContext prc) {
return CredentialPolicyOutcome.IGNORE;
}
}));
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/SecondFactorOnlyCredentialPolicyRuleTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/SecondFactorOnlyCredentialPolicyRuleTest.java
index 220e09d..07af7bc 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/SecondFactorOnlyCredentialPolicyRuleTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/policy/impl/SecondFactorOnlyCredentialPolicyRuleTest.java
@@ -22,7 +22,7 @@ import org.testng.annotations.Test;
import net.shibboleth.idp.plugin.authn.webauthn.admin.policy.impl.SecondFactorOnlyAuthenticatorInspector;
import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnTest;
import net.shibboleth.idp.plugin.authn.webauthn.policy.CredentialPolicy.CredentialPolicyOutcome;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
@@ -33,7 +33,7 @@ public class SecondFactorOnlyCredentialPolicyRuleTest extends AbstractWebAuthnT
private SecondFactorOnlyCredentialPolicyRule policy;
- private CredentialRegistration credential;
+ private CredentialRecord credential;
@Override
@BeforeMethod
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/CredentialRegistrationSerializerTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/CredentialRegistrationSerializerTest.java
index 9fa6b6a..4e5c587 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/CredentialRegistrationSerializerTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/CredentialRegistrationSerializerTest.java
@@ -35,7 +35,7 @@ import com.yubico.webauthn.data.PublicKeyCredential;
import com.yubico.webauthn.data.UserIdentity;
import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnTest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.shared.codec.Base64Support;
import net.shibboleth.shared.collection.CollectionSupport;
@@ -48,7 +48,7 @@ public class CredentialRegistrationSerializerTest extends AbstractWebAuthnTest {
private UserIdentity user;
- private CredentialRegistration reg;
+ private CredentialRecord reg;
@Override
@BeforeMethod
@@ -77,7 +77,7 @@ public class CredentialRegistrationSerializerTest extends AbstractWebAuthnTest {
.getAttestedCredentialData().get().getCredentialPublicKey())
.build();
- reg = CredentialRegistration.builder()
+ reg = CredentialRecord.builder()
.withUserIdentity(user)
.withUsername("jdoe")
.withTransports(new TreeSet<AuthenticatorTransport>())
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java
index 60d5ffb..f9c0678 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java
@@ -43,7 +43,7 @@ import com.yubico.webauthn.data.PublicKeyCredential;
import com.yubico.webauthn.data.UserIdentity;
import net.shibboleth.idp.plugin.authn.webauthn.impl.AbstractWebAuthnTest;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
/**
* Tests for {@link IdPStorageServiceCredentialRespository}.
@@ -75,7 +75,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
mockAuthenticator = new MockAuthenticator(RPID);
}
- private CredentialRegistration createRegistration(
+ private CredentialRecord createRegistration(
final String name, final String displayName, final byte[] userHandle) throws Exception {
final Map<String, String> clientDataCreate = createClientData("webauthn.create", ORIGIN, CHALLENGE_B64);
@@ -97,7 +97,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
.getAttestedCredentialData().get().getCredentialPublicKey())
.build();
- return CredentialRegistration.builder()
+ return CredentialRecord.builder()
.withUserIdentity(user)
.withUsername(name)
.withTransports(new TreeSet<AuthenticatorTransport>())
@@ -113,7 +113,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testAddRegistrationByUsername() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
final var registrations = repo.getRegistrationsByUsername("jdoe");
@@ -127,12 +127,12 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testAddTwoRegistrationsByUsername() throws Exception {
- final CredentialRegistration registration =
+ final CredentialRecord registration =
createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
// Now add another
- final CredentialRegistration registrationTwo =
+ final CredentialRecord registrationTwo =
createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registrationTwo);
@@ -155,7 +155,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testRemoveRegistrationByCredentialId() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
var registrations = repo.getRegistrationsByUsername("jdoe");
@@ -177,10 +177,10 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testRemoveRegistrationByCredentialId_TwoRegistrations() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
- final CredentialRegistration registrationTwo = createRegistration("pdoe", "Poe Doe", "user-handle-2".getBytes());
+ final CredentialRecord registrationTwo = createRegistration("pdoe", "Poe Doe", "user-handle-2".getBytes());
repo.addRegistrationByUsername("pdoe", registrationTwo);
var registrations = repo.getRegistrationsByUsername("jdoe");
@@ -218,8 +218,8 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testRemoveRegistrationByCredentialId_TwoRegistrationsSameAccount() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
- final CredentialRegistration registrationTwo = createRegistration("jdoe", "John Doe", "user-handle-2".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registrationTwo = createRegistration("jdoe", "John Doe", "user-handle-2".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
repo.addRegistrationByUsername("jdoe", registrationTwo);
@@ -251,7 +251,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testRemoveRegistrationByCredentialId_TwoRegistrationsSameCredential() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
// Both share the same registration, should not happen in practice
repo.addRegistrationByUsername("pdoe", registration);
@@ -290,7 +290,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testRemoveRegistrationByCredentialId_NothingToRemove() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
var registrations = repo.getRegistrationsByUsername("jdoe");
@@ -315,7 +315,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testRemoveRegistrationByUsername() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
var registrations = repo.getRegistrationsByUsername("jdoe");
@@ -337,7 +337,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testRemoveRegistrationByUsernameAndCredentialId() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
var registrations = repo.getRegistrationsByUsername("jdoe");
@@ -359,8 +359,8 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testRemoveRegistrationByUsernameAndCredentialId_TwoRegistrations() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
- final CredentialRegistration registrationTwo =
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registrationTwo =
createRegistration("jdoe", "John Doe", "user-handle-2".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
repo.addRegistrationByUsername("jdoe", registrationTwo);
@@ -385,9 +385,9 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testRemoveRegistrationByUsernameAndCredentialId_TwoUsers() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
- final CredentialRegistration registrationTwo = createRegistration("pdoe", "Poe Doe", "user-handle-2".getBytes());
+ final CredentialRecord registrationTwo = createRegistration("pdoe", "Poe Doe", "user-handle-2".getBytes());
repo.addRegistrationByUsername("pdoe", registrationTwo);
var registrations = repo.getRegistrationsByUsername("jdoe");
@@ -428,7 +428,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testUpdateSignatureCounter() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
var registrations = repo.getRegistrationsByUsername("jdoe");
@@ -455,7 +455,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testUpdateSignatureCounter_NoCredential() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
final var registrations = repo.getRegistrationsByUsername("jdoe");
@@ -475,11 +475,11 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testRemoveOneRegistrationFromTwoByUsername() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
// Now add another
- final CredentialRegistration registrationTwo =
+ final CredentialRecord registrationTwo =
createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registrationTwo);
@@ -504,7 +504,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testGetUserHandleForUsername() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
final var userHandle = repo.getUserHandleForUsername("jdoe");
@@ -517,7 +517,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testGetRegistrationByUsernameAndCredentialId() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
final var registrations = repo.getRegistrationByUsernameAndCredentialId("jdoe",
@@ -532,7 +532,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testGetRegistrationByUsernameAndCredentialId_NoneFound() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
final var registrations = repo.getRegistrationByUsernameAndCredentialId("not-found",
@@ -544,7 +544,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testGetCredentialIdsForUsername() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
final var credentialDescriptors = repo.getCredentialIdsForUsername("jdoe");
@@ -559,15 +559,15 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testLookupAll() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
// Now add another for jdoe
- final CredentialRegistration registrationTwo = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registrationTwo = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registrationTwo);
// Add one for pdoe
- final CredentialRegistration registrationthree =
+ final CredentialRecord registrationthree =
createRegistration("pdoe", "John Doe", "user-handle-pdoe".getBytes());
repo.addRegistrationByUsername("pdoe", registrationthree);
@@ -584,15 +584,15 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testLookup() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
// Now add another for jdoe
- final CredentialRegistration registrationTwo = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registrationTwo = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registrationTwo);
// Add one for pdoe
- final CredentialRegistration registrationthree =
+ final CredentialRecord registrationthree =
createRegistration("pdoe", "John Doe", "user-handle-pdoe".getBytes());
repo.addRegistrationByUsername("pdoe", registrationthree);
@@ -619,15 +619,15 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public void testGetUsernameForUserHandle() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
// Now add another for jdoe
- final CredentialRegistration registrationTwo = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registrationTwo = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registrationTwo);
// Add one for pdoe
- final CredentialRegistration registrationthree =
+ final CredentialRecord registrationthree =
createRegistration("pdoe", "John Doe", "user-handle-pdoe".getBytes());
repo.addRegistrationByUsername("pdoe", registrationthree);
@@ -649,9 +649,9 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public final void testThreadSafetyAdd() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
- final CredentialRegistration registrationTwo = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
- final CredentialRegistration registrationThree = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registrationTwo = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registrationThree = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
final ExecutorService service = Executors.newFixedThreadPool(3);
final Collection<Future<Boolean>> futures = new ArrayList<>(3);
@@ -672,8 +672,8 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public final void testThreadSafetyAddRead() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
- final CredentialRegistration registrationTwo = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registrationTwo = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
final ExecutorService service = Executors.newFixedThreadPool(3);
final Collection<Future<Boolean>> futures = new ArrayList<>(3);
@@ -697,7 +697,7 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
@Test
public final void testThreadSafetyUpdateSignatureCount() throws Exception {
- final CredentialRegistration registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
repo.addRegistrationByUsername("jdoe", registration);
final ExecutorService service = Executors.newFixedThreadPool(3);
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/InMemoryRegistrationStorage.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/InMemoryRegistrationStorage.java
index 960fa30..850c1e8 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/InMemoryRegistrationStorage.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/InMemoryRegistrationStorage.java
@@ -44,7 +44,7 @@ import com.yubico.webauthn.RegisteredCredential;
import com.yubico.webauthn.data.ByteArray;
import com.yubico.webauthn.data.PublicKeyCredentialDescriptor;
-import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRegistration;
+import net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord;
import net.shibboleth.idp.plugin.authn.webauthn.storage.WebAuthnCredentialRepository;
import net.shibboleth.shared.collection.CollectionSupport;
@@ -54,7 +54,7 @@ import net.shibboleth.shared.collection.CollectionSupport;
@SuppressWarnings("null")
public class InMemoryRegistrationStorage implements WebAuthnCredentialRepository {
- private final Cache<String, Set<CredentialRegistration>> storage = CacheBuilder.newBuilder().maximumSize(1000)
+ private final Cache<String, Set<CredentialRecord>> storage = CacheBuilder.newBuilder().maximumSize(1000)
.expireAfterAccess(1, TimeUnit.DAYS).build();
private static final Logger logger = LoggerFactory.getLogger(InMemoryRegistrationStorage.class);
@@ -70,7 +70,7 @@ public class InMemoryRegistrationStorage implements WebAuthnCredentialRepository
@Override
public Optional<String> getUsernameForUserHandle(final ByteArray userHandle) {
- return getRegistrationsByUserHandle(userHandle).stream().findAny().map(CredentialRegistration::getUsername);
+ return getRegistrationsByUserHandle(userHandle).stream().findAny().map(CredentialRecord::getUsername);
}
@Override
@@ -80,7 +80,7 @@ public class InMemoryRegistrationStorage implements WebAuthnCredentialRepository
@Override
public Optional<RegisteredCredential> lookup(final ByteArray credentialId, final ByteArray userHandle) {
- final Optional<CredentialRegistration> registrationMaybe = storage.asMap().values().stream()
+ final Optional<CredentialRecord> registrationMaybe = storage.asMap().values().stream()
.flatMap(Collection::stream)
.filter(credReg -> credentialId.equals(credReg.getCredential().getCredentialId())).findAny();
@@ -103,7 +103,7 @@ public class InMemoryRegistrationStorage implements WebAuthnCredentialRepository
.collect(Collectors.toSet()));
}
- public boolean addRegistrationByUsername(final String username, final CredentialRegistration reg) {
+ public boolean addRegistrationByUsername(final String username, final CredentialRecord reg) {
try {
return storage.get(username, HashSet::new).add(reg);
} catch (final ExecutionException e) {
@@ -112,7 +112,7 @@ public class InMemoryRegistrationStorage implements WebAuthnCredentialRepository
}
}
- public Set<CredentialRegistration> getRegistrationsByUsername(final String username) {
+ public Set<CredentialRecord> getRegistrationsByUsername(final String username) {
try {
return storage.get(username, HashSet::new);
} catch (final ExecutionException e) {
@@ -121,27 +121,27 @@ public class InMemoryRegistrationStorage implements WebAuthnCredentialRepository
}
}
- public Collection<CredentialRegistration> getRegistrationsByUserHandle(final ByteArray userHandle) {
+ public Collection<CredentialRecord> getRegistrationsByUserHandle(final ByteArray userHandle) {
return storage.asMap().values().stream().flatMap(Collection::stream)
.filter(credentialRegistration -> userHandle.equals(credentialRegistration.getUserIdentity().getId()))
.collect(Collectors.toList());
}
public void updateSignatureCount(final AssertionResult result) {
- final CredentialRegistration registration = getRegistrationByUsernameAndCredentialId(result.getUsername(),
+ final CredentialRecord registration = getRegistrationByUsernameAndCredentialId(result.getUsername(),
result.getCredential().getCredentialId())
.orElseThrow(() -> new NoSuchElementException(
String.format("Credential \"%s\" is not registered to user \"%s\"",
result.getCredential().getCredentialId(), result.getUsername())));
- final Set<CredentialRegistration> regs = storage.getIfPresent(result.getUsername());
+ final Set<CredentialRecord> regs = storage.getIfPresent(result.getUsername());
regs.remove(registration);
regs.add(registration.withCredential(
registration.getCredential().toBuilder().signatureCount(result.getSignatureCount()).build()));
}
- public Optional<CredentialRegistration> getRegistrationByUsernameAndCredentialId(final String username,
+ public Optional<CredentialRecord> getRegistrationByUsernameAndCredentialId(final String username,
final ByteArray id) {
try {
return storage.get(username, HashSet::new).stream()
@@ -153,7 +153,7 @@ public class InMemoryRegistrationStorage implements WebAuthnCredentialRepository
}
public boolean removeRegistrationByUsername(final String username,
- final CredentialRegistration credentialRegistration) {
+ final CredentialRecord credentialRegistration) {
try {
return storage.get(username, HashSet::new).remove(credentialRegistration);
} catch (final ExecutionException e) {
@@ -187,7 +187,7 @@ public class InMemoryRegistrationStorage implements WebAuthnCredentialRepository
/** {@inheritDoc} */
@Override
- public Set<CredentialRegistration> getAllRegistrations() {
+ public Set<CredentialRecord> getAllRegistrations() {
// TODO Fill this in if needed.
return CollectionSupport.emptySet();
}
@@ -201,10 +201,10 @@ public class InMemoryRegistrationStorage implements WebAuthnCredentialRepository
/** {@inheritDoc} */
@Override
- public Optional<CredentialRegistration> getRegistrationByUserHandleAndCredentialId(final ByteArray credentialId,
+ public Optional<CredentialRecord> getRegistrationByUserHandleAndCredentialId(final ByteArray credentialId,
final ByteArray userHandle) {
- final Collection<CredentialRegistration> existingRegistrations = getRegistrationsByUserHandle(userHandle);
- final Optional<CredentialRegistration> registration = existingRegistrations.stream()
+ final Collection<CredentialRecord> existingRegistrations = getRegistrationsByUserHandle(userHandle);
+ final Optional<CredentialRecord> registration = existingRegistrations.stream()
.filter(credReg -> credentialId.equals(credReg.getCredential().getCredentialId()))
.findFirst();
assert registration != null;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list