def get_subjects(request):
    """Get all subjects in the certificate.

    - Returns: primary_str (primary subject), equivalent_set (equivalent identities,
      groups and group memberships)
    - The primary subject is the certificate subject DN, serialized to a DataONE
      compliant subject string.

    """
    if _is_certificate_provided(request):
        try:
            return get_authenticated_subjects(request.META['SSL_CLIENT_CERT'])
        except Exception as e:
            raise d1_common.types.exceptions.InvalidToken(
                0,
                'Error extracting session from certificate. error="{}"'.format(str(e)),
            )
    else:
        return d1_common.const.SUBJECT_PUBLIC, set()