Class CredentialRecord

java.lang.Object
net.shibboleth.idp.plugin.authn.webauthn.storage.CredentialRecord

@ThreadSafe @Immutable public final class CredentialRecord extends Object
A credential record used to hold a registered credential. Can be serialized in and out of storage.

Equality is determined by comparing the wrapped credential.

  • Field Details

    • userIdentity

      @Nonnull private final com.yubico.webauthn.data.UserIdentity userIdentity
      The users identity.
    • username

      @Nonnull private final String username
      The username of the user to the IdP.
    • credentialNickname

      @Nullable private final String credentialNickname
      An optional nickname of the credential.
    • transports

      @Nonnull @Unmodifiable @NonnullElements private final SortedSet<com.yubico.webauthn.data.AuthenticatorTransport> transports
      The set of transports the authenticator can use to communicate with the client.
    • registrationTime

      @Nonnull private final Instant registrationTime
      The time the registration took place.
    • discoverable

      @Nonnull private final Optional<Boolean> discoverable
      Is the credential a discoverable type (passkey). Empty if not known.
    • credential

      @Nonnull @Unmodifiable @NonnullElements private final com.yubico.webauthn.RegisteredCredential credential
      The credential to register.
    • aaguid

      @Nullable private final byte[] aaguid
      The AAGUID of the authenticator that created this credential.
    • userVerified

      private final boolean userVerified
      Was the user verified during registration.
    • lastUsedTime

      @Nullable private final Instant lastUsedTime
      The time the credential was last used for authentication.
  • Constructor Details

    • CredentialRecord

      private CredentialRecord(CredentialRecord.Builder builder)
      Builder constructor.
      Parameters:
      builder - the builder
  • Method Details

    • isUserVerified

      public boolean isUserVerified()
      Was user verification performed during registration?
      Returns:
      true if user registration was performed, false otherwise
    • isDiscoverable

      @Nonnull public Optional<Boolean> isDiscoverable()
      Is the created credential discoverable?
      Returns:
      true if the credential is discoverable, false if it isn't, empty if unknown.
    • getNickname

      @Nullable public String getNickname()
      Get the nickname of this credential.
      Returns:
      the nickname
    • getRegistrationTime

      @Nonnull public Instant getRegistrationTime()
      Get the time the registration took place.
      Returns:
      the time of registration
    • getUsername

      @Nonnull public String getUsername()
      Get the username of the user to the IdP.
      Returns:
      the user's username
    • getWebAuthnUserName

      @Nonnull public String getWebAuthnUserName()
      Get the WebAuthn user.name of the user identity registered.
      Returns:
      the name of the user identity
    • getUserIdentity

      @Nonnull public com.yubico.webauthn.data.UserIdentity getUserIdentity()
      Get the identity of the user this credential has been registered for.
      Returns:
      the users identity
    • getCredential

      @Nonnull public com.yubico.webauthn.RegisteredCredential getCredential()
      Get the registered credential.
      Returns:
      the registered credential
    • getTransports

      @Nonnull @Unmodifiable @NonnullElements public SortedSet<com.yubico.webauthn.data.AuthenticatorTransport> getTransports()
      Get the set of transports the authenticator can use to communicate with the client.
      Returns:
      the set of transports the authenticator can use to communicate with the client
    • getAaguid

      @Nullable public byte[] getAaguid()
      Get the AAGUID of the authenticator that created this credential. This is optional, for example if attestation is not requested.
      Returns:
      the aaguid
    • getLastUsedTime

      public Instant getLastUsedTime()
      Get the time the credential was last used for authentication.
      Returns:
      the last used time of the credential.
      Since:
      1.1.0
    • getCredentialIdBase64Url

      public String getCredentialIdBase64Url()
      Get the credential ID as a base64URL encoded string.
      Returns:
      the credential ID base64URL encoded
    • getCredentialIdBase64

      public String getCredentialIdBase64()
      Get the credential ID as a base64 encoded string.
      Returns:
      the credential ID base64URL encoded
    • getCredentialIdHex

      public String getCredentialIdHex()
      Get the credential ID as a Hex encoded string.
      Returns:
      the credential ID Hex encoded
    • toBuilder

      public CredentialRecord.Builder toBuilder()
      Get a builder based on this record which can be updated until it is finalised and built.
      Returns:
      the builder
    • toPublicKeyCredentialDescriptor

      @Nullable public com.yubico.webauthn.data.PublicKeyCredentialDescriptor toPublicKeyCredentialDescriptor()
      Convert the credential registration into a PublicKeyCredentialDescriptor.
      Returns:
      the created PublicKeyCredentialDescriptor
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • withCredential

      @Deprecated(since="1.1.0", forRemoval=true) public CredentialRecord withCredential(@Nonnull com.yubico.webauthn.RegisteredCredential newRegisteredCred)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Copy this instance into a new credential registration instance replacing he registered credential with that given.
      Parameters:
      newRegisteredCred - the new credential
      Returns:
      a new CredentialRecord instance
    • builder

      public static CredentialRecord.IUserIdentityStage builder()
      Builder stage.
      Returns:
      the next stage