@Test public void isUnitInIeWhitelist() { assertFalse(dssSignatureService.isUnitInIeWhitelist("")); assertFalse(dssSignatureService.isUnitInIeWhitelist(null)); assertFalse(dssSignatureService.isUnitInIeWhitelist("TSTNMT2321000156-1077")); ReflectionTestUtils .setField(dssSignatureService, "dssUnitWhitelistForIe", Arrays.asList("")); assertFalse(dssSignatureService.isUnitInIeWhitelist("TSTNMT2321000156-1077")); assertFalse(dssSignatureService.isUnitInIeWhitelist("TSTNMT23210001512-WILDCARD")); assertFalse(dssSignatureService.isUnitInIeWhitelist("TSTNMT23210001512WILDCARD")); assertFalse(dssSignatureService.isUnitInIeWhitelist("FINNS_INTE")); ReflectionTestUtils .setField(dssSignatureService, "dssUnitWhitelistForIe", Arrays.asList("*")); assertTrue(dssSignatureService.isUnitInIeWhitelist("TSTNMT2321000156-1077")); assertTrue(dssSignatureService.isUnitInIeWhitelist("TSTNMT23210001512-WILDCARD")); assertTrue(dssSignatureService.isUnitInIeWhitelist("TSTNMT23210001512WILDCARD")); assertTrue(dssSignatureService.isUnitInIeWhitelist("FINNS_INTE")); ReflectionTestUtils .setField(dssSignatureService, "dssUnitWhitelistForIe", Arrays.asList("TSTNMT2321000156-1077", "TSTNMT23210001512-*")); assertTrue(dssSignatureService.isUnitInIeWhitelist("TSTNMT2321000156-1077")); assertFalse(dssSignatureService.isUnitInIeWhitelist("TSTNMT2321000156-107")); assertFalse(dssSignatureService.isUnitInIeWhitelist("TSTNMT2321000156-10777")); assertTrue(dssSignatureService.isUnitInIeWhitelist("TSTNMT23210001512-WILDCARD")); assertFalse(dssSignatureService.isUnitInIeWhitelist("TSTNMT23210001512WILDCARD")); assertFalse(dssSignatureService.isUnitInIeWhitelist("FINNS_INTE")); ReflectionTestUtils .setField(dssSignatureService, "dssUnitWhitelistForIe", Arrays.asList("tStNmT2321000156-1077", "tStNmT23210001512-*")); assertTrue(dssSignatureService.isUnitInIeWhitelist("TsTnMt2321000156-1077")); assertTrue(dssSignatureService.isUnitInIeWhitelist("TsTnMt23210001512-WILDCARD")); assertFalse(dssSignatureService.isUnitInIeWhitelist("TsTnMt23210001512WILDCARD")); assertFalse(dssSignatureService.isUnitInIeWhitelist("FiNNS_iNTE")); ReflectionTestUtils .setField(dssSignatureService, "dssUnitWhitelistForIe", Arrays.asList("TSTNMT23210001512*")); assertFalse(dssSignatureService.isUnitInIeWhitelist("TSTNMT2321000156-1077")); assertTrue(dssSignatureService.isUnitInIeWhitelist("TSTNMT23210001512-WILDCARD")); assertTrue(dssSignatureService.isUnitInIeWhitelist("TSTNMT23210001512WILDCARD")); assertFalse(dssSignatureService.isUnitInIeWhitelist("FINNS_INTE")); }
public boolean isUnitInIeWhitelist(String currentCareUnitHsaId) { if (StringUtils.isEmpty(currentCareUnitHsaId)) { return false; } boolean inWhitelist = false; for (String hsaIdInWhitelist : dssUnitWhitelistForIe) { if (hsaIdInWhitelist.endsWith("*")) { var wildcardRemovedSubstring = hsaIdInWhitelist.substring(0, hsaIdInWhitelist.lastIndexOf("*")); inWhitelist = currentCareUnitHsaId.toUpperCase().startsWith(wildcardRemovedSubstring.toUpperCase()); } else { inWhitelist = currentCareUnitHsaId.equalsIgnoreCase(hsaIdInWhitelist); } if (inWhitelist) { break; } } return inWhitelist; }
DssSignatureService { public boolean isUnitInIeWhitelist(String currentCareUnitHsaId) { if (StringUtils.isEmpty(currentCareUnitHsaId)) { return false; } boolean inWhitelist = false; for (String hsaIdInWhitelist : dssUnitWhitelistForIe) { if (hsaIdInWhitelist.endsWith("*")) { var wildcardRemovedSubstring = hsaIdInWhitelist.substring(0, hsaIdInWhitelist.lastIndexOf("*")); inWhitelist = currentCareUnitHsaId.toUpperCase().startsWith(wildcardRemovedSubstring.toUpperCase()); } else { inWhitelist = currentCareUnitHsaId.equalsIgnoreCase(hsaIdInWhitelist); } if (inWhitelist) { break; } } return inWhitelist; } }
DssSignatureService { public boolean isUnitInIeWhitelist(String currentCareUnitHsaId) { if (StringUtils.isEmpty(currentCareUnitHsaId)) { return false; } boolean inWhitelist = false; for (String hsaIdInWhitelist : dssUnitWhitelistForIe) { if (hsaIdInWhitelist.endsWith("*")) { var wildcardRemovedSubstring = hsaIdInWhitelist.substring(0, hsaIdInWhitelist.lastIndexOf("*")); inWhitelist = currentCareUnitHsaId.toUpperCase().startsWith(wildcardRemovedSubstring.toUpperCase()); } else { inWhitelist = currentCareUnitHsaId.equalsIgnoreCase(hsaIdInWhitelist); } if (inWhitelist) { break; } } return inWhitelist; } @Autowired  DssSignatureService(DssMetadataService dssMetadataService, DssSignMessageService dssSignMessageService,
        WebCertUserService userService, UtkastRepository utkastRepository, UnderskriftService underskriftService,
        RedisTicketTracker redisTicketTracker, MonitoringLogService monitoringLogService, IntygModuleRegistry moduleRegistry); }
