Package com.almis.awe.service
Class TotpService
java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.service.TotpService
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
Manage application accesses
-
Constructor Summary
ConstructorDescriptionTotpService
(dev.samstevens.totp.secret.SecretGenerator secretGenerator, dev.samstevens.totp.qr.QrDataFactory qrDataFactory, dev.samstevens.totp.qr.QrGenerator qrGenerator, dev.samstevens.totp.code.CodeVerifier codeVerifier) Autowired constructor -
Method Summary
Modifier and TypeMethodDescriptionGenerate secret codebyte[]
Retrieve QR Code in PNG format as StringgetQRCodeList
(Boolean generate) Generate QR codeupdate2faStatus
(Integer enabled) Update 2fa statusboolean
verify2faCode
(String code) Verify if code is validMethods inherited from class com.almis.awe.config.ServiceConfig
containsBean, getApplicationContext, getBean, getBean, getElements, getLocale, getLocale, getProperty, getProperty, getRequest, getSession, setApplicationContext
-
Constructor Details
-
TotpService
public TotpService(dev.samstevens.totp.secret.SecretGenerator secretGenerator, dev.samstevens.totp.qr.QrDataFactory qrDataFactory, dev.samstevens.totp.qr.QrGenerator qrGenerator, dev.samstevens.totp.code.CodeVerifier codeVerifier) Autowired constructor- Parameters:
secretGenerator
- Secret generatorqrDataFactory
- QR Data factoryqrGenerator
- QR Code generatorcodeVerifier
- TOTP Code verifier
-
-
Method Details
-
getQRCode
public byte[] getQRCode() throws dev.samstevens.totp.exceptions.QrGenerationExceptionRetrieve QR Code in PNG format as String- Returns:
- QR Code as string
- Throws:
dev.samstevens.totp.exceptions.QrGenerationException
-
getQRCodeList
Generate QR code- Returns:
- Service data
- Throws:
AWException
-
generate2faSecret
Generate secret code- Returns:
- Service data
- Throws:
AWException
-
update2faStatus
Update 2fa status- Returns:
- Service data
-
verify2faCode
Verify if code is valid- Parameters:
code
- Code to check- Returns:
- Code is valid or not
-