use of com.github.zhenwei.provider.x509.X509AttributeCertStoreSelector in project LinLong-Java by zhenwei1108.
the class LDAPStoreHelper method getAACertificates.
/**
* Returns attribute certificates for an attribute authority
* <p>
* The aAcertificate holds the privileges of an attribute authority.
* </p>
*
* @param selector The selector to find the attribute certificates.
* @return A possible empty collection with attribute certificates.
* @throws StoreException
*/
public Collection getAACertificates(X509AttributeCertStoreSelector selector) throws StoreException {
String[] attrs = splitString(params.getAACertificateAttribute());
String[] attrNames = splitString(params.getLdapAACertificateAttributeName());
String[] subjectAttributeNames = splitString(params.getAACertificateSubjectAttributeName());
List list = attrCertSubjectSerialSearch(selector, attrs, attrNames, subjectAttributeNames);
Set resultSet = createAttributeCertificates(list, selector);
if (resultSet.size() == 0) {
X509AttributeCertStoreSelector emptySelector = new X509AttributeCertStoreSelector();
list = attrCertSubjectSerialSearch(emptySelector, attrs, attrNames, subjectAttributeNames);
resultSet.addAll(createAttributeCertificates(list, selector));
}
return resultSet;
}
use of com.github.zhenwei.provider.x509.X509AttributeCertStoreSelector in project LinLong-Java by zhenwei1108.
the class LDAPStoreHelper method getAttributeCertificateAttributes.
/**
* Returns an attribute certificate for an user.
* <p>
* The attributeCertificateAttribute holds the privileges of a user
* </p>
*
* @param selector The selector to find the attribute certificates.
* @return A possible empty collection with attribute certificates.
* @throws StoreException
*/
public Collection getAttributeCertificateAttributes(X509AttributeCertStoreSelector selector) throws StoreException {
String[] attrs = splitString(params.getAttributeCertificateAttributeAttribute());
String[] attrNames = splitString(params.getLdapAttributeCertificateAttributeAttributeName());
String[] subjectAttributeNames = splitString(params.getAttributeCertificateAttributeSubjectAttributeName());
List list = attrCertSubjectSerialSearch(selector, attrs, attrNames, subjectAttributeNames);
Set resultSet = createAttributeCertificates(list, selector);
if (resultSet.size() == 0) {
X509AttributeCertStoreSelector emptySelector = new X509AttributeCertStoreSelector();
list = attrCertSubjectSerialSearch(emptySelector, attrs, attrNames, subjectAttributeNames);
resultSet.addAll(createAttributeCertificates(list, selector));
}
return resultSet;
}
use of com.github.zhenwei.provider.x509.X509AttributeCertStoreSelector in project LinLong-Java by zhenwei1108.
the class X509StoreLDAPAttrCerts method engineGetMatches.
/**
* Returns a collection of matching attribute certificates from the LDAP location.
* <p>
* The selector must be a of type
* <code>X509AttributeCertStoreSelector</code>. If it is not an empty
* collection is returned.
* </p>
* <p>
* The subject and the serial number should be reasonable criterias for a selector.
* </p>
*
* @param selector The selector to use for finding.
* @return A collection with the matches.
* @throws StoreException if an exception occurs while searching.
*/
public Collection engineGetMatches(Selector selector) throws StoreException {
if (!(selector instanceof X509AttributeCertStoreSelector)) {
return Collections.EMPTY_SET;
}
X509AttributeCertStoreSelector xselector = (X509AttributeCertStoreSelector) selector;
Set set = new HashSet();
set.addAll(helper.getAACertificates(xselector));
set.addAll(helper.getAttributeCertificateAttributes(xselector));
set.addAll(helper.getAttributeDescriptorCertificates(xselector));
return set;
}
Aggregations