@Override protected String resolvePrincipalInternal(final X509Certificate certificate) { LOGGER.debug("Resolving principal for [{}]", certificate); val sb = new StringBuffer(); val m = ATTR_PATTERN.matcher(this.descriptor); val attrMap = new HashMap<String, AttributeContext>(); val rdnSequence = new NameReader(certificate).readSubject(); while (m.find()) { val name = m.group(1); if (!attrMap.containsKey(name)) { val values = getAttributeValues(rdnSequence, StandardAttributeType.fromName(name)); attrMap.put(name, new AttributeContext(values)); } val context = attrMap.get(name); m.appendReplacement(sb, context.nextValue()); } m.appendTail(sb); return sb.toString(); }
if (!attrMap.containsKey(name)) { values = getAttributeValues(rdnSequence, StandardAttributeType.fromName(name)); attrMap.put(name, new AttributeContext(name, values));