private void populateItems(final OIDCProvider op, final OIDCProviderTO opTO) { op.getItems().forEach(item -> { ItemTO itemTO = new ItemTO(); itemTO.setKey(item.getKey()); itemTO.setIntAttrName(item.getIntAttrName()); itemTO.setExtAttrName(item.getExtAttrName()); itemTO.setMandatoryCondition(item.getMandatoryCondition()); itemTO.setConnObjectKey(item.isConnObjectKey()); itemTO.setPassword(item.isPassword()); itemTO.setPropagationJEXLTransformer(item.getPropagationJEXLTransformer()); itemTO.setPullJEXLTransformer(item.getPullJEXLTransformer()); itemTO.setPurpose(MappingPurpose.NONE); if (itemTO.isConnObjectKey()) { opTO.setConnObjectKeyItem(itemTO); } else { opTO.add(itemTO); } }); }
@Override public List<String> getObject() { List<String> result = new ArrayList<>(); if (StringUtils.isNotBlank(item.getPropagationJEXLTransformer())) { result.add(item.getPropagationJEXLTransformer()); } if (StringUtils.isNotBlank(item.getPullJEXLTransformer())) { result.add(item.getPullJEXLTransformer()); } return result; } };
protected boolean addConnObjectKeyItem(final ItemTO connObjectItem) { connObjectItem.setMandatoryCondition("true"); connObjectItem.setConnObjectKey(true); return this.add(connObjectItem); }
LOG.error("Null {}", ItemTO.class.getSimpleName()); invalidMapping.getElements().add("Null " + ItemTO.class.getSimpleName()); } else if (itemTO.getIntAttrName() == null) { requiredValuesMissing.getElements().add("intAttrName"); scce.addException(requiredValuesMissing); try { intAttrName = intAttrNameParser.parse( itemTO.getIntAttrName(), mapping.getProvision().getAnyType().getKind()); } catch (ParseException e) { LOG.error("Invalid intAttrName '{}'", itemTO.getIntAttrName(), e); LOG.error("'{}' not existing", itemTO.getIntAttrName()); invalidMapping.getElements().add("'" + itemTO.getIntAttrName() + "' not existing"); } else { boolean allowed = true; if (!JexlUtils.isExpressionValid(itemTO.getMandatoryCondition() == null ? "false" : itemTO.getMandatoryCondition())) { invalidMandatoryCondition.getElements().add(itemTO.getMandatoryCondition()); scce.addException(invalidMandatoryCondition); item.setIntAttrName(itemTO.getIntAttrName()); item.setExtAttrName(itemTO.getExtAttrName()); item.setPurpose(itemTO.getPurpose()); item.setMandatoryCondition(itemTO.getMandatoryCondition()); item.setConnObjectKey(itemTO.isConnObjectKey()); item.setPassword(itemTO.isPassword());
LOG.error("Null {}", ItemTO.class.getSimpleName()); invalidMapping.getElements().add("Null " + ItemTO.class.getSimpleName()); } else if (itemTO.getIntAttrName() == null) { requiredValuesMissing.getElements().add("intAttrName"); scce.addException(requiredValuesMissing); IntAttrName intAttrName = null; try { intAttrName = intAttrNameParser.parse(itemTO.getIntAttrName(), AnyTypeKind.USER); } catch (ParseException e) { LOG.error("Invalid intAttrName '{}' specified, ignoring", itemTO.getIntAttrName(), e); LOG.error("'{}' not existing", itemTO.getIntAttrName()); invalidMapping.getElements().add("'" + itemTO.getIntAttrName() + "' not existing"); } else { boolean allowed = true; if (!JexlUtils.isExpressionValid(itemTO.getMandatoryCondition() == null ? "false" : itemTO.getMandatoryCondition())) { invalidMandatoryCondition.getElements().add(itemTO.getMandatoryCondition()); scce.addException(invalidMandatoryCondition); item.setIntAttrName(itemTO.getIntAttrName()); item.setExtAttrName(itemTO.getExtAttrName()); item.setMandatoryCondition(itemTO.getMandatoryCondition()); item.setConnObjectKey(itemTO.isConnObjectKey()); item.setPassword(itemTO.isPassword()); item.setPropagationJEXLTransformer(itemTO.getPropagationJEXLTransformer());
@PreAuthorize("hasRole('" + OIDCClientEntitlement.OP_CREATE + "')") public String create(final OIDCProviderTO opTO) { if (opTO.getConnObjectKeyItem() == null) { ItemTO connObjectKeyItem = new ItemTO(); connObjectKeyItem.setIntAttrName("username"); connObjectKeyItem.setExtAttrName("email"); opTO.setConnObjectKeyItem(connObjectKeyItem); } OIDCProvider provider = opDAO.save(binder.create(opTO)); return provider.getKey(); }
@Override public ItemTO getConnObjectKeyItem() { return getItems().stream().filter(item -> item.isConnObjectKey()).findFirst().orElse(null); }
@Override protected void populateItem(final ListItem<ItemTO> item) { final ItemTO itemTO = item.getModelObject(); if (itemTO.getPurpose() == null) { itemTO.setPurpose(defaultPurpose); extAttrName.setChoices(getExtAttrNames().getObject()); boolean required = !itemTO.isPassword(); extAttrName.setRequired(required).hideLabel(); extAttrName.setEnabled(required); mandatory.hideLabel(); mandatory.setChoices(Arrays.asList(new String[] { "true", "false" })); mandatory.setEnabled(!itemTO.isConnObjectKey()); item.add(mandatory); if (itemTO.isPassword()) { itemTO.setPassword(false);
} else if (right == null) { compared = -1; } else if (left.isConnObjectKey()) { compared = -1; } else if (right.isConnObjectKey()) { compared = 1; } else if (left.isPassword()) { compared = -1; } else if (right.isPassword()) { compared = 1; } else if (left.getPurpose() == MappingPurpose.BOTH && right.getPurpose() != MappingPurpose.BOTH) { compared = -1; } else if (left.getPurpose() != MappingPurpose.BOTH && right.getPurpose() == MappingPurpose.BOTH) { compared = 1; } else if (left.getPurpose() == MappingPurpose.PROPAGATION && (right.getPurpose() == MappingPurpose.PULL || right.getPurpose() == MappingPurpose.NONE)) { compared = -1; } else if (left.getPurpose() == MappingPurpose.PULL && right.getPurpose() == MappingPurpose.PROPAGATION) { compared = 1; } else if (left.getPurpose() == MappingPurpose.PULL && right.getPurpose() == MappingPurpose.NONE) { compared = -1; } else if (left.getPurpose() == MappingPurpose.NONE && right.getPurpose() != MappingPurpose.NONE) { compared = 1; } else { compared = left.getIntAttrName().compareTo(right.getIntAttrName());
@Override protected void onSubmit(final AjaxRequestTarget target) { model.getObject().add(new ItemTO()); target.add(AbstractMappingPanel.this); } };
&& idp.getConnObjectKeyItem().getExtAttrName().equals("NameID")) { if (!attr.getAttributeValues().isEmpty()) { String attrName = attr.getFriendlyName() == null ? attr.getName() : attr.getFriendlyName(); if (attrName.equals(idp.getConnObjectKeyItem().getExtAttrName())) { if (attr.getAttributeValues().get(0) instanceof XSString) { keyValue = ((XSString) attr.getAttributeValues().get(0)).getValue();
LOG.error("Null {}", ItemTO.class.getSimpleName()); invalidMapping.getElements().add("Null " + ItemTO.class.getSimpleName()); } else if (itemTO.getIntAttrName() == null) { requiredValuesMissing.getElements().add("intAttrName"); scce.addException(requiredValuesMissing); } else { if (!"name".equals(itemTO.getIntAttrName()) && !"fullpath".equals(itemTO.getIntAttrName())) { LOG.error("Only 'name' and 'fullpath' are supported for Realms"); invalidMapping.getElements().add("Only 'name' and 'fullpath' are supported for Realms"); } else { if (!JexlUtils.isExpressionValid(itemTO.getMandatoryCondition() == null ? "false" : itemTO.getMandatoryCondition())) { invalidMandatoryCondition.getElements().add(itemTO.getMandatoryCondition()); scce.addException(invalidMandatoryCondition); item.setIntAttrName(itemTO.getIntAttrName()); item.setExtAttrName(itemTO.getExtAttrName()); item.setPurpose(itemTO.getPurpose()); item.setMandatoryCondition(itemTO.getMandatoryCondition()); item.setConnObjectKey(itemTO.isConnObjectKey()); item.setPassword(itemTO.isPassword()); item.setPropagationJEXLTransformer(itemTO.getPropagationJEXLTransformer()); item.setPullJEXLTransformer(itemTO.getPullJEXLTransformer()); item.setOrgUnit(orgUnit); if (item.isConnObjectKey()) { itemTO.getTransformers().forEach(transformerKey -> {
LOG.error("Null {}", ItemTO.class.getSimpleName()); invalidMapping.getElements().add("Null " + ItemTO.class.getSimpleName()); } else if (itemTO.getIntAttrName() == null) { requiredValuesMissing.getElements().add("intAttrName"); scce.addException(requiredValuesMissing); IntAttrName intAttrName = null; try { intAttrName = intAttrNameParser.parse(itemTO.getIntAttrName(), AnyTypeKind.USER); } catch (ParseException e) { LOG.error("Invalid intAttrName '{}' specified, ignoring", itemTO.getIntAttrName(), e); LOG.error("'{}' not existing", itemTO.getIntAttrName()); invalidMapping.getElements().add("'" + itemTO.getIntAttrName() + "' not existing"); } else { boolean allowed = true; if (!JexlUtils.isExpressionValid(itemTO.getMandatoryCondition() == null ? "false" : itemTO.getMandatoryCondition())) { invalidMandatoryCondition.getElements().add(itemTO.getMandatoryCondition()); scce.addException(invalidMandatoryCondition); item.setIntAttrName(itemTO.getIntAttrName()); item.setExtAttrName(itemTO.getExtAttrName()); item.setMandatoryCondition(itemTO.getMandatoryCondition()); item.setConnObjectKey(itemTO.isConnObjectKey()); item.setPassword(itemTO.isPassword()); item.setPropagationJEXLTransformer(itemTO.getPropagationJEXLTransformer());
protected boolean addConnObjectKeyItem(final ItemTO connObjectItem) { connObjectItem.setMandatoryCondition("true"); connObjectItem.setConnObjectKey(true); return this.add(connObjectItem); }
ItemTO connObjectKeyItem = new ItemTO(); connObjectKeyItem.setIntAttrName("username"); connObjectKeyItem.setExtAttrName("NameID"); idpTO.setConnObjectKeyItem(connObjectKeyItem);
@Override public ItemTO getConnObjectKeyItem() { return getItems().stream().filter(item -> item.isConnObjectKey()).findFirst().orElse(null); }
private void populateItems(final SAML2IdP idp, final SAML2IdPTO idpTO) { idp.getItems().forEach(item -> { ItemTO itemTO = new ItemTO(); itemTO.setKey(item.getKey()); itemTO.setIntAttrName(item.getIntAttrName()); itemTO.setExtAttrName(item.getExtAttrName()); itemTO.setMandatoryCondition(item.getMandatoryCondition()); itemTO.setConnObjectKey(item.isConnObjectKey()); itemTO.setPassword(item.isPassword()); itemTO.setPropagationJEXLTransformer(item.getPropagationJEXLTransformer()); itemTO.setPullJEXLTransformer(item.getPullJEXLTransformer()); itemTO.setPurpose(MappingPurpose.NONE); if (itemTO.isConnObjectKey()) { idpTO.setConnObjectKeyItem(itemTO); } else { idpTO.add(itemTO); } }); }
protected boolean addConnObjectKeyItem(final ItemTO connObjectItem) { connObjectItem.setMandatoryCondition("true"); connObjectItem.setConnObjectKey(true); return this.add(connObjectItem); }
@Override public ItemTO getConnObjectKeyItem() { return getItems().stream().filter(item -> item.isConnObjectKey()).findFirst().orElse(null); }
private void populateItems(final List<? extends Item> items, final ItemContainerTO containerTO) { items.forEach(item -> { ItemTO itemTO = new ItemTO(); itemTO.setKey(item.getKey()); itemTO.setIntAttrName(item.getIntAttrName()); itemTO.setExtAttrName(item.getExtAttrName()); itemTO.setPurpose(item.getPurpose()); itemTO.setMandatoryCondition(item.getMandatoryCondition()); itemTO.setConnObjectKey(item.isConnObjectKey()); itemTO.setPassword(item.isPassword()); itemTO.setPropagationJEXLTransformer(item.getPropagationJEXLTransformer()); itemTO.setPullJEXLTransformer(item.getPullJEXLTransformer()); if (itemTO.isConnObjectKey()) { containerTO.setConnObjectKeyItem(itemTO); } else { containerTO.add(itemTO); } itemTO.getTransformers().addAll(item.getTransformers().stream(). map(Entity::getKey).collect(Collectors.toSet())); }); }