@Override
    public List<String> mapIdentity( X509Certificate certificate )
    {
        List<String> identities = new ArrayList<>();
        try
        {
            Collection<List<?>> altNames = certificate.getSubjectAlternativeNames();
            // Check that the certificate includes the SubjectAltName extension
            if ( altNames == null )
            {
                return Collections.emptyList();
            }
            for ( List<?> item : altNames )
            {
                final Integer type = (Integer) item.get( 0 );
                final Object value = item.get( 1 ); // this is either a string, or a byte-array that represents the ASN.1 DER encoded form.
                final String result = switch (type) {
                    case 0 -> // OtherName: search for "id-on-xmppAddr" or 'sRVName' or 'userPrincipalName'
                        parseOtherName((byte[]) value);
                    case 2 -> // DNS
                        (String) value;
                    case 6 -> // URI
                        (String) value;
                    default -> // Not applicable to XMPP, so silently ignore them
                        null;
                };

                if ( result != null )
                {
                    identities.add( result );
                }
            }
        }
        catch ( CertificateParsingException e )
        {
            Log.error( "Error parsing SubjectAltName in certificate: " + certificate.getSubjectDN(), e );
        }
        return identities;
    }
Returns the JID representation of an XMPP entity contained as a SubjectAltName extension
in the certificate. If none was found then return an empty list.

@param certificate the certificate presented by the remote entity.
@return the JID representation of an XMPP entity contained as a SubjectAltName extension
in the certificate. If none was found then return an empty list.
xmppserver/src/main/java/org/jivesoftware/util/cert/SANCertificateIdentityMapping.java