Class WebAuthnEncoder

java.lang.Object
net.shibboleth.idp.plugin.authn.webauthn.impl.WebAuthnEncoder

public final class WebAuthnEncoder extends Object
Encoder for credentials that converts raw values into a format suitable for views.
  • Field Details

    • LOG

      @Nonnull private static final org.slf4j.Logger LOG
      Class logger.
  • Constructor Details

    • WebAuthnEncoder

      private WebAuthnEncoder()
      Private constructor.
  • Method Details

    • serializePublicKeyCredentialOptionsAsJSON

      public static String serializePublicKeyCredentialOptionsAsJSON(@Nullable com.yubico.webauthn.data.PublicKeyCredentialCreationOptions options)
      Serialize the PublicKeyCredentialOptions request into a JSON string.
      Parameters:
      options - the options to serialize
      Returns:
      the JSON serialized PublicKeyCredentialOptions, or an empty string if there is an error converting the string.
    • serializePublicKeyCredentialRequestOptionsAsJSON

      public static String serializePublicKeyCredentialRequestOptionsAsJSON(@Nullable com.yubico.webauthn.data.PublicKeyCredentialRequestOptions options)
      Serialize the PublicKeyCredentialRequestOptions request into a JSON string.
      Parameters:
      options - the options to serialize
      Returns:
      the JSON serialized PublicKeyCredentialRequestOptions, or an empty string if there is an error converting the string.
    • formatInstant

      @Nonnull @NotEmpty public static String formatInstant(@Nullable Instant time)
      Format the given instant into a display friendly string.
      Parameters:
      time - the instant to encode
      Returns:
      a formatted time string
    • formatDiscoverable

      @Nonnull public static String formatDiscoverable(@Nullable Optional<Boolean> discoverable)
      Format the isDiscoverable flag for display. Can be used to determine if the credential is a 'passkey'. That is, either true, false, or unknown if empty.
      Parameters:
      discoverable - the isDiscoverable flag
      Returns:
      is the credential discoverable (a 'passkey' or resident key) true, false, or unknown
    • isAuthenticatorMetadataAttached

      public static boolean isAuthenticatorMetadataAttached(EnhancedCredentialRecord cred)
      Does the credential have attached metadata.
      Parameters:
      cred - the credential to check
      Returns:
      true if the credential has metadata, false otherwise.
    • formatTransports

      @Nonnull public static String formatTransports(@Nullable Set<com.yubico.webauthn.data.AuthenticatorTransport> transports)
      Convert a set of transports into a CSV string.
      Parameters:
      transports - the transports to convert
      Returns:
      the CSV string