Class RecoveryServiceImpl
- java.lang.Object
-
- org.molgenis.security.twofactor.service.RecoveryServiceImpl
-
- All Implemented Interfaces:
RecoveryService
@Service public class RecoveryServiceImpl extends Object implements RecoveryService
-
-
Constructor Summary
Constructors Constructor Description RecoveryServiceImpl(DataService dataService, UserService userService, RecoveryCodeFactory recoveryCodeFactory, IdGenerator idGenerator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stream<RecoveryCode>generateRecoveryCodes()Generates new recovery codes for the current user and deletes the old codes (if any).Stream<RecoveryCode>getRecoveryCodes()Get the recovery codes (if any) of the current user.voiduseRecoveryCode(String recoveryCode)Checks if a recovery code is valid for the current user and throws an exception if it is not.
-
-
-
Constructor Detail
-
RecoveryServiceImpl
public RecoveryServiceImpl(DataService dataService, UserService userService, RecoveryCodeFactory recoveryCodeFactory, IdGenerator idGenerator)
-
-
Method Detail
-
generateRecoveryCodes
@Transactional public Stream<RecoveryCode> generateRecoveryCodes()
Description copied from interface:RecoveryServiceGenerates new recovery codes for the current user and deletes the old codes (if any).- Specified by:
generateRecoveryCodesin interfaceRecoveryService- Returns:
- stream of the new RecoveryCodes
-
useRecoveryCode
@Transactional public void useRecoveryCode(String recoveryCode)
Description copied from interface:RecoveryServiceChecks if a recovery code is valid for the current user and throws an exception if it is not. The code is removed after a successful recovery attempt.- Specified by:
useRecoveryCodein interfaceRecoveryService- Parameters:
recoveryCode- the code to validate
-
getRecoveryCodes
public Stream<RecoveryCode> getRecoveryCodes()
Description copied from interface:RecoveryServiceGet the recovery codes (if any) of the current user.- Specified by:
getRecoveryCodesin interfaceRecoveryService- Returns:
- stream of recovery codes
-
-