public static AthenzIdentity getIdentityFromRoleCertificate(X509Certificate certificate) {
        List<SubjectAlternativeName> sans = X509CertificateUtils.getSubjectAlternativeNames(certificate);
        return getRoleIdentityFromEmail(sans)
                .or(() -> getRoleIdentityFromUri(sans))
                .orElseThrow(() -> new IllegalArgumentException("Could not find identity in SAN: " + sans));
    }
Utility methods for Athenz issued x509 certificates

@author bjorncs
vespa-athenz/src/main/java/com/yahoo/vespa/athenz/tls/AthenzX509CertificateUtils.java