DssSignatureService { public boolean isUnitInIeWhitelist(String currentCareUnitHsaId) { if (StringUtils.isEmpty(currentCareUnitHsaId)) { return false; } boolean inWhitelist = false; for (String hsaIdInWhitelist : dssUnitWhitelistForIe) { if (hsaIdInWhitelist.endsWith("*")) { var wildcardRemovedSubstring = hsaIdInWhitelist.substring(0, hsaIdInWhitelist.lastIndexOf("*")); inWhitelist = currentCareUnitHsaId.toUpperCase().startsWith(wildcardRemovedSubstring.toUpperCase()); } else { inWhitelist = currentCareUnitHsaId.equalsIgnoreCase(hsaIdInWhitelist); } if (inWhitelist) { break; } } return inWhitelist; } @Autowired  DssSignatureService(DssMetadataService dssMetadataService, DssSignMessageService dssSignMessageService,
        WebCertUserService userService, UtkastRepository utkastRepository, UnderskriftService underskriftService,
        RedisTicketTracker redisTicketTracker, MonitoringLogService monitoringLogService, IntygModuleRegistry moduleRegistry); boolean isUnitInIeWhitelist(String currentCareUnitHsaId); DssSignRequestDTO createSignatureRequestDTO(SignaturBiljett sb); String createTransactionID(); @SuppressWarnings("unchecked") SignaturBiljett receiveSignResponse(String relayState, String eIdSignResponse); String findReturnErrorUrl(String intygsId, String ticketId); String findReturnUrl(String intygsId); SignaturBiljett updateSignatureTicketWithError(String relayState); }
DssSignatureService { public boolean isUnitInIeWhitelist(String currentCareUnitHsaId) { if (StringUtils.isEmpty(currentCareUnitHsaId)) { return false; } boolean inWhitelist = false; for (String hsaIdInWhitelist : dssUnitWhitelistForIe) { if (hsaIdInWhitelist.endsWith("*")) { var wildcardRemovedSubstring = hsaIdInWhitelist.substring(0, hsaIdInWhitelist.lastIndexOf("*")); inWhitelist = currentCareUnitHsaId.toUpperCase().startsWith(wildcardRemovedSubstring.toUpperCase()); } else { inWhitelist = currentCareUnitHsaId.equalsIgnoreCase(hsaIdInWhitelist); } if (inWhitelist) { break; } } return inWhitelist; } @Autowired  DssSignatureService(DssMetadataService dssMetadataService, DssSignMessageService dssSignMessageService,
        WebCertUserService userService, UtkastRepository utkastRepository, UnderskriftService underskriftService,
        RedisTicketTracker redisTicketTracker, MonitoringLogService monitoringLogService, IntygModuleRegistry moduleRegistry); boolean isUnitInIeWhitelist(String currentCareUnitHsaId); DssSignRequestDTO createSignatureRequestDTO(SignaturBiljett sb); String createTransactionID(); @SuppressWarnings("unchecked") SignaturBiljett receiveSignResponse(String relayState, String eIdSignResponse); String findReturnErrorUrl(String intygsId, String ticketId); String findReturnUrl(String intygsId); SignaturBiljett updateSignatureTicketWithError(String relayState); static final String RESULTMAJOR_SUCCESS; static final String REQUESTED_SIGN_ALGORITHM; }