Class TwoFactorAuthenticationServiceImpl
- java.lang.Object
-
- org.molgenis.security.twofactor.service.TwoFactorAuthenticationServiceImpl
-
- All Implemented Interfaces:
TwoFactorAuthenticationService
@Service public class TwoFactorAuthenticationServiceImpl extends Object implements TwoFactorAuthenticationService
-
-
Constructor Summary
Constructors Constructor Description TwoFactorAuthenticationServiceImpl(OtpService otpService, org.molgenis.data.DataService dataService, org.molgenis.data.security.user.UserService userService, org.molgenis.data.populate.IdGenerator idGenerator, UserSecretFactory userSecretFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisableForUser()Disable 2 factor authentication for the current uservoidenableForUser()StringgenerateSecretKey()booleanisConfiguredForUser()Check if the user is 2 factor authentication ready.booleanisVerificationCodeValidForUser(String verificationCode)Check verificationcode given by user from Google AuthenticatorvoidresetSecretForUser()voidsaveSecretForUser(String secret)Add generated userSecret to userdata.booleanuserIsBlocked()
-
-
-
Constructor Detail
-
TwoFactorAuthenticationServiceImpl
public TwoFactorAuthenticationServiceImpl(OtpService otpService, org.molgenis.data.DataService dataService, org.molgenis.data.security.user.UserService userService, org.molgenis.data.populate.IdGenerator idGenerator, UserSecretFactory userSecretFactory)
-
-
Method Detail
-
isVerificationCodeValidForUser
public boolean isVerificationCodeValidForUser(String verificationCode)
Description copied from interface:TwoFactorAuthenticationServiceCheck verificationcode given by user from Google Authenticator- Specified by:
isVerificationCodeValidForUserin interfaceTwoFactorAuthenticationService- Parameters:
verificationCode- code given by user from Google Authenticator- Returns:
- is verificationCode valid
-
userIsBlocked
public boolean userIsBlocked()
- Specified by:
userIsBlockedin interfaceTwoFactorAuthenticationService- Returns:
- user had too many authentication failures
-
saveSecretForUser
public void saveSecretForUser(String secret)
Description copied from interface:TwoFactorAuthenticationServiceAdd generated userSecret to userdata.- Specified by:
saveSecretForUserin interfaceTwoFactorAuthenticationService- Parameters:
secret- given secret for user
-
resetSecretForUser
public void resetSecretForUser()
- Specified by:
resetSecretForUserin interfaceTwoFactorAuthenticationService
-
enableForUser
public void enableForUser()
- Specified by:
enableForUserin interfaceTwoFactorAuthenticationService
-
disableForUser
public void disableForUser()
Description copied from interface:TwoFactorAuthenticationServiceDisable 2 factor authentication for the current userRemoves the secret key and set the TwoFactorAuthentication field to false
- Specified by:
disableForUserin interfaceTwoFactorAuthenticationService
-
generateSecretKey
public String generateSecretKey()
- Specified by:
generateSecretKeyin interfaceTwoFactorAuthenticationService- Returns:
- the secretkey for logged in user
-
isConfiguredForUser
public boolean isConfiguredForUser()
Description copied from interface:TwoFactorAuthenticationServiceCheck if the user is 2 factor authentication ready.- Specified by:
isConfiguredForUserin interfaceTwoFactorAuthenticationService- Returns:
- is configured for user
-
-