use of org.gluu.model.GluuAttribute in project oxTrust by GluuFederation.
the class PersonService method getPersonsByEmail.
/*
* (non-Javadoc)
*
* @see
* org.gluu.oxtrust.ldap.service.IPersonService#getPersonsByEmail(java.lang.
* String)
*/
@Override
public List<GluuCustomPerson> getPersonsByEmail(String mail, String... returnAttributes) {
log.debug("Getting user information from DB: mail = {}", mail);
if (StringHelper.isEmpty(mail)) {
return null;
}
String personDn = getDnForPerson(null);
Filter userMailFilter;
if (dataSourceTypeService.isSpanner(personDn)) {
userMailFilter = Filter.createEqualityFilter("mail", StringHelper.toLowerCase(mail));
} else {
userMailFilter = Filter.createEqualityFilter(Filter.createLowercaseFilter("mail"), StringHelper.toLowerCase(mail));
}
boolean multiValued = false;
GluuAttribute mailAttribute = attributeService.getAttributeByName("mail");
if ((mailAttribute != null) && (mailAttribute.getOxMultiValuedAttribute() != null) && mailAttribute.getOxMultiValuedAttribute()) {
multiValued = true;
}
userMailFilter.multiValued(multiValued);
List<GluuCustomPerson> entries = persistenceEntryManager.findEntries(personDn, GluuCustomPerson.class, userMailFilter, returnAttributes);
log.debug("Found {} entries for mail = {}", entries.size(), mail);
return entries;
}
use of org.gluu.model.GluuAttribute in project oxTrust by GluuFederation.
the class Shibboleth3ConfService method initAttributeResolverParamMap.
public HashMap<String, Object> initAttributeResolverParamMap() {
List<NameIdConfig> nameIdConfigs = new ArrayList<NameIdConfig>();
Set<GluuAttribute> nameIdAttributes = new HashSet<GluuAttribute>();
AttributeResolverConfiguration attributeResolverConfiguration = configurationFactory.getAttributeResolverConfiguration();
if ((attributeResolverConfiguration != null) && (attributeResolverConfiguration.getNameIdConfigs() != null)) {
for (NameIdConfig nameIdConfig : attributeResolverConfiguration.getNameIdConfigs()) {
if (StringHelper.isNotEmpty(nameIdConfig.getSourceAttribute()) && nameIdConfig.isEnabled()) {
String attributeName = nameIdConfig.getSourceAttribute();
GluuAttribute attribute = attributeService.getAttributeByName(attributeName);
nameIdConfigs.add(nameIdConfig);
nameIdAttributes.add(attribute);
}
}
}
HashMap<String, Object> attributeResolverParams = createAttributeMap(nameIdAttributes);
attributeResolverParams.put("configs", nameIdConfigs);
attributeResolverParams.put("attributes", nameIdAttributes);
String baseUserDn = personService.getDnForPerson(null);
String persistenceType = persistenceEntryManager.getPersistenceType(baseUserDn);
log.debug(">>>>>>>>>> Shibboleth3ConfService.initAttributeResolverParamMap() - Persistance type: '{}'", persistenceType);
attributeResolverParams.put("persistenceType", persistenceType);
return attributeResolverParams;
}
use of org.gluu.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.warn("Failed to find attribute '{}' metadata", personAttribute.getName());
}
personAttribute.setMetadata(tmpAttribute);
}
}
use of org.gluu.model.GluuAttribute in project oxTrust by GluuFederation.
the class AttributeService method getAllAtributesImpl.
@Override
protected List<GluuAttribute> getAllAtributesImpl(String baseDn) {
List<GluuAttribute> attributeList = persistenceEntryManager.findEntries(baseDn, GluuAttribute.class, null);
String customOrigin = getCustomOrigin();
for (GluuAttribute attribute : attributeList) {
attribute.setCustom(customOrigin.equals(attribute.getOrigin()));
}
return attributeList;
}
use of org.gluu.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_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_CUSTOM_KEY_LIST, attributeList);
}
return attributeList;
}
Aggregations