@Test public void testLoadPersonalCertificatePermissionConfig() throws Exception { String configFile = PropertiesUtils.getResourceFile("personal-certificate-permissions-test.conf").getAbsolutePath(); PersonalCertificatePermissionConfig conf = PersonalCertificatePermissionConfigLoader.loadPersonalCertificatePermissionConfig(configFile); assertThat(conf.getPermissionsRequiringPersonalCertificate()) .containsExactlyInAnyOrder("contexts:read", "contexts:id:update"); assertThat(conf.getPermissionsWithoutPersonalCertificate()).containsExactlyInAnyOrder("ingests:create"); }
public static PersonalCertificatePermissionConfig loadPersonalCertificatePermissionConfig(String configFile) throws IOException { final PersonalCertificatePermissionConfig config; try (final InputStream personalCertificatePermissionIS = PropertiesUtils.getConfigAsStream( configFile)) { config = PropertiesUtils.readYaml( personalCertificatePermissionIS, PersonalCertificatePermissionConfig.class); } if (config.getPermissionsRequiringPersonalCertificate() == null) config.setPermissionsRequiringPersonalCertificate(Collections.EMPTY_SET); if (config.getPermissionsWithoutPersonalCertificate() == null) config.setPermissionsWithoutPersonalCertificate(Collections.EMPTY_SET); validateConfiguration(config); return config; }
PersonalCertificatePermissionConfigLoader { public static PersonalCertificatePermissionConfig loadPersonalCertificatePermissionConfig(String configFile) throws IOException { final PersonalCertificatePermissionConfig config; try (final InputStream personalCertificatePermissionIS = PropertiesUtils.getConfigAsStream( configFile)) { config = PropertiesUtils.readYaml( personalCertificatePermissionIS, PersonalCertificatePermissionConfig.class); } if (config.getPermissionsRequiringPersonalCertificate() == null) config.setPermissionsRequiringPersonalCertificate(Collections.EMPTY_SET); if (config.getPermissionsWithoutPersonalCertificate() == null) config.setPermissionsWithoutPersonalCertificate(Collections.EMPTY_SET); validateConfiguration(config); return config; } }
PersonalCertificatePermissionConfigLoader { public static PersonalCertificatePermissionConfig loadPersonalCertificatePermissionConfig(String configFile) throws IOException { final PersonalCertificatePermissionConfig config; try (final InputStream personalCertificatePermissionIS = PropertiesUtils.getConfigAsStream( configFile)) { config = PropertiesUtils.readYaml( personalCertificatePermissionIS, PersonalCertificatePermissionConfig.class); } if (config.getPermissionsRequiringPersonalCertificate() == null) config.setPermissionsRequiringPersonalCertificate(Collections.EMPTY_SET); if (config.getPermissionsWithoutPersonalCertificate() == null) config.setPermissionsWithoutPersonalCertificate(Collections.EMPTY_SET); validateConfiguration(config); return config; }  }
PersonalCertificatePermissionConfigLoader { public static PersonalCertificatePermissionConfig loadPersonalCertificatePermissionConfig(String configFile) throws IOException { final PersonalCertificatePermissionConfig config; try (final InputStream personalCertificatePermissionIS = PropertiesUtils.getConfigAsStream( configFile)) { config = PropertiesUtils.readYaml( personalCertificatePermissionIS, PersonalCertificatePermissionConfig.class); } if (config.getPermissionsRequiringPersonalCertificate() == null) config.setPermissionsRequiringPersonalCertificate(Collections.EMPTY_SET); if (config.getPermissionsWithoutPersonalCertificate() == null) config.setPermissionsWithoutPersonalCertificate(Collections.EMPTY_SET); validateConfiguration(config); return config; }  static PersonalCertificatePermissionConfig loadPersonalCertificatePermissionConfig(String configFile); }
PersonalCertificatePermissionConfigLoader { public static PersonalCertificatePermissionConfig loadPersonalCertificatePermissionConfig(String configFile) throws IOException { final PersonalCertificatePermissionConfig config; try (final InputStream personalCertificatePermissionIS = PropertiesUtils.getConfigAsStream( configFile)) { config = PropertiesUtils.readYaml( personalCertificatePermissionIS, PersonalCertificatePermissionConfig.class); } if (config.getPermissionsRequiringPersonalCertificate() == null) config.setPermissionsRequiringPersonalCertificate(Collections.EMPTY_SET); if (config.getPermissionsWithoutPersonalCertificate() == null) config.setPermissionsWithoutPersonalCertificate(Collections.EMPTY_SET); validateConfiguration(config); return config; }  static PersonalCertificatePermissionConfig loadPersonalCertificatePermissionConfig(String configFile);  }