Class CreateTrustedDeviceUseCase

java.lang.Object
com.irurueta.authserver.authorization.application.mfa.CreateTrustedDeviceUseCase

@Service @Transactional public class CreateTrustedDeviceUseCase extends Object
Use case that trusts the browser of a user for some days so it skips the second factor. The raw token is returned once, signed, as the value of the cookie; only its SHA-256 hash is stored.
  • Field Details

    • trustedDeviceRepository

      private final TrustedDeviceRepository trustedDeviceRepository
      Port that stores the trusted devices.
    • trustedDeviceTokens

      private final TrustedDeviceTokens trustedDeviceTokens
      Creator and hasher of the tokens.
    • trustedDeviceTokenSigner

      private final TrustedDeviceTokenSigner trustedDeviceTokenSigner
      Port that signs the cookie value.
    • recordSecurityEventUseCase

      private final RecordSecurityEventUseCase recordSecurityEventUseCase
      Use case that records the audit events.
    • clock

      private final Clock clock
      Source of the current time.
    • mfaProperties

      private final MfaProperties mfaProperties
      Multi-factor settings: how long a device stays trusted.
  • Constructor Details

    • CreateTrustedDeviceUseCase

      public CreateTrustedDeviceUseCase()
  • Method Details

    • execute

      public CreatedTrustedDevice execute(UUID userId, String username, String userAgentSummary)
      Trusts a device.
      Parameters:
      userId - identifier of the user.
      username - name of the user, for the audit log.
      userAgentSummary - short description of the browser, or null.
      Returns:
      the device and the signed cookie value.