private void doHandle(List<CarbonCallbackHandler> callbackHandlers, Callback[] callbacks) { callbackHandlers .stream() .filter((handler) -> { handler.setCarbonMessage(carbonMessage); return handler.canHandle(); }) .findFirst() .ifPresent(rethrowConsumer(handler -> { handler.handle(callbacks); })); }
private List<String> getDomainEntityIds(List<String> uniqueEntityIds, int domainId) throws IdentityStoreException { List<String> domainEntityIds = new ArrayList<>(); uniqueEntityIds.forEach(rethrowConsumer(uniqueEntityId -> { SimpleEntry<Integer, String> decodedUniqueEntityId = getDecodedUniqueEntityId(uniqueEntityId); if (domainId != decodedUniqueEntityId.getKey()) { throw new IdentityStoreClientException("User and group must be in the same domain."); } domainEntityIds.add(decodedUniqueEntityId.getValue()); })); return domainEntityIds; } }
private List<User> doListUsers(List<Claim> claims, int offset, int length, Domain domain) throws IdentityStoreServerException { List<String> matchedDomainUserIds; try { matchedDomainUserIds = domain.listDomainUsers(claims, offset, length); } catch (DomainException e) { throw new IdentityStoreServerException("Error while retrieving domain Ids", e); } if (matchedDomainUserIds == null || Collections.emptyList().isEmpty()) { return Collections.emptyList(); } List<String> uniqueUserIds = new ArrayList<>(); matchedDomainUserIds.forEach(rethrowConsumer(domainUserId -> uniqueUserIds .add(getEncodedUniqueEntityId(domain.getId(), domainUserId)))); return uniqueUserIds.stream() .map(uniqueUserId -> new User.UserBuilder() .setUserId(uniqueUserId) .setDomainName(domain.getName()) .setIdentityStore(this) // .setAuthorizationStore(IdentityMgtDataHolder.getInstance().getAuthorizationStore()) .build()) .collect(Collectors.toList()); }
private List<Group> doListGroups(int offset, int length, Domain domain) throws IdentityStoreException { List<String> domainGroupIds; try { domainGroupIds = domain.listDomainGroups(offset, length); } catch (DomainException e) { throw new IdentityStoreServerException(String.format("Failed to list groups in the domain - %s", domain), e); } if (domainGroupIds == null || domainGroupIds.isEmpty()) { return Collections.emptyList(); } List<String> uniqueGroupIds = new ArrayList<>(); domainGroupIds.forEach(rethrowConsumer(domainGroupId -> uniqueGroupIds .add(getEncodedUniqueEntityId(domain.getId(), domainGroupId)))); return uniqueGroupIds.stream() .map(uniqueGroupId -> new Group.GroupBuilder() .setGroupId(uniqueGroupId) .setDomainName(domain.getName()) .setIdentityStore(this) // .setAuthorizationStore(IdentityMgtDataHolder.getInstance().getAuthorizationStore()) .build()) .collect(Collectors.toList()); }
private List<Group> doListGroups(Claim claim, int offset, int length, Domain domain) throws IdentityStoreException { List<String> domainGroupIds; try { domainGroupIds = domain.listDomainGroups(claim, offset, length); } catch (DomainException e) { throw new IdentityStoreServerException(String.format("Failed to list groups in the domain - %s", domain), e); } if (domainGroupIds == null || domainGroupIds.isEmpty()) { return Collections.emptyList(); } List<String> uniqueGroupIds = new ArrayList<>(); domainGroupIds.forEach(rethrowConsumer(domainGroupId -> uniqueGroupIds .add(getEncodedUniqueEntityId(domain.getId(), domainGroupId)))); return uniqueGroupIds.stream() .map(uniqueGroupId -> new Group.GroupBuilder() .setGroupId(uniqueGroupId) .setDomainName(domain.getName()) .setIdentityStore(this) // .setAuthorizationStore(IdentityMgtDataHolder.getInstance().getAuthorizationStore()) .build()) .collect(Collectors.toList()); }
private List<Group> doListGroups(MetaClaim metaClaim, String filterPattern, int offset, int length, Domain domain) throws IdentityStoreException { List<String> domainGroupIds; try { domainGroupIds = domain.listDomainGroups(metaClaim, filterPattern, offset, length); } catch (DomainException e) { throw new IdentityStoreServerException(String.format("Failed to list groups in the domain - %s", domain), e); } if (domainGroupIds == null || domainGroupIds.isEmpty()) { return Collections.emptyList(); } List<String> uniqueGroupIds = new ArrayList<>(); domainGroupIds.forEach(rethrowConsumer(domainGroupId -> uniqueGroupIds .add(getEncodedUniqueEntityId(domain.getId(), domainGroupId)))); return uniqueGroupIds.stream() .map(uniqueGroupId -> new Group.GroupBuilder() .setGroupId(uniqueGroupId) .setDomainName(domain.getName()) .setIdentityStore(this) // .setAuthorizationStore(IdentityMgtDataHolder.getInstance().getAuthorizationStore()) .build()) .collect(Collectors.toList()); }
attributes.values().stream().forEach(LambdaExceptionUtils.rethrowConsumer(entry -> { if (entry instanceof SimpleAttribute && !(entry.getURI().equals(SCIMConstants. CommonSchemaConstants.LOCATION_URI))) {
Domain domain = getDomainFromDomainName(domainName); List<String> matchedDomainUserIds = domain.listDomainUsers(claims, offset, length); matchedDomainUserIds.forEach(rethrowConsumer(domainUserId -> uniqueUserIds .add(getEncodedUniqueEntityId(domain.getId(), domainUserId))));
domainGroupIds.forEach(rethrowConsumer(domainGroupId -> uniqueGroupIds .add(getEncodedUniqueEntityId(domain.getId(), domainGroupId))));
domainGroupIds.forEach(rethrowConsumer(domainGroupId -> uniqueGroupIds .add(getEncodedUniqueEntityId(domain.getId(), domainGroupId))));
domainGroupIds.forEach(rethrowConsumer(domainGroupId -> uniqueGroupIds .add(getEncodedUniqueEntityId(domain.getId(), domainGroupId))));
domainUserIds.forEach(rethrowConsumer(domainUserId -> { String uniqueUserId = getEncodedUniqueEntityId(domain.getId(), domainUserId); uniqueUserIds.add(uniqueUserId);
domainUserIds.forEach(rethrowConsumer(domainUserId -> { String uniqueUserId = getEncodedUniqueEntityId(domain.getId(), domainUserId); uniqueUserIds.add(uniqueUserId);