Search in sources :

Example 1 with SAML2UserTemplate

use of org.apache.syncope.core.persistence.api.entity.SAML2UserTemplate in project syncope by apache.

the class SAML2IdPDataBinderImpl method update.

@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 {
        SAML2UserTemplate userTemplate = idp.getUserTemplate();
        if (userTemplate == null) {
            userTemplate = entityFactory.newEntity(SAML2UserTemplate.class);
            userTemplate.setAnyType(anyTypeDAO.findUser());
            userTemplate.setIdP(idp);
            idp.setUserTemplate(userTemplate);
        }
        userTemplate.set(idpTO.getUserTemplate());
    }
    idp.getItems().clear();
    AnyTypeClassTO allowedSchemas = new AnyTypeClassTO();
    anyTypeDAO.findUser().getClasses().forEach(anyTypeClass -> {
        allowedSchemas.getPlainSchemas().addAll(anyTypeClass.getPlainSchemas().stream().map(Entity::getKey).collect(Collectors.toList()));
        allowedSchemas.getDerSchemas().addAll(anyTypeClass.getDerSchemas().stream().map(Entity::getKey).collect(Collectors.toList()));
        allowedSchemas.getVirSchemas().addAll(anyTypeClass.getVirSchemas().stream().map(Entity::getKey).collect(Collectors.toList()));
    });
    populateItems(idpTO, idp, allowedSchemas);
    idp.getActionsClassNames().clear();
    idp.getActionsClassNames().addAll(idpTO.getActionsClassNames());
    return saml2IdPDAO.save(idp);
}
Also used : SAML2UserTemplate(org.apache.syncope.core.persistence.api.entity.SAML2UserTemplate) Entity(org.apache.syncope.core.persistence.api.entity.Entity) AnyTypeClassTO(org.apache.syncope.common.lib.to.AnyTypeClassTO)

Aggregations

AnyTypeClassTO (org.apache.syncope.common.lib.to.AnyTypeClassTO)1 Entity (org.apache.syncope.core.persistence.api.entity.Entity)1 SAML2UserTemplate (org.apache.syncope.core.persistence.api.entity.SAML2UserTemplate)1