Class RegistrationService

java.lang.Object
org.ntnu.idi.idatt2106.sparesti.sparestibackend.service.RegistrationService
All Implemented Interfaces:
com.yubico.webauthn.CredentialRepository

@Repository public class RegistrationService extends Object implements com.yubico.webauthn.CredentialRepository
Service class for handling business logic related to biometric registration and login
Since:
28.4.24
Version:
1.0
Author:
Yasin M.
  • Constructor Details

    • RegistrationService

      public RegistrationService()
  • Method Details

    • getCredentialIdsForUsername

      public Set<com.yubico.webauthn.data.PublicKeyCredentialDescriptor> getCredentialIdsForUsername(String username)
      Gets all associated credential id's for a user, using their username
      Specified by:
      getCredentialIdsForUsername in interface com.yubico.webauthn.CredentialRepository
      Parameters:
      username - Username of user
      Returns:
      Set of Credential Id's
    • getUserHandleForUsername

      public Optional<com.yubico.webauthn.data.ByteArray> getUserHandleForUsername(String username)
      Gets the handle of a user, based on the user's username
      Specified by:
      getUserHandleForUsername in interface com.yubico.webauthn.CredentialRepository
      Parameters:
      username - Username of user
      Returns:
      Handle of the User entity, if they have one
    • getUsernameForUserHandle

      public Optional<String> getUsernameForUserHandle(com.yubico.webauthn.data.ByteArray userHandle)
      Gets the username of a User based on their handle
      Specified by:
      getUsernameForUserHandle in interface com.yubico.webauthn.CredentialRepository
      Parameters:
      userHandle - A users unique handle, used for biometric purposes
      Returns:
      Username of the user, if they exist
    • lookup

      public Optional<com.yubico.webauthn.RegisteredCredential> lookup(com.yubico.webauthn.data.ByteArray credentialId, com.yubico.webauthn.data.ByteArray userHandle)
      Looks up biometric registration credentials using the credential ID
      Specified by:
      lookup in interface com.yubico.webauthn.CredentialRepository
      Parameters:
      credentialId - Identifies biometric entry
      userHandle - User handle
      Returns:
      RegisteredCredentials of a user, if it exists
    • lookupAll

      public Set<com.yubico.webauthn.RegisteredCredential> lookupAll(com.yubico.webauthn.data.ByteArray credentialId)
      Gets a set of Registered credentials using credential Id
      Specified by:
      lookupAll in interface com.yubico.webauthn.CredentialRepository
      Parameters:
      credentialId - Identifies biometric registration entries
      Returns:
      Set of registered credentials of a user