public void bootstrap(IdentityStoreConfigurationContext configurationContext) throws IdentityException { identityStore.bootstrap(configurationContext); }
public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType, Map<String, String[]> attributes) throws IdentityException { IdentityObject io = identityStore.createIdentityObject(invocationCtx, name, identityObjectType, attributes); if (io != null) { //should also invalidate IO searches cache - searches/type - clear all children cacheSupport.invalidateCachedIdentityObjectSearches(io); //grab profile - because IS can add extra attributes we canno rely only on attributes passed cacheSupport.putIntoCache(io, identityStore.getAttributes(invocationCtx, io)); } return io; }
public IdentityStoreSession createIdentityStoreSession() throws IdentityException { Map<String, IdentityStoreSession> sessions = new HashMap<String, IdentityStoreSession>(); sessions.put(defaultAttributeStore.getId(), defaultAttributeStore.createIdentityStoreSession()); if (!sessions.containsKey(defaultIdentityStore.getId())) { sessions.put(defaultIdentityStore.getId(), defaultIdentityStore.createIdentityStoreSession()); } return new RepositoryIdentityStoreSessionImpl(sessions); }
public String createRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException { // For any IdentityStore that supports named relationships... for (IdentityStore identityStore : configuredIdentityStores) { if (identityStore.getSupportedFeatures().isNamedRelationshipsSupported()) { IdentityStoreInvocationContext storeCtx = resolveInvocationContext(identityStore, ctx); identityStore.createRelationshipName(storeCtx, name); } } return name; }
public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName, boolean createNames) throws IdentityException { IdentityStore fromStore = resolveIdentityStore(fromIdentity); IdentityStore toStore = resolveIdentityStore(toIdentity); IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt); IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt); if (fromStore == toStore) { // If relationship is named and target store doesn't support named relationships it need to be put in default store anyway if (relationshipName == null || (relationshipName != null && fromStore.getSupportedFeatures().isNamedRelationshipsSupported())) { return fromStore.createRelationship(toTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName, createNames); } } if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity)) { defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType()); } if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity)) { defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType()); } return defaultIdentityStore.createRelationship(defaultTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName, createNames); }
public void removeRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName) throws IdentityException { IdentityStore fromStore = resolveIdentityStore(fromIdentity); IdentityStore toStore = resolveIdentityStore(toIdentity); IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt); IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt); if (fromStore == toStore) { if (relationshipName == null || (relationshipName != null && fromStore.getSupportedFeatures().isNamedRelationshipsSupported())) { fromStore.removeRelationship(toTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName); return; } } if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity)) { defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType()); } if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity)) { defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType()); } defaultIdentityStore.removeRelationship(defaultTargetCtx, fromIdentity, toIdentity, relationshipType, relationshipName); }
public Set<IdentityObjectRelationship> resolveRelationships(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType) throws IdentityException { IdentityStore fromStore = resolveIdentityStore(fromIdentity); IdentityStore toStore = resolveIdentityStore(toIdentity); IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCxt); IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCxt); if (fromStore == toStore && (!RoleManagerImpl.ROLE.getName().equals(relationshipType.getName()) || fromStore.getSupportedFeatures().isNamedRelationshipsSupported())) { return fromStore.resolveRelationships(toTargetCtx, fromIdentity, toIdentity, relationshipType); } if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, fromIdentity)) { defaultIdentityStore.createIdentityObject(defaultTargetCtx, fromIdentity.getName(), fromIdentity.getIdentityType()); } if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, toIdentity)) { defaultIdentityStore.createIdentityObject(defaultTargetCtx, toIdentity.getName(), toIdentity.getIdentityType()); } return defaultIdentityStore.resolveRelationships(defaultTargetCtx, fromIdentity, toIdentity, relationshipType); }
public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType, IdentityObjectSearchCriteria criteria) throws IdentityException { return defaultIdentityStore.findIdentityObject(resolveIdentityStoreInvocationContext(invocationCtx), identityType, criteria); }
public IdentityObject findIdentityObjectByUniqueAttribute(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityObjectType, IdentityObjectAttribute attribute) throws IdentityException { List<String> filteredAttrs = new LinkedList<String>(); List<String> leftAttrs = new LinkedList<String>(); IdentityStore toStore = resolveIdentityStore(identityObjectType); IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx); // Put supported attrs to the main store if (toStore != defaultAttributeStore) { Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identityObjectType); if (supportedAttrs.contains(attribute.getName())) { return toStore.findIdentityObjectByUniqueAttribute(targetCtx, identityObjectType, attribute); } } IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx); if (isAllowNotDefinedAttributes()) { defaultAttributeStore.findIdentityObjectByUniqueAttribute(defaultCtx, identityObjectType, attribute); } else { Set<String> supportedAttrs = defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identityObjectType); if (supportedAttrs.contains(attribute.getName())) { return toStore.findIdentityObjectByUniqueAttribute(defaultCtx, identityObjectType, attribute); } } return null; }
public void removeRelationships(IdentityStoreInvocationContext invocationCtx, IdentityObject identity1, IdentityObject identity2, boolean named) throws IdentityException { IdentityStore fromStore = resolveIdentityStore(identity1); IdentityStore toStore = resolveIdentityStore(identity2); IdentityStoreInvocationContext toTargetCtx = resolveInvocationContext(toStore, invocationCtx); IdentityStoreInvocationContext defaultTargetCtx = resolveInvocationContext(defaultIdentityStore, invocationCtx); if (fromStore == toStore) { fromStore.removeRelationships(toTargetCtx, identity1, identity2, named); return; } if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, identity1)) { defaultIdentityStore.createIdentityObject(defaultTargetCtx, identity1.getName(), identity1.getIdentityType()); } if (!hasIdentityObject(defaultTargetCtx, defaultIdentityStore, identity2)) { defaultIdentityStore.createIdentityObject(defaultTargetCtx, identity2.getName(), identity2.getIdentityType()); } defaultIdentityStore.removeRelationships(defaultTargetCtx, identity1, identity2, named); }
return defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, criteria); mappedStore.getSupportedFeatures().isNamedRelationshipsSupported()) results = mappedStore.findIdentityObject(mappedCtx, identity, relationshipType, parent, criteria); defaultStoreIdentityObject = defaultIdentityStore.findIdentityObject(defaultCtx, identity.getName(), identity.getIdentityType()); Collection<IdentityObject> objects = defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, criteria);
Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identity.getIdentityType()); toStore.addAttributes(targetCtx, identity, filteredAttrs.toArray(new IdentityObjectAttribute[filteredAttrs.size()]));
public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType, Map<String, String[]> attributes) throws IdentityException { return defaultIdentityStore.createIdentityObject(resolveIdentityStoreInvocationContext(invocationCtx), name, identityObjectType, attributes); }
public String createRelationshipName(IdentityStoreInvocationContext ctx, String name) throws IdentityException, OperationNotSupportedException { cacheSupport.invalidateRelationshipNameSearches(name); return identityStore.createRelationshipName(ctx, name); }
public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName, boolean createNames) throws IdentityException { return defaultIdentityStore.createRelationship(resolveIdentityStoreInvocationContext(invocationCxt), fromIdentity, toIdentity, relationshipType, relationshipName, createNames); }
public Map<String, IdentityObjectAttribute> getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity) throws IdentityException { Map<String, IdentityObjectAttribute> results; IdentityStore toStore = resolveIdentityStore(identity); IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationContext); results = toStore.getAttributes(targetCtx, identity); if (toStore != defaultAttributeStore) { IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationContext); Map<String, IdentityObjectAttribute> defaultAttrs = defaultAttributeStore.getAttributes(defaultCtx, identity); // Add only those attributes which are missing - don't overwrite or merge existing values for (Map.Entry<String, IdentityObjectAttribute> entry : defaultAttrs.entrySet()) { if (!results.keySet().contains(entry.getKey())) { results.put(entry.getKey(), entry.getValue()); } } } return results; }
public IdentityObjectAttribute getAttribute(IdentityStoreInvocationContext invocationContext, IdentityObject identity, String name) throws IdentityException { IdentityObjectAttribute result; IdentityStore toStore = resolveIdentityStore(identity); IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationContext); result = toStore.getAttribute(targetCtx, identity, name); if (result == null && toStore != defaultAttributeStore) { IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationContext); result = defaultAttributeStore.getAttribute(defaultCtx, identity, name); } return result; }
public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String name, IdentityObjectType identityObjectType) throws IdentityException { return defaultIdentityStore.findIdentityObject(resolveIdentityStoreInvocationContext(invocationContext), name, identityObjectType); }
public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType, Map<String, String[]> attributes) throws IdentityException { IdentityStore targetStore = resolveIdentityStore(identityObjectType); IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx); return targetStore.createIdentityObject(targetCtx, name, identityObjectType, attributes); }