Search in sources :

Example 1 with LdapIDPEntry

use of org.gluu.asimba.util.ldap.idp.LdapIDPEntry in project oxTrust by GluuFederation.

the class AsimbaService method loadIDPs.

public List<IDPEntry> loadIDPs() {
    List<LdapIDPEntry> entries = ldapEntryManager.findEntries(getDnForLdapIDPEntry(null), LdapIDPEntry.class, null);
    List<IDPEntry> result = new ArrayList<IDPEntry>();
    for (LdapIDPEntry entry : entries) {
        result.add(entry.getEntry());
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) LdapIDPEntry(org.gluu.asimba.util.ldap.idp.LdapIDPEntry) LdapIDPEntry(org.gluu.asimba.util.ldap.idp.LdapIDPEntry) IDPEntry(org.gluu.asimba.util.ldap.idp.IDPEntry)

Example 2 with LdapIDPEntry

use of org.gluu.asimba.util.ldap.idp.LdapIDPEntry in project oxTrust by GluuFederation.

the class AsimbaService method updateIDPEntry.

/**
 * Update IDPEntry.
 *
 * @param entry IDPEntry
 */
public void updateIDPEntry(IDPEntry entry) {
    entry.setLastModified(new Date());
    LdapIDPEntry ldapEntry = ldapEntryManager.find(LdapIDPEntry.class, getDnForLdapIDPEntry(entry.getInum()));
    ldapEntry.setEntry(entry);
    ldapEntryManager.merge(ldapEntry);
}
Also used : LdapIDPEntry(org.gluu.asimba.util.ldap.idp.LdapIDPEntry) Date(java.util.Date)

Example 3 with LdapIDPEntry

use of org.gluu.asimba.util.ldap.idp.LdapIDPEntry in project oxTrust by GluuFederation.

the class AsimbaService method removeIDPEntry.

/**
 * Remove IDPEntry.
 *
 * @param entry IDPEntry
 */
public void removeIDPEntry(IDPEntry entry) {
    LdapIDPEntry ldapEntry = ldapEntryManager.find(LdapIDPEntry.class, getDnForLdapIDPEntry(entry.getInum()));
    ldapEntry.setEntry(entry);
    ldapEntryManager.remove(ldapEntry);
}
Also used : LdapIDPEntry(org.gluu.asimba.util.ldap.idp.LdapIDPEntry)

Example 4 with LdapIDPEntry

use of org.gluu.asimba.util.ldap.idp.LdapIDPEntry in project oxTrust by GluuFederation.

the class AsimbaService method addIDPEntry.

/**
 * Add new IDPEntry.
 *
 * @param entry IDPEntry
 */
public void addIDPEntry(IDPEntry entry) {
    log.info("addIDPEntry() call");
    try {
        entry.setLastModified(new Date());
        LdapIDPEntry ldapEntry = new LdapIDPEntry();
        ldapEntry.setEntry(entry);
        String inum = generateInum();
        ldapEntry.setInum(inum);
        log.info("getDnForLdapIDPEntry(inum) retsult: " + getDnForLdapIDPEntry(inum));
        ldapEntry.setDn(getDnForLdapIDPEntry(inum));
        ldapEntryManager.persist(ldapEntry);
    } catch (Exception e) {
        log.error("addIDPEntry() exception", e);
    }
}
Also used : LdapIDPEntry(org.gluu.asimba.util.ldap.idp.LdapIDPEntry) Date(java.util.Date) IOException(java.io.IOException)

Example 5 with LdapIDPEntry

use of org.gluu.asimba.util.ldap.idp.LdapIDPEntry in project oxTrust by GluuFederation.

the class AsimbaService method searchIDPs.

/**
 * Search by pattern
 *
 * @param pattern Pattern
 * @param sizeLimit Maximum count of results
 * @return List of scopes
 * @throws Exception
 */
public List<IDPEntry> searchIDPs(String pattern, int sizeLimit) throws Exception {
    // filter
    String[] targetArray = new String[] { pattern };
    Filter idFilter = Filter.createSubstringFilter(OxTrustConstants.uniqueIdentifier, null, targetArray, null);
    Filter friendlyNameFilter = Filter.createSubstringFilter(OxTrustConstants.friendlyName, null, targetArray, null);
    Filter descriptionFilter = Filter.createSubstringFilter(OxTrustConstants.description, null, targetArray, null);
    Filter inameFilter = Filter.createSubstringFilter(OxTrustConstants.iname, null, targetArray, null);
    Filter searchFilter = Filter.createORFilter(idFilter, friendlyNameFilter, descriptionFilter, inameFilter);
    // search
    final List<LdapIDPEntry> entries = ldapEntryManager.findEntries(getDnForLdapIDPEntry(null), LdapIDPEntry.class, searchFilter, sizeLimit);
    // convert result
    List<IDPEntry> ret = new ArrayList<IDPEntry>();
    for (LdapIDPEntry entry : entries) {
        ret.add(entry.getEntry());
    }
    return ret;
}
Also used : Filter(org.gluu.search.filter.Filter) ArrayList(java.util.ArrayList) LdapIDPEntry(org.gluu.asimba.util.ldap.idp.LdapIDPEntry) LdapIDPEntry(org.gluu.asimba.util.ldap.idp.LdapIDPEntry) IDPEntry(org.gluu.asimba.util.ldap.idp.IDPEntry)

Aggregations

LdapIDPEntry (org.gluu.asimba.util.ldap.idp.LdapIDPEntry)5 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 IDPEntry (org.gluu.asimba.util.ldap.idp.IDPEntry)2 IOException (java.io.IOException)1 Filter (org.gluu.search.filter.Filter)1