diff options
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java')
-rw-r--r-- | eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java index d43a175f..03cf5858 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java @@ -91,7 +91,7 @@ import lombok.extern.slf4j.Slf4j; * </ul> * Output: * <ul> - * <li>{@link Constants#DATA_RESULT_MATCHING_BPK} if one register result found</li> + * <li>{@link Constants#DATA_PERSON_MATCH_RESULT} if one register result found</li> * </ul> * Transitions: * <ul> @@ -150,83 +150,83 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet Pair<PvpSProfileResponse, Boolean> processedMsg = validateAssertion((PvpSProfileResponse) inboundMessage); if (processedMsg.getSecond()) { // forward to next matching step in case of ID Autria authentication was stopped by user - executionContext.put(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK, true); + executionContext.put(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK, true); return; - + } // validate SAML2 response validateEntityId(inboundMessage); log.info("Receive a valid assertion from IDP " + inboundMessage.getEntityID()); - + // load already existing information from session SimpleEidasData eidasData = MatchingTaskUtils.getInitialEidasData(pendingReq); RegisterStatusResults initialSearchResult = MatchingTaskUtils.getIntermediateMatchingResult(pendingReq); - + // extract user information from ID Austria authentication AssertionAttributeExtractor extractor = new AssertionAttributeExtractor(processedMsg.getFirst().getResponse()); SimpleMobileSignatureData simpleMobileSignatureData = getAuthDataFromInterfederation(extractor); - - // check if MDS from ID Austria authentication matchs to eIDAS authentication + + // check if MDS from ID Austria authentication matchs to eIDAS authentication if (!simpleMobileSignatureData.equalsSimpleEidasData(eidasData)) { // user has cheated!? - throw new InvalidUserInputException("module.eidasauth.matching.05"); - + throw new InvalidUserInputException("module.eidasauth.matching.05"); + } - + // search entry in initial search result from steps before and build new RegisterSearchResult RegisterStatusResults registerResult = new RegisterStatusResults(initialSearchResult.getOperationStatus(), extractEntriesByBpk(initialSearchResult.getResultsZmr().stream(), simpleMobileSignatureData.getBpk()), extractEntriesByBpk(initialSearchResult.getResultsErnp().stream(), simpleMobileSignatureData.getBpk())); - + if (registerResult.getResultCount() != 1) { throw new WorkflowException("matchWithIDAustriaAuthentication", "Suspect state detected. MDS matches to eIDAS authentication " - + "but register search-result with MDS contains #" + registerResult.getResultCount() - + " entry with bPK from ID Austria authentication", false); - + + "but register search-result with MDS contains #" + registerResult.getResultCount() + + " entry with bPK from ID Austria authentication", false); + } else { // perform kit operation registerSearchService.step7aKittProcess(registerResult, eidasData); - - // store search result to re-used in CreateIdentityLink step, because there we need bPK and MDS - MatchingTaskUtils.storeFinalMatchingResult(pendingReq, - MatchedPersonResult.generateFormMatchingResult(registerResult.getResult(), + + // store search result to re-used in CreateIdentityLink step, because there we need bPK and MDS + MatchingTaskUtils.storeFinalMatchingResult(pendingReq, + MatchedPersonResult.generateFormMatchingResult(registerResult.getResult(), eidasData.getCitizenCountryCode())); - - } - + + } + } catch (final AuthnResponseValidationException e) { throw new TaskExecutionException(pendingReq, ERROR_MSG_03, e); - + } catch (MessageDecodingException | SecurityException | SamlSigningException e) { //final String samlRequest = request.getParameter("SAMLRequest"); //log.debug("Receive INVALID PVP Response from 'ms-specific eIDAS node': {}", // samlRequest, null, e); throw new TaskExecutionException(pendingReq, ERROR_MSG_00, new AuthnResponseValidationException(ERROR_PVP_11, new Object[]{MODULE_NAME_FOR_LOGGING}, e)); - + } catch (IOException | MarshallingException | TransformerException e) { log.debug("Processing PVP response from 'ms-specific eIDAS node' FAILED.", e); throw new TaskExecutionException(pendingReq, ERROR_MSG_01, new AuthnResponseValidationException(ERROR_PVP_12, new Object[]{MODULE_NAME_FOR_LOGGING, e.getMessage()}, e)); - + } catch (final CredentialsNotAvailableException e) { log.debug("PVP response decryption FAILED. No credential found.", e); throw new TaskExecutionException(pendingReq, ERROR_MSG_02, new AuthnResponseValidationException(ERROR_PVP_10, new Object[]{MODULE_NAME_FOR_LOGGING}, e)); - + } catch (final Exception e) { // todo catch ManualFixNecessaryException in any other way? log.debug("PVP response validation FAILED. Msg:" + e.getMessage(), e); throw new TaskExecutionException(pendingReq, ERROR_MSG_03, new AuthnResponseValidationException(ERROR_PVP_12, new Object[]{MODULE_NAME_FOR_LOGGING, e.getMessage()}, e)); - + } } private List<RegisterResult> extractEntriesByBpk(Stream<RegisterResult> stream, String bpk) { - return stream.filter(el -> bpk.equals(el.getBpk())).collect(Collectors.toList()); + return stream.filter(el -> bpk.equals(el.getBpk())).collect(Collectors.toList()); } @@ -354,7 +354,7 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet } if (PvpAttributeDefinitions.BIRTHDATE_NAME.equals(attrName)) { builder.dateOfBirth(extractor.getSingleAttributeValue(attrName)); - } + } if (PvpAttributeDefinitions.EID_CITIZEN_EIDAS_QAA_LEVEL_NAME.equals(attrName)) { MatchingTaskUtils.getAuthProcessDataWrapper(pendingReq).setQaaLevel( extractor.getSingleAttributeValue(attrName)); @@ -362,7 +362,7 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet } MatchingTaskUtils.getAuthProcessDataWrapper(pendingReq).setIssueInstant(extractor.getAssertionIssuingDate()); return builder.build(); - + } |