Class RemovePhoneUseCase

java.lang.Object
com.irurueta.authserver.authorization.application.sms.RemovePhoneUseCase

@Service @Transactional public class RemovePhoneUseCase extends Object
Removes the phone of a user, verified and pending. Removing a verified phone removes a second factor, so it is audited, and when that leaves the user without any confirmed second factor every trusted device of the user is revoked too, as deleting the last passkey does: a remembered browser stands in for a second factor the user no longer has.
  • Field Details

    • AUDIT_DETAIL

      static final String AUDIT_DETAIL
      Detail of the audit event.
      See Also:
    • userPhoneRepository

      private final UserPhoneRepository userPhoneRepository
      Port that stores the verified phones.
    • phoneVerificationRepository

      private final PhoneVerificationRepository phoneVerificationRepository
      Port that stores the pending verifications.
    • hasConfirmedSecondFactorUseCase

      private final HasConfirmedSecondFactorUseCase hasConfirmedSecondFactorUseCase
      Use case telling whether the user still has a confirmed second factor.
    • trustedDeviceRepository

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

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

    • RemovePhoneUseCase

      public RemovePhoneUseCase()
  • Method Details

    • execute

      public void execute(UUID userId, String username)
      Removes the phone and any pending verification of a user.
      Parameters:
      userId - identifier of the user.
      username - name of the user, for the audit log.