[SYNCOPE-152] SCIM configuration including attribute mapping + console extension
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7cd22892 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7cd22892 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7cd22892 Branch: refs/heads/master Commit: 7cd228925e538bd7743a22ac923bdee4b30a32e6 Parents: e3ac899 Author: Francesco Chicchiriccò <ilgro...@apache.org> Authored: Tue Nov 14 16:54:25 2017 +0100 Committer: Francesco Chicchiriccò <ilgro...@apache.org> Committed: Tue Nov 14 17:23:18 2017 +0100 ---------------------------------------------------------------------- .../archetype-resources/console/pom.xml | 6 + .../resources/archetype-resources/core/pom.xml | 11 + .../panels/ParametersDirectoryPanel.java | 2 +- .../console/panels/RoleDirectoryPanel.java | 2 +- ext/scimv2/client-console/pom.xml | 78 ++++ .../syncope/client/console/pages/SCIMConf.java | 137 +++++++ .../client/console/rest/SCIMConfRestClient.java | 35 ++ .../syncope/client/console/pages/SCIMConf.html | 41 ++ .../client/console/pages/SCIMConf.properties | 17 + .../client/console/pages/SCIMConf_it.properties | 17 + .../console/pages/SCIMConf_pt_BR.properties | 17 + .../client/console/pages/SCIMConf_ru.properties | 17 + ext/scimv2/common-lib/pom.xml | 56 +++ .../common/lib/scim/SCIMComplexConf.java | 67 ++++ .../syncope/common/lib/scim/SCIMConf.java | 126 ++++++ .../common/lib/scim/SCIMEnterpriseUserConf.java | 87 ++++ .../common/lib/scim/SCIMManagerConf.java | 47 +++ .../common/lib/scim/SCIMUserAddressConf.java | 107 +++++ .../syncope/common/lib/scim/SCIMUserConf.java | 159 ++++++++ .../common/lib/scim/SCIMUserNameConf.java | 87 ++++ .../lib/scim/types/AddressCanonicalType.java | 26 ++ .../lib/scim/types/EmailCanonicalType.java | 26 ++ .../common/lib/scim/types/IMCanonicalType.java | 31 ++ .../scim/types/PhoneNumberCanonicalType.java | 29 ++ .../lib/scim/types/PhotoCanonicalType.java | 25 ++ .../common/lib/scim/types/SCIMEntitlement.java | 52 +++ ext/scimv2/logic/pom.xml | 6 + .../apache/syncope/core/logic/RootLogic.java | 143 ------- .../syncope/core/logic/SCIMDataBinder.java | 394 +++++++++++++++++++ .../apache/syncope/core/logic/SCIMLogic.java | 198 ++++++++++ .../syncope/core/logic/init/SCIMLoader.java | 73 +--- .../core/logic/scim/SCIMConfManager.java | 93 +++++ .../src/main/resources/scimv2-logic.properties | 21 - ext/scimv2/pom.xml | 4 + ext/scimv2/rest-api/pom.xml | 77 ++++ .../rest/api/service/SCIMConfService.java | 53 +++ ext/scimv2/rest-cxf/pom.xml | 72 ++++ .../rest/cxf/service/SCIMConfServiceImpl.java | 41 ++ .../syncope/ext/scimv2/api/data/Display.java | 46 --- .../syncope/ext/scimv2/api/data/Reference.java | 11 +- .../syncope/ext/scimv2/api/data/SCIMBean.java | 2 +- .../ext/scimv2/api/data/SCIMComplexValue.java | 71 ++++ .../ext/scimv2/api/data/SCIMEnterpriseInfo.java | 96 +++++ .../syncope/ext/scimv2/api/data/SCIMUser.java | 165 +++++++- .../ext/scimv2/api/data/SCIMUserAddress.java | 117 ++++++ .../ext/scimv2/api/data/SCIMUserManager.java | 63 +++ .../ext/scimv2/api/data/SCIMUserName.java | 96 +++++ .../scimv2/api/data/ServiceProviderConfig.java | 11 + .../syncope/ext/scimv2/api/data/Value.java | 39 ++ .../ext/scimv2/api/service/GroupService.java | 2 +- .../ext/scimv2/api/service/RootService.java | 59 --- .../ext/scimv2/api/service/SCIMService.java | 40 +- .../ext/scimv2/api/service/SearchService.java | 41 ++ .../ext/scimv2/api/service/UserService.java | 2 +- .../syncope/ext/scimv2/cxf/AddETagFilter.java | 2 +- .../scimv2/cxf/service/AbstractSCIMService.java | 235 ----------- .../ext/scimv2/cxf/service/AbstractService.java | 160 ++++++++ .../scimv2/cxf/service/GroupServiceImpl.java | 4 +- .../ext/scimv2/cxf/service/RootServiceImpl.java | 68 ---- .../ext/scimv2/cxf/service/SCIMServiceImpl.java | 68 ++++ .../ext/scimv2/cxf/service/UserServiceImpl.java | 4 +- fit/console-reference/pom.xml | 6 + .../src/test/resources/rebel.xml | 6 + fit/core-reference/pom.xml | 25 +- .../main/resources/all/scimv2-logic.properties | 21 - .../org/apache/syncope/fit/AbstractITCase.java | 4 + .../org/apache/syncope/fit/core/SCIMITCase.java | 31 ++ fit/core-reference/src/test/resources/rebel.xml | 6 + 68 files changed, 3291 insertions(+), 690 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/archetype/src/main/resources/archetype-resources/console/pom.xml ---------------------------------------------------------------------- diff --git a/archetype/src/main/resources/archetype-resources/console/pom.xml b/archetype/src/main/resources/archetype-resources/console/pom.xml index 8646381..da2018f 100644 --- a/archetype/src/main/resources/archetype-resources/console/pom.xml +++ b/archetype/src/main/resources/archetype-resources/console/pom.xml @@ -141,6 +141,12 @@ under the License. </dependency> <dependency> + <groupId>org.apache.syncope.ext.scimv2</groupId> + <artifactId>syncope-ext-scimv2-client-console</artifactId> + <version>${syncope.version}</version> + </dependency> + + <dependency> <groupId>org.flowable</groupId> <artifactId>flowable-ui-modeler-app</artifactId> <type>war</type> http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/archetype/src/main/resources/archetype-resources/core/pom.xml ---------------------------------------------------------------------- diff --git a/archetype/src/main/resources/archetype-resources/core/pom.xml b/archetype/src/main/resources/archetype-resources/core/pom.xml index aae48ce..8e68fe9 100644 --- a/archetype/src/main/resources/archetype-resources/core/pom.xml +++ b/archetype/src/main/resources/archetype-resources/core/pom.xml @@ -193,6 +193,17 @@ under the License. </dependency> <dependency> + <groupId>org.apache.syncope.ext.scimv2</groupId> + <artifactId>syncope-ext-scimv2-rest-cxf</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.syncope.ext.scimv2</groupId> + <artifactId>syncope-ext-scimv2-scim-rest-cxf</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> <groupId>org.apache.syncope.ext</groupId> <artifactId>syncope-ext-swagger-ui</artifactId> <version>${syncope.version}</version> http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java index ea927a5..dbf222c 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ParametersDirectoryPanel.java @@ -100,7 +100,7 @@ public class ParametersDirectoryPanel target.add(container); } }); - + modalDetails.size(Modal.Size.Medium); addInnerObject(modalDetails); this.addNewItemPanelBuilder(new AbstractModalPanelBuilder<AttrTO>(new AttrTO(), pageRef) { http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java index 5644e85..4768d16 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDirectoryPanel.java @@ -224,7 +224,7 @@ public class RoleDirectoryPanel extends DirectoryPanel<RoleTO, RoleWrapper, Role modal.show(false); modal.close(target); } catch (Exception e) { - LOG.error("While updating onsole layout info for role {}", info.getKey(), e); + LOG.error("While updating console layout info for role {}", info.getKey(), e); SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/client-console/pom.xml ---------------------------------------------------------------------- diff --git a/ext/scimv2/client-console/pom.xml b/ext/scimv2/client-console/pom.xml new file mode 100644 index 0000000..7b02052 --- /dev/null +++ b/ext/scimv2/client-console/pom.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.syncope.ext</groupId> + <artifactId>syncope-ext-scimv2</artifactId> + <version>2.1.0-SNAPSHOT</version> + </parent> + + <name>Apache Syncope Ext: SCIMv2 Client Console</name> + <description>Apache Syncope Ext: SCIMv2 Client Console</description> + <groupId>org.apache.syncope.ext.scimv2</groupId> + <artifactId>syncope-ext-scimv2-client-console</artifactId> + <packaging>jar</packaging> + + <properties> + <rootpom.basedir>${basedir}/../../..</rootpom.basedir> + </properties> + + <dependencies> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.syncope.ext.scimv2</groupId> + <artifactId>syncope-ext-scimv2-common-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.syncope.ext.scimv2</groupId> + <artifactId>syncope-ext-scimv2-rest-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.syncope.client</groupId> + <artifactId>syncope-client-console</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + </plugin> + </plugins> + + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + </build> +</project> http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/pages/SCIMConf.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/pages/SCIMConf.java b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/pages/SCIMConf.java new file mode 100644 index 0000000..bd22f03 --- /dev/null +++ b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/pages/SCIMConf.java @@ -0,0 +1,137 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.console.pages; + +import com.fasterxml.jackson.databind.ObjectMapper; +import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal; +import org.apache.commons.lang3.StringUtils; +import org.apache.syncope.client.console.BookmarkablePageLinkBuilder; +import org.apache.syncope.client.console.SyncopeConsoleSession; +import org.apache.syncope.client.console.annotations.ExtPage; +import org.apache.syncope.client.console.commons.Constants; +import org.apache.syncope.client.console.rest.SCIMConfRestClient; +import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; +import org.apache.syncope.client.console.wicket.markup.html.form.JsonEditorPanel; +import org.apache.syncope.common.lib.scim.SCIMComplexConf; +import org.apache.syncope.common.lib.scim.SCIMEnterpriseUserConf; +import org.apache.syncope.common.lib.scim.SCIMUserConf; +import org.apache.syncope.common.lib.scim.SCIMUserNameConf; +import org.apache.syncope.common.lib.scim.types.EmailCanonicalType; +import org.apache.syncope.common.lib.scim.types.SCIMEntitlement; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.markup.html.AjaxLink; +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.ResourceModel; +import org.apache.wicket.request.mapper.parameter.PageParameters; + +@ExtPage(label = "SCIM 2.0", icon = "fa-cloud", listEntitlement = SCIMEntitlement.SCIM_CONF_GET, priority = 100) +public class SCIMConf extends BaseExtPage { + + private static final long serialVersionUID = 9128779230455599119L; + + private static final ObjectMapper MAPPER = new ObjectMapper(); + + private final SCIMConfRestClient restClient = new SCIMConfRestClient(); + + public SCIMConf(final PageParameters parameters) { + super(parameters); + + body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class)); + + final BaseModal<String> modal = new BaseModal<>("modal"); + modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { + + private static final long serialVersionUID = 8804221891699487139L; + + @Override + public void onClose(final AjaxRequestTarget target) { + modal.show(false); + } + }); + modal.size(Modal.Size.Large); + modal.addSubmitButton(); + body.add(modal); + + WebMarkupContainer content = new WebMarkupContainer("content"); + content.setOutputMarkupId(true); + body.add(content); + + String confString = ""; + try { + org.apache.syncope.common.lib.scim.SCIMConf conf = restClient.get(); + if (conf.getUserConf() == null) { + conf.setUserConf(new SCIMUserConf()); + } + if (conf.getUserConf().getName() == null) { + conf.getUserConf().setName(new SCIMUserNameConf()); + } + if (conf.getUserConf().getEmails().isEmpty()) { + conf.getUserConf().getEmails().add(new SCIMComplexConf<EmailCanonicalType>()); + } + + if (conf.getEnterpriseUserConf() == null) { + conf.setEnterpriseUserConf(new SCIMEnterpriseUserConf()); + } + + confString = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(conf); + } catch (Exception e) { + LOG.error("While reading SCIM configuration", e); + SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) + ? e.getClass().getName() : e.getMessage()); + } + final Model<String> confModel = Model.of(confString); + + content.add(new AjaxLink<Void>("edit") { + + private static final long serialVersionUID = -4331619903296515985L; + + @Override + public void onClick(final AjaxRequestTarget target) { + modal.header(new ResourceModel("editConf")); + modal.setContent(new JsonEditorPanel(modal, confModel, false, getPageReference()) { + + private static final long serialVersionUID = -8927036362466990179L; + + @Override + public void onSubmit(final AjaxRequestTarget target, final Form<?> form) { + try { + restClient.set(MAPPER.readValue( + confModel.getObject(), org.apache.syncope.common.lib.scim.SCIMConf.class)); + + SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); + modal.show(false); + modal.close(target); + } catch (Exception e) { + LOG.error("While setting SCIM configuration", e); + SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) + ? e.getClass().getName() : e.getMessage()); + } + ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target); + } + }); + modal.show(true); + target.add(modal); + } + }); + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/rest/SCIMConfRestClient.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/rest/SCIMConfRestClient.java b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/rest/SCIMConfRestClient.java new file mode 100644 index 0000000..95ae663 --- /dev/null +++ b/ext/scimv2/client-console/src/main/java/org/apache/syncope/client/console/rest/SCIMConfRestClient.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.console.rest; + +import org.apache.syncope.common.lib.scim.SCIMConf; +import org.apache.syncope.common.rest.api.service.SCIMConfService; + +public class SCIMConfRestClient extends BaseRestClient { + + private static final long serialVersionUID = -8572714521320571470L; + + public SCIMConf get() { + return getService(SCIMConfService.class).get(); + } + + public void set(final SCIMConf conf) { + getService(SCIMConfService.class).set(conf); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf.html ---------------------------------------------------------------------- diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf.html b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf.html new file mode 100644 index 0000000..aa1e725 --- /dev/null +++ b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> + <wicket:extend> + <section class="content-header"> + <h1> </h1> + <ol class="breadcrumb"> + <li><a wicket:id="dashboardBr"><i class="fa fa-dashboard"></i> <wicket:message key="dashboard"/></a></li> + <li class="active"><wicket:message key="extensions"/></li> + <li class="active">SCIM 2.0</li> + </ol> + </section> + + <section class="content" wicket:id="content"> + <div class="logviewer-btn"> + <a class="btn btn-primary" wicket:id="edit"> <wicket:message key="editConf"/> + <span class="fa fa-edit"></span> + </a> + </div> + </section> + + <div wicket:id="modal"/> + </wicket:extend> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf.properties ---------------------------------------------------------------------- diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf.properties b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf.properties new file mode 100644 index 0000000..e7f31e6 --- /dev/null +++ b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf.properties @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +editConf=SCIM 2.0 configuration http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_it.properties ---------------------------------------------------------------------- diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_it.properties b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_it.properties new file mode 100644 index 0000000..3655a0f --- /dev/null +++ b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_it.properties @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +editConf=Configurazione SCIM 2.0 http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_pt_BR.properties ---------------------------------------------------------------------- diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_pt_BR.properties b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_pt_BR.properties new file mode 100644 index 0000000..e7f31e6 --- /dev/null +++ b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_pt_BR.properties @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +editConf=SCIM 2.0 configuration http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_ru.properties ---------------------------------------------------------------------- diff --git a/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_ru.properties b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_ru.properties new file mode 100644 index 0000000..e7f31e6 --- /dev/null +++ b/ext/scimv2/client-console/src/main/resources/org/apache/syncope/client/console/pages/SCIMConf_ru.properties @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +editConf=SCIM 2.0 configuration http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/pom.xml ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/pom.xml b/ext/scimv2/common-lib/pom.xml new file mode 100644 index 0000000..246688d --- /dev/null +++ b/ext/scimv2/common-lib/pom.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.syncope.ext</groupId> + <artifactId>syncope-ext-scimv2</artifactId> + <version>2.1.0-SNAPSHOT</version> + </parent> + + <name>Apache Syncope Ext: SCIMv2 Common Lib</name> + <description>Apache Syncope Ext: SCIMv2 Common Lib</description> + <groupId>org.apache.syncope.ext.scimv2</groupId> + <artifactId>syncope-ext-scimv2-common-lib</artifactId> + <packaging>jar</packaging> + + <properties> + <rootpom.basedir>${basedir}/../../..</rootpom.basedir> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.syncope.common</groupId> + <artifactId>syncope-common-lib</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMComplexConf.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMComplexConf.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMComplexConf.java new file mode 100644 index 0000000..84cb3fa --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMComplexConf.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim; + +import java.io.Serializable; + +public class SCIMComplexConf<E extends Enum<?>> implements Serializable { + + private static final long serialVersionUID = -6205072829179565927L; + + private String value; + + private String display; + + private E type; + + private boolean primary; + + public String getValue() { + return value; + } + + public void setValue(final String value) { + this.value = value; + } + + public String getDisplay() { + return display; + } + + public void setDisplay(final String display) { + this.display = display; + } + + public E getType() { + return type; + } + + public void setType(final E type) { + this.type = type; + } + + public boolean isPrimary() { + return primary; + } + + public void setPrimary(final boolean primary) { + this.primary = primary; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMConf.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMConf.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMConf.java new file mode 100644 index 0000000..e7cc2a4 --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMConf.java @@ -0,0 +1,126 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.io.Serializable; +import java.util.Date; +import org.apache.commons.lang3.StringUtils; + +public class SCIMConf implements Serializable { + + private static final long serialVersionUID = 5032136914118958611L; + + public static final String KEY = "scimv2.conf"; + + private Date creationDate = new Date(); + + private Date lastChangeDate = new Date(); + + private int bulkMaxOperations = 1000; + + private int bulkMaxPayloadSize = 1048576; + + private int filterMaxResults = 200; + + private SCIMUserConf userConf; + + private SCIMEnterpriseUserConf enterpriseUserConf; + + public Date getCreationDate() { + if (creationDate != null) { + return new Date(creationDate.getTime()); + } + return null; + } + + public void setCreationDate(final Date creationDate) { + if (creationDate != null) { + this.creationDate = new Date(creationDate.getTime()); + } else { + this.creationDate = null; + } + } + + public Date getLastChangeDate() { + if (lastChangeDate != null) { + return new Date(lastChangeDate.getTime()); + } + return null; + } + + public void setLastChangeDate(final Date lastChangeDate) { + if (lastChangeDate != null) { + this.lastChangeDate = new Date(lastChangeDate.getTime()); + } else { + this.lastChangeDate = null; + } + } + + @JsonIgnore + public String getETagValue() { + Date etagDate = getLastChangeDate() == null + ? getCreationDate() : getLastChangeDate(); + return etagDate == null + ? StringUtils.EMPTY + : String.valueOf(etagDate.getTime()); + + } + + public int getBulkMaxOperations() { + return bulkMaxOperations; + } + + public void setBulkMaxOperations(final int bulkMaxOperations) { + this.bulkMaxOperations = bulkMaxOperations; + } + + public int getBulkMaxPayloadSize() { + return bulkMaxPayloadSize; + } + + public void setBulkMaxPayloadSize(final int bulkMaxPayloadSize) { + this.bulkMaxPayloadSize = bulkMaxPayloadSize; + } + + public int getFilterMaxResults() { + return filterMaxResults; + } + + public void setFilterMaxResults(final int filterMaxResults) { + this.filterMaxResults = filterMaxResults; + } + + public SCIMUserConf getUserConf() { + return userConf; + } + + public void setUserConf(final SCIMUserConf userConf) { + this.userConf = userConf; + } + + public SCIMEnterpriseUserConf getEnterpriseUserConf() { + return enterpriseUserConf; + } + + public void setEnterpriseUserConf(final SCIMEnterpriseUserConf enterpriseUserConf) { + this.enterpriseUserConf = enterpriseUserConf; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMEnterpriseUserConf.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMEnterpriseUserConf.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMEnterpriseUserConf.java new file mode 100644 index 0000000..4cf7b88 --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMEnterpriseUserConf.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim; + +import java.io.Serializable; + +public class SCIMEnterpriseUserConf implements Serializable { + + private static final long serialVersionUID = 5929414914887282638L; + + private String employeeNumber; + + private String costCenter; + + private String organization; + + private String division; + + private String department; + + private SCIMManagerConf manager; + + public String getEmployeeNumber() { + return employeeNumber; + } + + public void setEmployeeNumber(final String employeeNumber) { + this.employeeNumber = employeeNumber; + } + + public String getCostCenter() { + return costCenter; + } + + public void setCostCenter(final String costCenter) { + this.costCenter = costCenter; + } + + public String getOrganization() { + return organization; + } + + public void setOrganization(final String organization) { + this.organization = organization; + } + + public String getDivision() { + return division; + } + + public void setDivision(final String division) { + this.division = division; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(final String department) { + this.department = department; + } + + public SCIMManagerConf getManager() { + return manager; + } + + public void setManager(final SCIMManagerConf manager) { + this.manager = manager; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMManagerConf.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMManagerConf.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMManagerConf.java new file mode 100644 index 0000000..481eb5f --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMManagerConf.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim; + +import java.io.Serializable; + +public class SCIMManagerConf implements Serializable { + + private static final long serialVersionUID = -1443695570207406613L; + + private String manager; + + private String displayName; + + public String getManager() { + return manager; + } + + public void setManager(final String manager) { + this.manager = manager; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(final String displayName) { + this.displayName = displayName; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserAddressConf.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserAddressConf.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserAddressConf.java new file mode 100644 index 0000000..ed5643a --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserAddressConf.java @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim; + +import java.io.Serializable; +import org.apache.syncope.common.lib.scim.types.AddressCanonicalType; + +public class SCIMUserAddressConf implements Serializable { + + private static final long serialVersionUID = 8093531407836615577L; + + private String formatted; + + private String streetAddress; + + private String locality; + + private String region; + + private String postalCode; + + private String country; + + private AddressCanonicalType type; + + private boolean primary; + + public String getFormatted() { + return formatted; + } + + public void setFormatted(final String formatted) { + this.formatted = formatted; + } + + public String getStreetAddress() { + return streetAddress; + } + + public void setStreetAddress(final String streetAddress) { + this.streetAddress = streetAddress; + } + + public String getLocality() { + return locality; + } + + public void setLocality(final String locality) { + this.locality = locality; + } + + public String getRegion() { + return region; + } + + public void setRegion(final String region) { + this.region = region; + } + + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(final String postalCode) { + this.postalCode = postalCode; + } + + public String getCountry() { + return country; + } + + public void setCountry(final String country) { + this.country = country; + } + + public AddressCanonicalType getType() { + return type; + } + + public void setType(final AddressCanonicalType type) { + this.type = type; + } + + public boolean isPrimary() { + return primary; + } + + public void setPrimary(final boolean primary) { + this.primary = primary; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserConf.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserConf.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserConf.java new file mode 100644 index 0000000..7d1be73 --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserConf.java @@ -0,0 +1,159 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import org.apache.syncope.common.lib.scim.types.EmailCanonicalType; +import org.apache.syncope.common.lib.scim.types.IMCanonicalType; +import org.apache.syncope.common.lib.scim.types.PhoneNumberCanonicalType; +import org.apache.syncope.common.lib.scim.types.PhotoCanonicalType; + +public class SCIMUserConf implements Serializable { + + private static final long serialVersionUID = -2700011089067219156L; + + private SCIMUserNameConf name; + + private String displayName; + + private String nickName; + + private String profileUrl; + + private String title; + + private String userType; + + private String preferredLanguage; + + private String locale; + + private String timezone; + + private final List<SCIMComplexConf<EmailCanonicalType>> emails = new ArrayList<>(); + + private final List<SCIMComplexConf<PhoneNumberCanonicalType>> phoneNumbers = new ArrayList<>(); + + private final List<SCIMComplexConf<IMCanonicalType>> ims = new ArrayList<>(); + + private final List<SCIMComplexConf<PhotoCanonicalType>> photos = new ArrayList<>(); + + private final List<SCIMUserAddressConf> addresses = new ArrayList<>(); + + private final List<String> x509Certificates = new ArrayList<>(); + + public SCIMUserNameConf getName() { + return name; + } + + public void setName(final SCIMUserNameConf name) { + this.name = name; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(final String displayName) { + this.displayName = displayName; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(final String nickName) { + this.nickName = nickName; + } + + public String getProfileUrl() { + return profileUrl; + } + + public void setProfileUrl(final String profileUrl) { + this.profileUrl = profileUrl; + } + + public String getTitle() { + return title; + } + + public void setTitle(final String title) { + this.title = title; + } + + public String getUserType() { + return userType; + } + + public void setUserType(final String userType) { + this.userType = userType; + } + + public String getPreferredLanguage() { + return preferredLanguage; + } + + public void setPreferredLanguage(final String preferredLanguage) { + this.preferredLanguage = preferredLanguage; + } + + public String getLocale() { + return locale; + } + + public void setLocale(final String locale) { + this.locale = locale; + } + + public String getTimezone() { + return timezone; + } + + public void setTimezone(final String timezone) { + this.timezone = timezone; + } + + public List<SCIMComplexConf<EmailCanonicalType>> getEmails() { + return emails; + } + + public List<SCIMComplexConf<PhoneNumberCanonicalType>> getPhoneNumbers() { + return phoneNumbers; + } + + public List<SCIMComplexConf<IMCanonicalType>> getIms() { + return ims; + } + + public List<SCIMComplexConf<PhotoCanonicalType>> getPhotos() { + return photos; + } + + public List<SCIMUserAddressConf> getAddresses() { + return addresses; + } + + public List<String> getX509Certificates() { + return x509Certificates; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserNameConf.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserNameConf.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserNameConf.java new file mode 100644 index 0000000..2f2db0f --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/SCIMUserNameConf.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim; + +import java.io.Serializable; + +public class SCIMUserNameConf implements Serializable { + + private static final long serialVersionUID = -2256008193008290376L; + + private String formatted; + + private String familyName; + + private String givenName; + + private String middleName; + + private String honorificPrefix; + + private String honorificSuffix; + + public String getFormatted() { + return formatted; + } + + public void setFormatted(final String formatted) { + this.formatted = formatted; + } + + public String getFamilyName() { + return familyName; + } + + public void setFamilyName(final String familyName) { + this.familyName = familyName; + } + + public String getGivenName() { + return givenName; + } + + public void setGivenName(final String givenName) { + this.givenName = givenName; + } + + public String getMiddleName() { + return middleName; + } + + public void setMiddleName(final String middleName) { + this.middleName = middleName; + } + + public String getHonorificPrefix() { + return honorificPrefix; + } + + public void setHonorificPrefix(final String honorificPrefix) { + this.honorificPrefix = honorificPrefix; + } + + public String getHonorificSuffix() { + return honorificSuffix; + } + + public void setHonorificSuffix(final String honorificSuffix) { + this.honorificSuffix = honorificSuffix; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/AddressCanonicalType.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/AddressCanonicalType.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/AddressCanonicalType.java new file mode 100644 index 0000000..cf2cb13 --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/AddressCanonicalType.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim.types; + +public enum AddressCanonicalType { + work, + home, + other + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/EmailCanonicalType.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/EmailCanonicalType.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/EmailCanonicalType.java new file mode 100644 index 0000000..986c9f6 --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/EmailCanonicalType.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim.types; + +public enum EmailCanonicalType { + work, + home, + other + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/IMCanonicalType.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/IMCanonicalType.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/IMCanonicalType.java new file mode 100644 index 0000000..09d4430 --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/IMCanonicalType.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim.types; + +public enum IMCanonicalType { + aim, + gtalk, + icq, + xmpp, + msn, + skype, + qq, + yahoo + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/PhoneNumberCanonicalType.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/PhoneNumberCanonicalType.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/PhoneNumberCanonicalType.java new file mode 100644 index 0000000..72ff342 --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/PhoneNumberCanonicalType.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim.types; + +public enum PhoneNumberCanonicalType { + work, + home, + mobile, + fax, + pager, + other + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/PhotoCanonicalType.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/PhotoCanonicalType.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/PhotoCanonicalType.java new file mode 100644 index 0000000..b6428f1 --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/PhotoCanonicalType.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim.types; + +public enum PhotoCanonicalType { + photo, + thumbnail + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/SCIMEntitlement.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/SCIMEntitlement.java b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/SCIMEntitlement.java new file mode 100644 index 0000000..8a8a1ae --- /dev/null +++ b/ext/scimv2/common-lib/src/main/java/org/apache/syncope/common/lib/scim/types/SCIMEntitlement.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.scim.types; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.Collections; +import java.util.Set; +import java.util.TreeSet; + +public final class SCIMEntitlement { + + public static final String SCIM_CONF_GET = "SCIM_CONF_GET"; + + public static final String SCIM_CONF_SET = "SCIM_CONF_SET"; + + private static final Set<String> VALUES; + + static { + Set<String> values = new TreeSet<>(); + for (Field field : SCIMEntitlement.class.getDeclaredFields()) { + if (Modifier.isStatic(field.getModifiers()) && String.class.equals(field.getType())) { + values.add(field.getName()); + } + } + VALUES = Collections.unmodifiableSet(values); + } + + public static Set<String> values() { + return VALUES; + } + + private SCIMEntitlement() { + // private constructor for static utility class + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/logic/pom.xml ---------------------------------------------------------------------- diff --git a/ext/scimv2/logic/pom.xml b/ext/scimv2/logic/pom.xml index 4569445..204a3bd 100644 --- a/ext/scimv2/logic/pom.xml +++ b/ext/scimv2/logic/pom.xml @@ -52,6 +52,12 @@ under the License. </dependency> <dependency> + <groupId>org.apache.syncope.ext.scimv2</groupId> + <artifactId>syncope-ext-scimv2-common-lib</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> <groupId>org.antlr</groupId> <artifactId>antlr4-runtime</artifactId> </dependency> http://git-wip-us.apache.org/repos/asf/syncope/blob/7cd22892/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/RootLogic.java ---------------------------------------------------------------------- diff --git a/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/RootLogic.java b/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/RootLogic.java deleted file mode 100644 index 75d0ecf..0000000 --- a/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/RootLogic.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.core.logic; - -import java.lang.reflect.Method; -import java.net.URI; -import java.util.Arrays; -import java.util.List; -import javax.ws.rs.NotFoundException; -import javax.ws.rs.core.UriBuilder; -import org.apache.syncope.common.lib.AbstractBaseBean; -import org.apache.syncope.core.logic.init.SCIMLoader; -import org.apache.syncope.ext.scimv2.api.data.AuthenticationScheme; -import org.apache.syncope.ext.scimv2.api.data.BulkConfigurationOption; -import org.apache.syncope.ext.scimv2.api.data.ConfigurationOption; -import org.apache.syncope.ext.scimv2.api.data.FilterConfigurationOption; -import org.apache.syncope.ext.scimv2.api.data.Meta; -import org.apache.syncope.ext.scimv2.api.data.ResourceType; -import org.apache.syncope.ext.scimv2.api.data.SchemaExtension; -import org.apache.syncope.ext.scimv2.api.data.ServiceProviderConfig; -import org.apache.syncope.ext.scimv2.api.type.Resource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.stereotype.Component; - -@Component -public class RootLogic extends AbstractLogic<AbstractBaseBean> { - - private static final Object MONITOR = new Object(); - - private static ServiceProviderConfig SERVICE_PROVIDER_CONFIG; - - private static ResourceType USER; - - private static ResourceType GROUP; - - @Autowired - private SCIMLoader loader; - - @PreAuthorize("isAuthenticated()") - public ServiceProviderConfig serviceProviderConfig() { - synchronized (MONITOR) { - if (SERVICE_PROVIDER_CONFIG == null) { - SERVICE_PROVIDER_CONFIG = new ServiceProviderConfig( - new ConfigurationOption(true), - new BulkConfigurationOption( - true, loader.getBulkMaxOperations(), loader.getBulkMaxPayloadSize()), - new FilterConfigurationOption(true, loader.getFilterMaxResults()), - new ConfigurationOption(true), - new ConfigurationOption(true), - new ConfigurationOption(true)); - SERVICE_PROVIDER_CONFIG.getAuthenticationSchemes().add(new AuthenticationScheme( - "JSON Web Token", - "Apache Syncope JWT authentication", - URI.create("http://www.rfc-editor.org/info/rfc6750"), - URI.create("https://syncope.apache.org/docs/" - + "reference-guide.html#rest-authentication-and-authorization"), - "oauthbearertoken", - true)); - SERVICE_PROVIDER_CONFIG.getAuthenticationSchemes().add(new AuthenticationScheme( - "HTTP Basic", - "Apache Syncope HTTP Basic authentication", - URI.create("http://www.rfc-editor.org/info/rfc2617"), - URI.create("https://syncope.apache.org/docs/" - + "reference-guide.html#rest-authentication-and-authorization"), - "httpbasic", - false)); - } - } - return SERVICE_PROVIDER_CONFIG; - } - - @PreAuthorize("isAuthenticated()") - public List<ResourceType> resourceTypes(final UriBuilder uriBuilder) { - synchronized (MONITOR) { - if (USER == null) { - USER = new ResourceType("User", "User", "/Users", "User Account", Resource.User.schema(), - new Meta(Resource.ResourceType, - null, null, null, uriBuilder.path("User").build().toASCIIString())); - USER.getSchemaExtensions().add(new SchemaExtension(Resource.EnterpriseUser.schema(), true)); - } - if (GROUP == null) { - GROUP = new ResourceType("Group", "Group", "/Groups", "Group", Resource.Group.schema(), - new Meta(Resource.ResourceType, - null, null, null, uriBuilder.path("Group").build().toASCIIString())); - } - } - - return Arrays.asList(USER, GROUP); - } - - @PreAuthorize("isAuthenticated()") - public ResourceType resourceType(final UriBuilder uriBuilder, final String type) { - if (Resource.User.name().equals(type)) { - resourceTypes(uriBuilder); - return USER; - } else if (Resource.Group.name().equals(type)) { - resourceTypes(uriBuilder); - return GROUP; - } else { - throw new IllegalArgumentException("Unsupported resource type: " + type); - } - } - - @PreAuthorize("isAuthenticated()") - public String schemas() { - return loader.getSchemas(); - } - - @PreAuthorize("isAuthenticated()") - public String schema(final String schema) { - String found = loader.getSchema(schema); - if (found == null) { - throw new NotFoundException("Schema " + schema); - } - - return found; - } - - @Override - protected AbstractBaseBean resolveReference(final Method method, final Object... args) - throws UnresolvedReferenceException { - - throw new UnresolvedReferenceException(); - } - -}