public List<String> getActionsClassNames() { return idpTO.getActionsClassNames(); }
public SAML2BindingType getBindingType() { return idpTO.getBindingType(); }
@Override public boolean setConnObjectKeyItem(final ItemTO connObjectKeyItem) { return connObjectKeyItem == null ? remove(getConnObjectKeyItem()) : addConnObjectKeyItem(connObjectKeyItem); }
@Override public SAML2IdP update(final SAML2IdP idp, final SAML2IdPTO idpTO) { idp.setEntityID(idpTO.getEntityID()); idp.setName(idpTO.getName()); idp.setMetadata(Base64.getMimeDecoder().decode(idpTO.getMetadata())); idp.setCreateUnmatching(idpTO.isCreateUnmatching()); idp.setSelfRegUnmatching(idpTO.isSelfRegUnmatching()); idp.setUpdateMatching(idpTO.isUpdateMatching()); idp.setUseDeflateEncoding(idpTO.isUseDeflateEncoding()); idp.setSupportUnsolicited(idpTO.isSupportUnsolicited()); idp.setBindingType(idpTO.getBindingType()); if (idpTO.getUserTemplate() == null) { idp.setUserTemplate(null); } else { idp.setUserTemplate(userTemplate); userTemplate.set(idpTO.getUserTemplate()); idp.getActionsClassNames().addAll(idpTO.getActionsClassNames()); idp.setRequestedAuthnContextProviderClassName(idpTO.getRequestedAuthnContextProviderClassName());
@Override public SAML2IdPTO getIdPTO(final SAML2IdP idp) { SAML2IdPTO idpTO = new SAML2IdPTO(); idpTO.setKey(idp.getKey()); idpTO.setEntityID(idp.getEntityID()); idpTO.setName(idp.getName()); idpTO.setUseDeflateEncoding(idp.isUseDeflateEncoding()); idpTO.setSupportUnsolicited(idp.isSupportUnsolicited()); idpTO.setBindingType(idp.getBindingType()); idpTO.setCreateUnmatching(idp.isCreateUnmatching()); idpTO.setSelfRegUnmatching(idp.isSelfRegUnmatching()); idpTO.setUpdateMatching(idp.isUpdateMatching()); idpTO.setMetadata(Base64.getMimeEncoder().encodeToString(idp.getMetadata())); if (idp.getUserTemplate() != null) { idpTO.setUserTemplate((UserTO) idp.getUserTemplate().get()); } populateItems(idp, idpTO); idpTO.getActionsClassNames().addAll(idp.getActionsClassNames()); idpTO.setRequestedAuthnContextProviderClassName(idp.getRequestedAuthnContextProviderClassName()); return idpTO; } }
SAML2IdPTO idpTO = new SAML2IdPTO(); idpTO.setEntityID(idpEntityDescriptor.getEntityID()); idpTO.setName(idpEntityDescriptor.getEntityID()); idpTO.setUseDeflateEncoding(false); idpTO.setMetadata(Base64.getEncoder().encodeToString(baos.toByteArray())); connObjectKeyItem.setIntAttrName("username"); connObjectKeyItem.setExtAttrName("NameID"); idpTO.setConnObjectKeyItem(connObjectKeyItem); idpTO.setBindingType(SAML2BindingType.POST); } else if (idp.getSSOLocation(SAML2BindingType.REDIRECT) != null) { idpTO.setBindingType(SAML2BindingType.REDIRECT); } else { throw new IllegalArgumentException("Neither POST nor REDIRECT artifacts supported by " + idp.getId());
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); } }); }
@Override public ItemTO getConnObjectKeyItem() { return getItems().stream().filter(item -> item.isConnObjectKey()).findFirst().orElse(null); }
private SAML2IdPTO complete(final SAML2IdP idp, final SAML2IdPTO idpTO) { SAML2IdPEntity idpEntity = cache.get(idpTO.getEntityID()); if (idpEntity == null) { try { idpEntity = cache.put(idp); } catch (Exception e) { LOG.error("Could not build SAML 2.0 IdP with key ", idp.getEntityID(), e); } } idpTO.setLogoutSupported(idpEntity == null ? false : idpEntity.getSLOLocation(SAML2BindingType.POST) != null || idpEntity.getSLOLocation(SAML2BindingType.REDIRECT) != null); return idpTO; }
@PreAuthorize("hasRole('" + SAML2SPEntitlement.IDP_UPDATE + "')") public void update(final SAML2IdPTO saml2IdpTO) { check(); SAML2IdP saml2Idp = idpDAO.find(saml2IdpTO.getKey()); if (saml2Idp == null) { throw new NotFoundException("SAML 2.0 IdP '" + saml2IdpTO.getKey() + "'"); } SAML2IdPEntity idpEntity = cache.get(saml2Idp.getEntityID()); if (idpEntity == null) { try { idpEntity = cache.put(saml2Idp); } catch (Exception e) { LOG.error("Unexpected error while updating {}", saml2Idp.getEntityID(), e); SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidEntity); sce.getElements().add(e.getMessage()); throw sce; } } if (idpEntity.getSSOLocation(saml2IdpTO.getBindingType()) == null) { SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidEntity); sce.getElements().add(saml2IdpTO.getBindingType() + " not supported by " + saml2Idp.getEntityID()); throw sce; } saml2Idp = idpDAO.save(binder.update(saml2Idp, saml2IdpTO)); idpEntity.setIdpTO(binder.getIdPTO(saml2Idp)); }
protected boolean addConnObjectKeyItem(final ItemTO connObjectItem) { connObjectItem.setMandatoryCondition("true"); connObjectItem.setConnObjectKey(true); return this.add(connObjectItem); }
public UserTO getUserTemplate() { return idpTO.getUserTemplate(); }
public String getRequestedAuthnContextProviderClassName() { return idpTO.getRequestedAuthnContextProviderClassName(); }
public ItemTO getConnObjectKeyItem() { return idpTO.getConnObjectKeyItem(); }
public boolean isCreateUnmatching() { return idpTO.isCreateUnmatching(); }
@Override public ItemTO getConnObjectKeyItem() { return getItems().stream().filter(item -> item.isConnObjectKey()).findFirst().orElse(null); }
protected boolean addConnObjectKeyItem(final ItemTO connObjectItem) { connObjectItem.setMandatoryCondition("true"); connObjectItem.setConnObjectKey(true); return this.add(connObjectItem); }
@Override public boolean setConnObjectKeyItem(final ItemTO connObjectKeyItem) { return connObjectKeyItem == null ? remove(getConnObjectKeyItem()) : addConnObjectKeyItem(connObjectKeyItem); }
SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing); for (ItemTO itemTO : idpTO.getItems()) { if (itemTO == null) { LOG.error("Null {}", ItemTO.class.getSimpleName());