class CNCertificateIdentityMapping implements CertificateIdentityMapping {

    private static Pattern cnPattern = Pattern.compile("(?i)(cn=)([^,]*)");
    
    /**
     * Maps certificate CommonName as identity credentials
     * 
     * @param certificate the certificates to map
     * @return A List of names.
     */
    @Override
    public List<String> mapIdentity(X509Certificate certificate) {<FILL_FUNCTION_BODY>}

    /**
     * Returns the short name of mapping
     * 
     * @return The short name of the mapping
     */
    @Override
    public String name() {
        return "Common Name Mapping";
    }

}

        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;
    
<no_super_class>