-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #389: SCA passes even though iProov failed #390
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8fb0565
Fix #389: SCA passes even though iProov failed
banterCZ 7933f33
Improve logging
banterCZ 41cd9e3
Improve logging
banterCZ aa3a41d
Introduce PRESENCE_CHECK / VERIFICATION_PENDING
banterCZ ff520da
Fix 500
banterCZ f3150ca
Add PresenceCheckSubmitRequest
banterCZ 9700036
Change phase and status in service
banterCZ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
.../wultra/app/enrollmentserver/api/model/onboarding/request/PresenceCheckSubmitRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* PowerAuth Enrollment Server | ||
* Copyright (C) 2022 Wultra s.r.o. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.wultra.app.enrollmentserver.api.model.onboarding.request; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* Request class used when submitting presence check. | ||
* | ||
* @author Lubos Racansky, lubos.racansky@wultra.com | ||
*/ | ||
@Data | ||
public class PresenceCheckSubmitRequest { | ||
|
||
private String processId; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,29 +20,27 @@ | |
import com.wultra.app.enrollmentserver.api.model.onboarding.response.OtpVerifyResponse; | ||
import com.wultra.app.enrollmentserver.model.enumeration.*; | ||
import com.wultra.app.enrollmentserver.model.integration.OwnerId; | ||
import com.wultra.app.onboardingserver.common.database.IdentityVerificationRepository; | ||
import com.wultra.app.onboardingserver.common.database.OnboardingOtpRepository; | ||
import com.wultra.app.onboardingserver.common.database.OnboardingProcessRepository; | ||
import com.wultra.app.onboardingserver.common.database.entity.IdentityVerificationEntity; | ||
import com.wultra.app.onboardingserver.common.database.entity.OnboardingOtpEntity; | ||
import com.wultra.app.onboardingserver.common.database.entity.OnboardingProcessEntity; | ||
import com.wultra.app.onboardingserver.common.enumeration.OnboardingProcessError; | ||
import com.wultra.app.onboardingserver.common.errorhandling.OnboardingProcessException; | ||
import com.wultra.app.onboardingserver.common.service.OnboardingProcessLimitService; | ||
import com.wultra.app.onboardingserver.configuration.IdentityVerificationConfig; | ||
import com.wultra.app.onboardingserver.common.database.IdentityVerificationRepository; | ||
import com.wultra.app.onboardingserver.common.database.entity.IdentityVerificationEntity; | ||
import com.wultra.app.onboardingserver.errorhandling.OnboardingOtpDeliveryException; | ||
import com.wultra.app.onboardingserver.errorhandling.OnboardingProviderException; | ||
import com.wultra.app.onboardingserver.provider.OnboardingProvider; | ||
import com.wultra.app.onboardingserver.provider.model.request.SendOtpCodeRequest; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.i18n.LocaleContextHolder; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.Date; | ||
import java.util.Optional; | ||
|
||
import static com.wultra.app.enrollmentserver.model.enumeration.IdentityVerificationPhase.PRESENCE_CHECK; | ||
|
||
|
@@ -182,13 +180,12 @@ private OtpVerifyResponse verifyPresenceCheck(final OnboardingProcessEntity proc | |
final String rejectReason = idVerification.getRejectReason(); | ||
final RejectOrigin rejectOrigin = idVerification.getRejectOrigin(); | ||
|
||
if (errorOrigin == ErrorOrigin.PRESENCE_CHECK && StringUtils.isNotBlank(errorDetail) | ||
|| rejectOrigin == RejectOrigin.PRESENCE_CHECK && StringUtils.isNotBlank(rejectReason)) { | ||
if (errorOrigin == ErrorOrigin.PRESENCE_CHECK || rejectOrigin == RejectOrigin.PRESENCE_CHECK) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure whether this is a permanent or temporary change. When we called iProov validate before verification, the reject reason was |
||
logger.info("SCA failed, identity verification ID: {} of process ID: {} contains errorDetail: {}, rejectReason: {} from previous step", | ||
idVerification.getId(), processId, errorDetail, rejectReason); | ||
return moveToPhasePresenceCheck(process, response, idVerification); | ||
} else { | ||
logger.debug("PRESENCE_CHECK without error or reject reason, process ID: {}", idVerification.getProcessId()); | ||
logger.debug("PRESENCE_CHECK without error or reject origin, process ID: {}", idVerification.getProcessId()); | ||
} | ||
return response; | ||
} | ||
|
@@ -244,19 +241,10 @@ private void markVerificationOtpAsFailed(String processId) throws OnboardingProc | |
* @throws OnboardingOtpDeliveryException Thrown when OTP code could not be sent. | ||
*/ | ||
private void sendOtpCode(String processId, boolean isResend) throws OnboardingProcessException, OnboardingOtpDeliveryException { | ||
final Optional<OnboardingProcessEntity> processOptional = onboardingProcessRepository.findById(processId); | ||
if (processOptional.isEmpty()) { | ||
logger.warn("Onboarding process not found: {}", processId); | ||
throw new OnboardingProcessException(); | ||
} | ||
final OnboardingProcessEntity process = processOptional.get(); | ||
// Create an OTP code | ||
final String otpCode; | ||
if (isResend) { | ||
otpCode = otpService.createOtpCodeForResend(process, OtpType.USER_VERIFICATION); | ||
} else { | ||
otpCode = otpService.createOtpCode(process, OtpType.USER_VERIFICATION); | ||
} | ||
final OnboardingProcessEntity process = onboardingProcessRepository.findById(processId).orElseThrow(() -> | ||
new OnboardingProcessException("Onboarding process not found: " + processId)); | ||
|
||
final String otpCode = createOtpCode(isResend, process); | ||
// Send the OTP code | ||
try { | ||
final SendOtpCodeRequest request = SendOtpCodeRequest.builder() | ||
|
@@ -274,4 +262,11 @@ private void sendOtpCode(String processId, boolean isResend) throws OnboardingPr | |
} | ||
} | ||
|
||
private String createOtpCode(final boolean isResend, final OnboardingProcessEntity process) throws OnboardingOtpDeliveryException, OnboardingProcessException { | ||
if (isResend) { | ||
return otpService.createOtpCodeForResend(process, OtpType.USER_VERIFICATION); | ||
} else { | ||
return otpService.createOtpCode(process, OtpType.USER_VERIFICATION); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kober32 A new endpoint.