public static IGTFInfo.Builder builder(Type type) { return new IGTFInfo(type).new Builder(); }
private String checkValidQuotedDn(String value) throws ParserException { checkMutable(); checkValid(value.startsWith("\""), "value does not start with '\"'"); checkValid(value.endsWith("\""), "value does not end with '\"'"); checkValid(value.length() > 2, "missing quoted content"); return value.substring(1, value.length()-1); }
private void addPrincipals(IGTFInfo info) { switch (info.getType()) { case TRUST_ANCHOR: Status s = info.getStatus(); IGTFStatusPrincipal st = new IGTFStatusPrincipal(TO_NAME.get(s), s.isAccredited()); taStatus.put(info.getSubjectDN(), st); break; case POLICY: IGTFPolicyPrincipal policy = new IGTFPolicyPrincipal(info.getName()); info.getSubjectDNs().forEach(dn -> taPolicies.put(dn, policy)); break; } } }
private void checkValid() throws ParserException { require(version != null, "version", POLICY, TRUST_ANCHOR); require(!dns.isEmpty(), "subjectdn", POLICY, TRUST_ANCHOR); require(!policyRequires.isEmpty(), "requires", POLICY); require(alias != null, "alias", TRUST_ANCHOR); require(crlUrl != null, "crl_url", TRUST_ANCHOR); require(email != null, "email", TRUST_ANCHOR); require(status != null, "status", TRUST_ANCHOR); if (problems != null) { String description = problems.size() == 1 ? problems.get(0) : problems.toString(); throw new ParserException("bad info file: " + description); } }
private static IGTFInfo read(Path path, Type type) throws IOException, ParserException IGTFInfo.Builder builder = IGTFInfo.builder(type); builder.setFilename(path.getFileName().toString());
public void setSubjectDN(String value) throws ParserException { checkMutable(); ImmutableList.Builder<GlobusPrincipal> dns = ImmutableList.builder(); if (type == TRUST_ANCHOR) { GlobusPrincipal p = new GlobusPrincipal(checkValidQuotedDn(value)); dns.add(p); IGTFInfo.this.dns = dns.build(); } else { // REVISIT: how to handle DNs with a double-quote? for (String dn : Splitter.on(',').omitEmptyStrings().trimResults().split(value)) { GlobusPrincipal p = new GlobusPrincipal(checkValidQuotedDn(dn)); dns.add(p); } ImmutableList<GlobusPrincipal> list = dns.build(); checkValid(!list.isEmpty(), "no Distinguished Names"); IGTFInfo.this.dns = list; } }