Search in sources :

Example 36 with GluuAttribute

use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.

the class AttributeService method getCustomAttributes.

/**
	 * Get custom attributes
	 * 
	 * @return List of cusomt attributes
	 */
@SuppressWarnings("unchecked")
public List<GluuAttribute> getCustomAttributes() {
    List<GluuAttribute> attributeList = (List<GluuAttribute>) cacheService.get(OxTrustConstants.CACHE_ATTRIBUTE_NAME, OxTrustConstants.CACHE_ATTRIBUTE_CUSTOM_KEY_LIST);
    if (attributeList == null) {
        attributeList = new ArrayList<GluuAttribute>();
        for (GluuAttribute attribute : getAllAttributes()) {
            if (attribute.isCustom()) {
                attributeList.add(attribute);
            }
        }
        cacheService.put(OxTrustConstants.CACHE_ATTRIBUTE_NAME, OxTrustConstants.CACHE_ATTRIBUTE_CUSTOM_KEY_LIST, attributeList);
    }
    return attributeList;
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) GluuAttribute(org.xdi.model.GluuAttribute)

Example 37 with GluuAttribute

use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.

the class AttributeService method setAttributeMetadata.

/**
	 * Set metadata for every custom attribute
	 * 
	 * @param customAttributes
	 *            List of custom attributes
	 * @param attributes
	 *            List of attributes
	 */
public void setAttributeMetadata(List<GluuCustomAttribute> customAttributes, List<GluuAttribute> attributes) {
    if ((customAttributes == null) || (attributes == null)) {
        return;
    }
    for (GluuCustomAttribute personAttribute : customAttributes) {
        GluuAttribute tmpAttribute = getAttributeByName(personAttribute.getName(), attributes);
        if (tmpAttribute == null) {
            log.error("Failed to find attribute '{}' metadata", personAttribute.getName());
        }
        personAttribute.setMetadata(tmpAttribute);
    }
}
Also used : GluuCustomAttribute(org.gluu.oxtrust.model.GluuCustomAttribute) GluuAttribute(org.xdi.model.GluuAttribute)

Example 38 with GluuAttribute

use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.

the class AttributeService method getAllAtributesImpl.

@Override
protected List<GluuAttribute> getAllAtributesImpl(String baseDn) {
    List<GluuAttribute> attributeList = ldapEntryManager.findEntries(baseDn, GluuAttribute.class, null);
    String customOrigin = getCustomOrigin();
    for (GluuAttribute attribute : attributeList) {
        attribute.setCustom(customOrigin.equals(attribute.getOrigin()));
    }
    return attributeList;
}
Also used : GluuAttribute(org.xdi.model.GluuAttribute)

Example 39 with GluuAttribute

use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.

the class AttributeService method searchAttributes.

/**
	 * Search groups by pattern
	 * 
	 * @param pattern
	 *            Pattern
	 * @param sizeLimit
	 *            Maximum count of results
	 * @return List of groups
	 * @throws Exception
	 */
public List<GluuAttribute> searchAttributes(String pattern, int sizeLimit) throws Exception {
    String[] targetArray = new String[] { pattern };
    Filter displayNameFilter = Filter.createSubstringFilter(OxTrustConstants.displayName, null, targetArray, null);
    Filter descriptionFilter = Filter.createSubstringFilter(OxTrustConstants.description, null, targetArray, null);
    Filter nameFilter = Filter.createSubstringFilter(OxTrustConstants.attributeName, null, targetArray, null);
    Filter inameFilter = Filter.createSubstringFilter(OxTrustConstants.iname, null, targetArray, null);
    Filter searchFilter = Filter.createORFilter(displayNameFilter, descriptionFilter, inameFilter, nameFilter);
    List<GluuAttribute> result = ldapEntryManager.findEntries(getDnForAttribute(null), GluuAttribute.class, searchFilter, 0, sizeLimit);
    String customOrigin = getCustomOrigin();
    for (GluuAttribute attribute : result) {
        attribute.setCustom(customOrigin.equals(attribute.getOrigin()));
    }
    return result;
}
Also used : Filter(com.unboundid.ldap.sdk.Filter) GluuAttribute(org.xdi.model.GluuAttribute)

Example 40 with GluuAttribute

use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.

the class InumService method containsAttribute.

public boolean containsAttribute(String inum, String gluuInum) {
    GluuAttribute attribute = new GluuAttribute();
    attribute.setBaseDn("inum=" + inum + ",ou=attributes,o=" + gluuInum + "o=gluu");
    return ldapEntryManager.contains(attribute);
}
Also used : GluuAttribute(org.xdi.model.GluuAttribute)

Aggregations

GluuAttribute (org.xdi.model.GluuAttribute)64 ArrayList (java.util.ArrayList)24 GluuCustomAttribute (org.gluu.oxtrust.model.GluuCustomAttribute)15 JSONObject (org.codehaus.jettison.json.JSONObject)9 JSONArray (org.codehaus.jettison.json.JSONArray)8 GluuAttributeDataType (org.xdi.model.GluuAttributeDataType)6 IOException (java.io.IOException)5 BigDecimal (java.math.BigDecimal)5 Date (java.util.Date)5 HashMap (java.util.HashMap)5 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)5 Extension (org.gluu.oxtrust.model.scim2.Extension)5 JwtSubClaimObject (org.xdi.oxauth.model.jwt.JwtSubClaimObject)5 Filter (com.unboundid.ldap.sdk.Filter)4 List (java.util.List)4 GluuSAMLTrustRelationship (org.gluu.oxtrust.model.GluuSAMLTrustRelationship)4 Claim (org.xdi.oxauth.model.authorize.Claim)4 Scope (org.xdi.oxauth.model.common.Scope)4 PairwiseIdentifier (org.xdi.oxauth.model.ldap.PairwiseIdentifier)4 DynamicScopeExternalContext (org.xdi.oxauth.service.external.context.DynamicScopeExternalContext)4