Returns all the entities of assertions for a subject, disregarding
        whether the assertion still is valid or not.

        :param subject_id: The identifier of the subject
        :return: A possibly empty list of entity identifiers
338389
def entities(self, subject_id):
        
        try:
            return [i["entity_id"] for i in self._cache.find({"subject_id":
                    subject_id})]
        except ValueError:
            return []
201472
def get_predicates(self, subject, object):
        
        for statement in self.spo_search(subject=subject, object=object):
            yield str(statement[1])
933652
def get_any_entity(self, id=None, uri=None, match=None):
        

        if not id and not uri and not match:
            return None

        if type(id) == type("string"):
            uri = id
            id = None
            if not is_http(uri):
                match = uri
                uri = None
        if match:
            if type(match) != type("string"):
                return []
            res = []
            if ":" in match:  # qname
                for x in self.all_classes:
                    if match.lower() in x.qname.lower():
                        res += [x]
                for x in self.all_properties:
                    if match.lower() in x.qname.lower():
                        res += [x]
            else:
                for x in self.all_classes:
                    if match.lower() in x.uri.lower():
                        res += [x]
                for x in self.all_properties:
                    if match.lower() in x.uri.lower():
                        res += [x]
            return res
        else:
            for x in self.all_classes:
                if id and x.id == id:
                    return x
                if uri and x.uri.lower() == uri.lower():
                    return x
            for x in self.all_properties:
                if id and x.id == id:
                    return x
                if uri and x.uri.lower() == uri.lower():
                    return x
            return None
875770
protected String getSessionIndex(final Assertion subjectAssertion) {
        List<AuthnStatement> authnStatements = subjectAssertion.getAuthnStatements();
        if (authnStatements != null && authnStatements.size() > 0) {
            AuthnStatement statement = authnStatements.get(0);
            if (statement != null) {
                return statement.getSessionIndex();
            }
        }
        return null;
    }
1262690
def get_subject_version_ids(self, subject):
        
        res = requests.get(self._url('/subjects/{}/versions', subject))
        raise_if_failed(res)
        return res.json()
843231
def is_trusted_subject(request):
    """"""
    logging.debug('Active subjects: {}'.format(', '.join(request.all_subjects_set)))
    logging.debug('Trusted subjects: {}'.format(', '.join(get_trusted_subjects())))
    return not request.all_subjects_set.isdisjoint(get_trusted_subjects())
1094588
def get_subject(self, subject_id):
        
        # subject_id could be a path such as '/user/j12y' so quote
        uri = self._get_subject_uri(guid=subject_id)
        return self.service._get(uri)
768880
def confirmMapIdentity(self, subject, vendorSpecific=None):
        
        response = self.confirmMapIdentityResponse(subject, vendorSpecific)
        return self._read_boolean_response(response)
1301455
def certs(self, entity_id, descriptor, use="signing"):
        '''
        
        '''
        ent = self[entity_id]

        def extract_certs(srvs):
            res = []
            for srv in srvs:
                if "key_descriptor" in srv:
                    for key in srv["key_descriptor"]:
                        if "use" in key and key["use"] == use:
                            for dat in key["key_info"]["x509_data"]:
                                cert = repack_cert(
                                    dat["x509_certificate"]["text"])
                                if cert not in res:
                                    res.append(cert)
                        elif not "use" in key:
                            for dat in key["key_info"]["x509_data"]:
                                cert = repack_cert(
                                    dat["x509_certificate"]["text"])
                                if cert not in res:
                                    res.append(cert)

            return res

        if descriptor == "any":
            res = []
            for descr in ["spsso", "idpsso", "role", "authn_authority",
                          "attribute_authority", "pdp"]:
                try:
                    srvs = ent["%s_descriptor" % descr]
                except KeyError:
                    continue

                res.extend(extract_certs(srvs))
        else:
            srvs = ent["%s_descriptor" % descriptor]
            res = extract_certs(srvs)

        return res
620701
def entities(self, entity_ids):
        '''
        '''
        url = '%s/meta/any?include=id&' % self.url
        for entity_id in entity_ids:
            url += 'id=%s&' % _get_path(entity_id)
        # Remove the trailing '&' from the URL.
        url = url[:-1]
        data = self._get(url)
        return data.json()
575052
def supported_entity_categories(self, entity_id):
        
        attributes = self.entity_attributes(entity_id)
        return attributes.get(ENTITY_CATEGORY_SUPPORT, [])
162728
def all_entities(self, is_active=True):
        
        return self.get_all_entities(return_models=True, is_active=is_active)
785215
def convert_subject_ids(self, subject_ids):
        
        # TODO: need to make this generalisable via a
        #       splitting+mapping function passed to the repository
        if subject_ids is not None:
            subject_ids = set(
                ('{:03d}'.format(s)
                 if isinstance(s, int) else s) for s in subject_ids)
        return subject_ids
908491
def requestMapIdentity(self, subject, vendorSpecific=None):
        
        response = self.requestMapIdentityResponse(subject, vendorSpecific)
        return self._read_boolean_response(response)
515158
def validAspects(self, ID, aspList):
        
        obj = self.chart.getObject(ID)
        res = []
        
        for otherID in const.LIST_SEVEN_PLANETS:
            if ID == otherID:
                continue
            
            otherObj = self.chart.getObject(otherID)
            aspType = aspects.aspectType(obj, otherObj, aspList)
            if aspType != const.NO_ASPECT:
                res.append({
                    'id': otherID,
                    'asp': aspType,
                })
        return res
845487
def subject_id(self):
        

        if "subject" in self.message.keys():
            _subj = self.message.subject
            if "base_id" in _subj.keys() and _subj.base_id:
                return _subj.base_id
            elif _subj.name_id:
                return _subj.name_id
        else:
            if "base_id" in self.message.keys() and self.message.base_id:
                return self.message.base_id
            elif self.message.name_id:
                return self.message.name_id
            else:  # EncryptedID
                pass
93084
def subjects(self):
        

        for sms in SetMemberSubject.where(subject_set_id=self.id):
            yield sms.links.subject