public boolean isIdentityObjectAddRemoveSupported(IdentityObjectType objectType) { if (readOnlyObjectTypes.contains(objectType.getName())) { return false; } return true; }
public boolean isIdentityObjectTypeSupported(IdentityObjectType identityObjectType) { if (supportedTypeNames.contains(identityObjectType.getName())) { return true; } return false; }
public Map<String, IdentityObjectAttributeMetaData> getAttributesMetaData(IdentityStoreInvocationContext invocationContext, IdentityObjectType identityType) { return attributesMetaData.get(identityType.getName()); }
public String getGroupType(IdentityObjectType identityObjectType) { if (identityObjectType == null) { throw new IllegalArgumentException("identityObjectType is null"); } return identityObjectType.getName(); }
public String getGroupType(IdentityObjectType identityObjectType) { if (identityObjectType == null) { throw new IllegalArgumentException("identityObjectType is null"); } return groupTypeMap.get(identityObjectType.getName()); }
public boolean isIdentity(IdentityObjectType identityObjectType) { if (identityObjectType == null) { throw new IllegalArgumentException("identityObjectType is null"); } if (identityObjectType.getName().equals(identityTypeName)) { return true; } return false; } }
public boolean isIdentity(IdentityObjectType identityObjectType) { if (identityObjectType == null) { throw new IllegalArgumentException("identityObjectType is null"); } if (identityObjectType.getName().equals(identityTypeName)) { return true; } return false; } }
public boolean isRelationshipTypeSupported(IdentityObjectType fromType, IdentityObjectType toType, IdentityObjectRelationshipType relationshipType) throws IdentityException { Map<String, Set<String>> mappings = supportedRelationshipMappings.get(relationshipType.getName()); if (mappings != null && mappings.containsKey(fromType.getName())) { if (mappings.get(fromType.getName()).contains(toType.getName())) { return true; } } return false; }
public Set<String> getSupportedAttributeNames(IdentityStoreInvocationContext ctx, IdentityObjectType identityType) throws IdentityException { checkIOType(identityType); if (attributeMappings.containsKey(identityType.getName())) { return attributeMappings.get(identityType.getName()); } return new HashSet<String>(); }
public boolean isCredentialSupported(IdentityObjectType identityObjectType, IdentityObjectCredentialType credentialType) { Set<String> types = supportedCredentials.get(identityObjectType.getName()); if (types != null && types.contains(credentialType.getName())) { return true; } return false; }
private String resolveAttributeNameFromStoreMapping(IdentityObjectType type, String mapping) { if (reverseAttributeMappings.containsKey(type.getName())) { Map<String, String> map = reverseAttributeMappings.get(type.getName()); if (map != null) { String name = map.containsKey(mapping) ? map.get(mapping) : mapping; return name; } } if (isAllowNotDefinedAttributes()) { return mapping; } return null; }
public boolean isGroupType(IdentityObjectType identityObjectType) { if (identityObjectType == null) { throw new IllegalArgumentException("identityObjectType is null"); } if (isIdentity(identityObjectType)) { return false; } if (groupTypeMap.containsKey(identityObjectType.getName())) { return true; } return false; }
public AttributeStore getAttributeStore(IdentityObjectType identityObjectType) throws IdentityException { AttributeStore store = attributeStoreMappings.get(identityObjectType.getName()); if (store == null) { String option = configurationContext.getRepositoryConfigurationMetaData().getOptionSingleValue(ALLOW_NOT_DEFINED_IDENTITY_OBJECT_TYPES_OPTION); if (option != null && option.equalsIgnoreCase("true")) { return defaultIdentityStore; } else { throw new IdentityException("IdentityObjectType not mapped in the configuration: " + identityObjectType); } } return store; }
public IdentityStore getIdentityStore(IdentityObjectType identityObjectType) throws IdentityException { IdentityStore store = identityStoreMappings.get(identityObjectType.getName()); if (store == null) { String option = configurationContext.getRepositoryConfigurationMetaData().getOptionSingleValue(ALLOW_NOT_DEFINED_IDENTITY_OBJECT_TYPES_OPTION); if (option != null && option.equalsIgnoreCase("true")) { return defaultIdentityStore; } else { throw new IdentityException("IdentityObjectType not mapped in the configuration: " + identityObjectType); } } return store; }
public Collection<Group> findAssociatedGroups(User user, IdentitySearchCriteria criteria) throws IdentityException { checkNotNullArgument(user, "User"); List<Group> identities = new LinkedList<Group>(); Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(user), MEMBER, false, convertSearchControls(criteria)); String userTypeName = getUserObjectType().getName(); for (IdentityObject io : ios) { // Filter out users if (!io.getIdentityType().getName().equals(userTypeName)) identities.add(createGroup(io)); } return identities; }
/** * Resolve store mapping for attribute name. If attribute is not mapped and store doesn't allow not defined * attributes throw exception * @param type * @param name * @return */ private String resolveAttributeStoreMapping(IdentityObjectType type, String name) throws IdentityException { String mapping = null; if (attributesMetaData.containsKey(type.getName())) { IdentityObjectAttributeMetaData amd = attributesMetaData.get(type.getName()).get(name); if (amd != null) { mapping = amd.getStoreMapping() != null ? amd.getStoreMapping() : amd.getName(); return mapping; } } if (isAllowNotDefinedAttributes()) { mapping = name; return mapping; } throw new IdentityException("Attribute name is not configured in this store"); }
@Override public String toString() { return "IdentityObject[id=" + getId() + "; name=" + getName() + "; type=" + getIdentityType().getName() + "]"; } }
.setParameter("name", type.getName()); populateObjectTypes(hibernateSession, new String[]{type.getName()}); throw new IdentityException("IdentityObjectType[" + type.getName() + "] not present in the store.", e); throw new IdentityException("IdentityObjectType[" + type.getName() + "] not present in the store.");
private HibernateIdentityObject getHibernateIdentityObject(IdentityStoreInvocationContext ctx, IdentityObject io) throws IdentityException { HibernateIdentityObject hibernateObject = null; Session hibernateSession = getHibernateSession(ctx); try { hibernateObject = (HibernateIdentityObject)hibernateSession.createQuery(HibernateIdentityObject.findIdentityObjectByNameAndType) .setParameter("name", io.getName()) .setParameter("typeName", io.getIdentityType().getName()) .setParameter("realm", getRealm(hibernateSession, ctx)) .uniqueResult(); } catch (Exception e) { throw new IdentityException("IdentityObject[ " + io.getName() + " | " + io.getIdentityType().getName() + "] not present in the store.", e); } return hibernateObject; }