@Override
    public List<String> mapIdentity(X509Certificate certificate) {
        String name = certificate.getSubjectDN().getName();
        Matcher matcher = cnPattern.matcher(name);
        // Create an array with the detected identities
        List<String> names = new ArrayList<>();
        while (matcher.find()) {
            names.add(matcher.group(2));
        }
        
        return names;
    }
Maps certificate CommonName as identity credentials

@param certificate the certificates to map
@return A List of names.
xmppserver/src/main/java/org/jivesoftware/util/cert/CNCertificateIdentityMapping.java