diff --git a/src/main/java/org/italiangrid/storm/webdav/authz/vomap/MapfileVOMembershipSource.java b/src/main/java/org/italiangrid/storm/webdav/authz/vomap/MapfileVOMembershipSource.java index 54a3dce3..071ed028 100644 --- a/src/main/java/org/italiangrid/storm/webdav/authz/vomap/MapfileVOMembershipSource.java +++ b/src/main/java/org/italiangrid/storm/webdav/authz/vomap/MapfileVOMembershipSource.java @@ -64,12 +64,12 @@ private CSVParser getParser() { private boolean isValidCSVRecord(CSVRecord r) { if (r.size() > 3) { - logger.debug("Invalid CSVRecord: {}. Illegal size: {}", r, r.size()); + logger.warn("Invalid CSVRecord: {}. Illegal size: {}", r, r.size()); return false; } if (!r.get(0).startsWith("/")) { - logger.debug("Invalid CSVRecord: {}. Subject does not start with / : {}", + logger.warn("Invalid CSVRecord: {}. Subject does not start with / : {}", r, r.get(0)); return false; } @@ -97,7 +97,8 @@ public Set getVOMembers() { } if (!isValidCSVRecord(r)) { - break; + /* Fix https://issues.infn.it/jira/browse/STOR-1399 */ + continue; } String subject = r.get(0); diff --git a/src/test/java/org/italiangrid/storm/webdav/test/authz/vomap/VOMSMapTests.java b/src/test/java/org/italiangrid/storm/webdav/test/authz/vomap/VOMSMapTests.java index e52d3974..d9b0a976 100644 --- a/src/test/java/org/italiangrid/storm/webdav/test/authz/vomap/VOMSMapTests.java +++ b/src/test/java/org/italiangrid/storm/webdav/test/authz/vomap/VOMSMapTests.java @@ -24,18 +24,28 @@ public class VOMSMapTests { - public static final String MY_SUBJECT = "CN=Andrea Ceccanti,L=CNAF,OU=Personal Certificate,O=INFN,C=IT"; - @Test - void VOMapParserTest() { - - MapfileVOMembershipSource m = new MapfileVOMembershipSource("testers", - new File("src/test/resources/vomsmap/testers.map")); - - Assert.assertEquals("testers",m.getVOName()); - Assert.assertTrue(m.getVOMembers().contains(MY_SUBJECT)); - - Assert.assertFalse(m.getVOMembers().contains("CN=I am not Real, L=CNAF")); - - } + public static final String AC_SUBJECT = + "CN=Andrea Ceccanti,L=CNAF,OU=Personal Certificate,O=INFN,C=IT"; + public static final String EV_SUBJECT = + "CN=Enrico Vianello,L=CNAF,OU=Personal Certificate,O=INFN,C=IT"; + public static final String COMMA_SUBJECT = + "CN=Federica Agostini,L=CNAF,Bologna,OU=Personal Certificate,O=INFN,C=IT"; + public static final String RM_SUBJECT = + "CN=Roberta Miccoli,L=CNAF,OU=Personal Certificate,O=INFN,C=IT"; + + @Test + void VOMapParserTest() { + + MapfileVOMembershipSource m = new MapfileVOMembershipSource("testers", + new File("src/test/resources/vomsmap/testers.map")); + + Assert.assertEquals("testers", m.getVOName()); + Assert.assertTrue(m.getVOMembers().contains(AC_SUBJECT)); + Assert.assertTrue(m.getVOMembers().contains(EV_SUBJECT)); + Assert.assertFalse(m.getVOMembers().contains(COMMA_SUBJECT)); + Assert.assertTrue(m.getVOMembers().contains(RM_SUBJECT)); + Assert.assertFalse(m.getVOMembers().contains("CN=I am not Real, L=CNAF")); + + } } diff --git a/src/test/resources/vomsmap/testers.map b/src/test/resources/vomsmap/testers.map index 9eaa5fed..928a876e 100644 --- a/src/test/resources/vomsmap/testers.map +++ b/src/test/resources/vomsmap/testers.map @@ -1,2 +1,4 @@ /C=IT/O=INFN/OU=Personal Certificate/L=CNAF/CN=Andrea Ceccanti,/C=IT/O=INFN/CN=INFN CA,andrea.ceccanti@cnaf.infn.it -/C=IT/O=INFN/OU=Personal Certificate/L=CNAF/CN=Enrico Vianello,/C=IT/O=INFN/CN=INFN CA,enrico.vianello@cnaf.infn.it \ No newline at end of file +/C=IT/O=INFN/OU=Personal Certificate/L=CNAF/CN=Enrico Vianello,/C=IT/O=INFN/CN=INFN CA,enrico.vianello@cnaf.infn.it +/C=IT/O=INFN/OU=Personal Certificate/L=CNAF,Bologna/CN=Federica Agostini,/C=IT/O=INFN/CN=INFN CA,federica.agostini@cnaf.infn.it +/C=IT/O=INFN/OU=Personal Certificate/L=CNAF/CN=Roberta Miccoli,/C=IT/O=INFN/CN=INFN CA,roberta.miccoli@cnaf.infn.it \ No newline at end of file