| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.pollex.pam.config.ApplicationProperties; |
| | | import com.pollex.pam.security.provider.OtpAuthenticationProvider; |
| | | import com.pollex.pam.service.dto.OtpResponseDTO; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | @Autowired |
| | | OtpTmpService otpTmpService; |
| | | |
| | | @Autowired |
| | | LoginRecordService loginRecordService; |
| | | |
| | | @Transactional |
| | | public void verifyOtp(VerifyOtpVM verifyOtpParam) { |
| | | verifyOtp(verifyOtpParam.getAccount(), verifyOtpParam.getIndexKey(), verifyOtpParam.getOtpCode()); |
| | |
| | | public void verifyOtp(String account, String indexKey, String otpCode) { |
| | | try { |
| | | if(applicationProperty.isMockLogin()){ |
| | | loginRecordService.saveOTPLoginSuccessRecord(account); |
| | | log.debug("Do MockLogin"); |
| | | } else { // otp logon |
| | | OtpResponseDTO otpResponseDTO = otpWebService.verifyOTP(indexKey, otpCode); |
| | | if (!otpResponseDTO.isSuccess()) { |
| | | if (otpResponseDTO.isSuccess()) { |
| | | loginRecordService.saveOTPLoginSuccessRecord(account); |
| | | } |
| | | else { |
| | | loginRecordService.saveOTPLoginFailRecord(account, otpResponseDTO.getFailReason()); |
| | | throw new AuthenticationCredentialsNotFoundException(""); |
| | | } |
| | | } |