You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by mm...@apache.org on 2020/03/16 14:44:41 UTC
[syncope] 02/03: SYNCOPE-160: Consolidate client-app service impls
down to one.
This is an automated email from the ASF dual-hosted git repository.
mmoayyed pushed a commit to branch SYNCOPE-163-1
in repository https://gitbox.apache.org/repos/asf/syncope.git
commit 174f7b4f508b881bcf16c3b2ec34e8eb74e26902
Author: Misagh Moayyed <mm...@gmail.com>
AuthorDate: Mon Mar 16 18:13:17 2020 +0330
SYNCOPE-160: Consolidate client-app service impls down to one.
---
.../console/rest/OIDCRelyingPartyRestClient.java | 53 ------------
.../rest/SAML2ServiceProviderRestClient.java | 53 ------------
.../module/LDAPAuthenticationModuleConf.java | 1 +
.../common/rest/api/service/ClientAppService.java | 18 +++--
.../api/service/oidc/OIDCRelyingPartyService.java | 36 ---------
.../service/saml/SAML2ServiceProviderService.java | 34 --------
.../core/logic/saml/SAML2ServiceProviderLogic.java | 1 -
.../cxf/service/AbstractClientAppServiceImpl.java | 65 ---------------
.../rest/cxf/service/ClientAppServiceImpl.java | 94 ++++++++++++++++++++++
.../service/oidc/OIDCRelyingPartyServiceImpl.java | 42 ----------
.../saml/SAML2ServiceProviderServiceImpl.java | 42 ----------
.../org/apache/syncope/fit/AbstractITCase.java | 21 +++--
.../syncope/fit/core/OIDCRelyingPartyITCase.java | 10 +--
.../fit/core/SAML2ServiceProviderITCase.java | 10 +--
14 files changed, 127 insertions(+), 353 deletions(-)
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/rest/OIDCRelyingPartyRestClient.java b/client/am/console/src/main/java/org/apache/syncope/client/console/rest/OIDCRelyingPartyRestClient.java
deleted file mode 100644
index 9d3b5bf..0000000
--- a/client/am/console/src/main/java/org/apache/syncope/client/console/rest/OIDCRelyingPartyRestClient.java
+++ /dev/null
@@ -1,53 +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.client.console.rest;
-
-import org.apache.syncope.common.lib.to.client.OIDCRelyingPartyTO;
-import org.apache.syncope.common.rest.api.service.oidc.OIDCRelyingPartyService;
-
-import java.util.List;
-
-/**
- * Console client for invoking Rest Client Application's services.
- */
-public class OIDCRelyingPartyRestClient extends BaseRestClient {
-
- private static final long serialVersionUID = -3161863874876938094L;
-
- public static void delete(final String key) {
- getService(OIDCRelyingPartyService.class).delete(key);
- }
-
- public static OIDCRelyingPartyTO read(final String key) {
- return getService(OIDCRelyingPartyService.class).read(key);
- }
-
- public static void update(final OIDCRelyingPartyTO applicationTO) {
- getService(OIDCRelyingPartyService.class).update(applicationTO);
- }
-
- public static void create(final OIDCRelyingPartyTO applicationTO) {
- getService(OIDCRelyingPartyService.class).create(applicationTO);
- }
-
- public static List<OIDCRelyingPartyTO> list() {
- return getService(OIDCRelyingPartyService.class).list();
- }
-
-}
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/rest/SAML2ServiceProviderRestClient.java b/client/am/console/src/main/java/org/apache/syncope/client/console/rest/SAML2ServiceProviderRestClient.java
deleted file mode 100644
index 485134e..0000000
--- a/client/am/console/src/main/java/org/apache/syncope/client/console/rest/SAML2ServiceProviderRestClient.java
+++ /dev/null
@@ -1,53 +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.client.console.rest;
-
-import org.apache.syncope.common.lib.to.client.SAML2ServiceProviderTO;
-import org.apache.syncope.common.rest.api.service.saml.SAML2ServiceProviderService;
-
-import java.util.List;
-
-/**
- * Console client for invoking Rest Client Application's services.
- */
-public class SAML2ServiceProviderRestClient extends BaseRestClient {
-
- private static final long serialVersionUID = -3161863874876938094L;
-
- public static void delete(final String key) {
- getService(SAML2ServiceProviderService.class).delete(key);
- }
-
- public static SAML2ServiceProviderTO read(final String key) {
- return getService(SAML2ServiceProviderService.class).read(key);
- }
-
- public static void update(final SAML2ServiceProviderTO applicationTO) {
- getService(SAML2ServiceProviderService.class).update(applicationTO);
- }
-
- public static void create(final SAML2ServiceProviderTO applicationTO) {
- getService(SAML2ServiceProviderService.class).create(applicationTO);
- }
-
- public static List<SAML2ServiceProviderTO> list() {
- return getService(SAML2ServiceProviderService.class).list();
- }
-
-}
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/authentication/module/LDAPAuthenticationModuleConf.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/authentication/module/LDAPAuthenticationModuleConf.java
index 5034c7d..dc7ca42 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/authentication/module/LDAPAuthenticationModuleConf.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/authentication/module/LDAPAuthenticationModuleConf.java
@@ -6,6 +6,7 @@
* 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,
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ClientAppService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ClientAppService.java
index e628704..0b6c688 100644
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ClientAppService.java
+++ b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ClientAppService.java
@@ -24,6 +24,9 @@ import io.swagger.v3.oas.annotations.headers.Header;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.security.SecurityRequirements;
+import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.syncope.common.lib.to.client.ClientAppTO;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -45,7 +48,12 @@ import java.util.List;
/**
* REST operations for applications.
*/
-public interface ClientAppService<T extends ClientAppTO> extends JAXRSService {
+@Tag(name = "ClientApps")
+@SecurityRequirements({
+ @SecurityRequirement(name = "BasicAuthentication"),
+ @SecurityRequirement(name = "Bearer") })
+@Path("clientApps")
+public interface ClientAppService extends JAXRSService {
/**
* Returns a list of all applications.
@@ -54,7 +62,7 @@ public interface ClientAppService<T extends ClientAppTO> extends JAXRSService {
*/
@GET
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- List<T> list();
+ List<ClientAppTO> list();
/**
* Returns application with matching key.
@@ -65,7 +73,7 @@ public interface ClientAppService<T extends ClientAppTO> extends JAXRSService {
@GET
@Path("{key}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- T read(@NotNull @PathParam("key") String key);
+ ClientAppTO read(@NotNull @PathParam("key") String key);
/**
* Creates a new application.
@@ -85,7 +93,7 @@ public interface ClientAppService<T extends ClientAppTO> extends JAXRSService {
@POST
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- Response create(@NotNull T applicationTO);
+ Response create(@NotNull ClientAppTO applicationTO);
/**
* Updates the application matching the provided key.
@@ -100,7 +108,7 @@ public interface ClientAppService<T extends ClientAppTO> extends JAXRSService {
@Path("{key}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- void update(@NotNull T applicationTO);
+ void update(@NotNull ClientAppTO applicationTO);
/**
* Deletes the application matching the provided key.
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/oidc/OIDCRelyingPartyService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/oidc/OIDCRelyingPartyService.java
deleted file mode 100644
index 9e540e5..0000000
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/oidc/OIDCRelyingPartyService.java
+++ /dev/null
@@ -1,36 +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.common.rest.api.service.oidc;
-
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.security.SecurityRequirements;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.apache.syncope.common.lib.to.client.OIDCRelyingPartyTO;
-import org.apache.syncope.common.rest.api.service.ClientAppService;
-
-import javax.ws.rs.Path;
-
-@Tag(name = "OpenIdConnectRelyingParties")
-@SecurityRequirements({
- @SecurityRequirement(name = "BasicAuthentication"),
- @SecurityRequirement(name = "Bearer")})
-@Path("openIdConnectRelyingParties")
-public interface OIDCRelyingPartyService extends ClientAppService<OIDCRelyingPartyTO> {
-}
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/saml/SAML2ServiceProviderService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/saml/SAML2ServiceProviderService.java
deleted file mode 100644
index c16183f..0000000
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/saml/SAML2ServiceProviderService.java
+++ /dev/null
@@ -1,34 +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.common.rest.api.service.saml;
-
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.security.SecurityRequirements;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.apache.syncope.common.lib.to.client.SAML2ServiceProviderTO;
-import org.apache.syncope.common.rest.api.service.ClientAppService;
-import javax.ws.rs.Path;
-
-@Tag(name = "SAML2ServiceProviders")
-@SecurityRequirements({
- @SecurityRequirement(name = "BasicAuthentication"),
- @SecurityRequirement(name = "Bearer") })
-@Path("saml2ServiceProviders")
-public interface SAML2ServiceProviderService extends ClientAppService<SAML2ServiceProviderTO> {
-}
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/saml/SAML2ServiceProviderLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/saml/SAML2ServiceProviderLogic.java
index a20c54f..668ccea 100644
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/saml/SAML2ServiceProviderLogic.java
+++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/saml/SAML2ServiceProviderLogic.java
@@ -72,7 +72,6 @@ public class SAML2ServiceProviderLogic extends AbstractClientAppLogic<SAML2Servi
SAML2ServiceProvider application = saml2ServiceProviderDAO.find(key);
if (application == null) {
LOG.error("Could not find application '" + key + '\'');
-
throw new NotFoundException(key);
}
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractClientAppServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractClientAppServiceImpl.java
deleted file mode 100644
index 2849af9..0000000
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/AbstractClientAppServiceImpl.java
+++ /dev/null
@@ -1,65 +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.rest.cxf.service;
-
-import org.apache.syncope.common.rest.api.service.ClientAppService;
-import org.apache.syncope.common.lib.to.client.ClientAppTO;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.core.logic.AbstractClientAppLogic;
-
-import javax.ws.rs.core.Response;
-
-import java.net.URI;
-import java.util.List;
-
-public abstract class AbstractClientAppServiceImpl<T extends ClientAppTO> extends AbstractServiceImpl
- implements ClientAppService<T> {
-
- protected abstract AbstractClientAppLogic<T> getLogic();
-
- @Override
- public List<T> list() {
- return getLogic().list();
- }
-
- @Override
- public T read(final String key) {
- return getLogic().read(key);
- }
-
- @Override
- public Response create(final T applicationTO) {
- T created = getLogic().create(applicationTO);
- URI location = uriInfo.getAbsolutePathBuilder().path(created.getKey()).build();
- return Response.created(location).
- header(RESTHeaders.RESOURCE_KEY, created.getKey()).
- build();
- }
-
- @Override
- public void update(final T applicationTO) {
- getLogic().update(applicationTO);
- }
-
- @Override
- public void delete(final String key) {
- getLogic().delete(key);
- }
-
-}
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ClientAppServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ClientAppServiceImpl.java
new file mode 100644
index 0000000..011bc1c
--- /dev/null
+++ b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ClientAppServiceImpl.java
@@ -0,0 +1,94 @@
+/*
+ * 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.rest.cxf.service;
+
+import org.apache.syncope.common.lib.to.client.ClientAppTO;
+import org.apache.syncope.common.lib.to.client.OIDCRelyingPartyTO;
+import org.apache.syncope.common.lib.to.client.SAML2ServiceProviderTO;
+import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.rest.api.service.ClientAppService;
+import org.apache.syncope.core.logic.AbstractClientAppLogic;
+import org.apache.syncope.core.logic.oidc.OIDCRelyingPartyLogic;
+import org.apache.syncope.core.logic.saml.SAML2ServiceProviderLogic;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.ws.rs.core.Response;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class ClientAppServiceImpl extends AbstractServiceImpl implements ClientAppService {
+
+ @Autowired
+ private SAML2ServiceProviderLogic saml2Logic;
+
+ @Autowired
+ private OIDCRelyingPartyLogic oidcLogic;
+
+ private AbstractClientAppLogic<ClientAppTO> getLogicFor(final ClientAppTO clientApp) {
+ if (clientApp instanceof SAML2ServiceProviderTO) {
+ return (AbstractClientAppLogic) this.saml2Logic;
+ }
+ if (clientApp instanceof OIDCRelyingPartyTO) {
+ return (AbstractClientAppLogic) this.oidcLogic;
+ }
+ throw new IllegalArgumentException("Unable to determine type for " + clientApp.getName());
+ }
+
+ @Override
+ public List<ClientAppTO> list() {
+ List<ClientAppTO> applications = new ArrayList<>(saml2Logic.list());
+ applications.addAll(oidcLogic.list());
+ return applications;
+ }
+
+ @Override
+ public ClientAppTO read(final String key) {
+ try {
+ return this.saml2Logic.read(key);
+ } catch (NotFoundException e) {
+ return this.oidcLogic.read(key);
+ }
+ }
+
+ @Override
+ public Response create(final ClientAppTO applicationTO) {
+ ClientAppTO created = getLogicFor(applicationTO).create(applicationTO);
+ URI location = uriInfo.getAbsolutePathBuilder().path(created.getKey()).build();
+ return Response.created(location).
+ header(RESTHeaders.RESOURCE_KEY, created.getKey()).
+ build();
+ }
+
+ @Override
+ public void update(final ClientAppTO applicationTO) {
+ getLogicFor(applicationTO).update(applicationTO);
+ }
+
+ @Override
+ public void delete(final String key) {
+ ClientAppTO app = read(key);
+ getLogicFor(app).delete(key);
+ }
+
+}
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/oidc/OIDCRelyingPartyServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/oidc/OIDCRelyingPartyServiceImpl.java
deleted file mode 100644
index aab10d6..0000000
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/oidc/OIDCRelyingPartyServiceImpl.java
+++ /dev/null
@@ -1,42 +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.rest.cxf.service.oidc;
-
-import org.apache.syncope.common.rest.api.service.oidc.OIDCRelyingPartyService;
-import org.apache.syncope.common.lib.to.client.OIDCRelyingPartyTO;
-import org.apache.syncope.core.logic.AbstractClientAppLogic;
-import org.apache.syncope.core.logic.oidc.OIDCRelyingPartyLogic;
-import org.apache.syncope.core.rest.cxf.service.AbstractClientAppServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class OIDCRelyingPartyServiceImpl
- extends AbstractClientAppServiceImpl<OIDCRelyingPartyTO>
- implements OIDCRelyingPartyService {
-
- @Autowired
- private OIDCRelyingPartyLogic logic;
-
- @Override
- protected AbstractClientAppLogic getLogic() {
- return this.logic;
- }
-}
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/saml/SAML2ServiceProviderServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/saml/SAML2ServiceProviderServiceImpl.java
deleted file mode 100644
index 4e045a8..0000000
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/saml/SAML2ServiceProviderServiceImpl.java
+++ /dev/null
@@ -1,42 +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.rest.cxf.service.saml;
-
-import org.apache.syncope.common.rest.api.service.saml.SAML2ServiceProviderService;
-import org.apache.syncope.common.lib.to.client.SAML2ServiceProviderTO;
-import org.apache.syncope.core.logic.AbstractClientAppLogic;
-import org.apache.syncope.core.logic.saml.SAML2ServiceProviderLogic;
-import org.apache.syncope.core.rest.cxf.service.AbstractClientAppServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-public class SAML2ServiceProviderServiceImpl
- extends AbstractClientAppServiceImpl<SAML2ServiceProviderTO>
- implements SAML2ServiceProviderService {
-
- @Autowired
- private SAML2ServiceProviderLogic logic;
-
- @Override
- protected AbstractClientAppLogic getLogic() {
- return this.logic;
- }
-}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
index b3864e7..d92f0a9 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
@@ -89,11 +89,12 @@ import org.apache.syncope.common.rest.api.service.AnyTypeClassService;
import org.apache.syncope.common.rest.api.service.AnyTypeService;
import org.apache.syncope.common.rest.api.service.ApplicationService;
import org.apache.syncope.common.rest.api.service.CamelRouteService;
+import org.apache.syncope.common.rest.api.service.ClientAppService;
import org.apache.syncope.common.rest.api.service.ConnectorService;
import org.apache.syncope.common.rest.api.service.DynRealmService;
import org.apache.syncope.common.rest.api.service.LoggerService;
import org.apache.syncope.common.rest.api.service.NotificationService;
-import org.apache.syncope.common.rest.api.service.oidc.OIDCRelyingPartyService;
+import org.apache.syncope.common.rest.api.service.SAML2SPService;
import org.apache.syncope.common.rest.api.service.PolicyService;
import org.apache.syncope.common.rest.api.service.ReportService;
import org.apache.syncope.common.rest.api.service.ResourceService;
@@ -109,7 +110,6 @@ import org.apache.syncope.common.rest.api.service.RemediationService;
import org.apache.syncope.common.rest.api.service.ReportTemplateService;
import org.apache.syncope.common.rest.api.service.RoleService;
import org.apache.syncope.common.rest.api.service.SAML2IdPService;
-import org.apache.syncope.common.rest.api.service.saml.SAML2ServiceProviderService;
import org.apache.syncope.common.rest.api.service.SCIMConfService;
import org.apache.syncope.common.rest.api.service.SchemaService;
import org.apache.syncope.common.rest.api.service.SecurityQuestionService;
@@ -280,7 +280,7 @@ public abstract class AbstractITCase {
protected static CamelRouteService camelRouteService;
- protected static org.apache.syncope.common.rest.api.service.SAML2SPService saml2SpService;
+ protected static SAML2SPService saml2SpService;
protected static SAML2IdPService saml2IdPService;
@@ -290,9 +290,7 @@ public abstract class AbstractITCase {
protected static SCIMConfService scimConfService;
- protected static OIDCRelyingPartyService oidcRelyingPartyService;
-
- protected static SAML2ServiceProviderService saml2ServiceProviderService;
+ protected static ClientAppService clientAppService;
@BeforeAll
public static void securitySetup() {
@@ -363,8 +361,7 @@ public abstract class AbstractITCase {
oidcClientService = adminClient.getService(OIDCClientService.class);
oidcProviderService = adminClient.getService(OIDCProviderService.class);
scimConfService = adminClient.getService(SCIMConfService.class);
- oidcRelyingPartyService = adminClient.getService(OIDCRelyingPartyService.class);
- saml2ServiceProviderService = adminClient.getService(SAML2ServiceProviderService.class);
+ clientAppService = adminClient.getService(ClientAppService.class);
}
@Autowired
@@ -568,25 +565,25 @@ public abstract class AbstractITCase {
}
protected OIDCRelyingPartyTO createOIDCRelyingParty(final OIDCRelyingPartyTO rpTO) {
- Response response = oidcRelyingPartyService.create(rpTO);
+ Response response = clientAppService.create(rpTO);
if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
if (ex != null) {
throw (RuntimeException) ex;
}
}
- return getObject(response.getLocation(), OIDCRelyingPartyService.class, OIDCRelyingPartyTO.class);
+ return getObject(response.getLocation(), ClientAppService.class, OIDCRelyingPartyTO.class);
}
protected SAML2ServiceProviderTO createSAML2SP(final SAML2ServiceProviderTO saml2spTO) {
- Response response = saml2ServiceProviderService.create(saml2spTO);
+ Response response = clientAppService.create(saml2spTO);
if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
if (ex != null) {
throw (RuntimeException) ex;
}
}
- return getObject(response.getLocation(), SAML2ServiceProviderService.class, SAML2ServiceProviderTO.class);
+ return getObject(response.getLocation(), ClientAppService.class, SAML2ServiceProviderTO.class);
}
protected ResourceTO createResource(final ResourceTO resourceTO) {
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OIDCRelyingPartyITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OIDCRelyingPartyITCase.java
index b7fa266..f97e608 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OIDCRelyingPartyITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OIDCRelyingPartyITCase.java
@@ -46,7 +46,7 @@ public class OIDCRelyingPartyITCase extends AbstractITCase {
OIDCRelyingPartyTO rpTO = buildRelyingParty();
rpTO = createOIDCRelyingParty(rpTO);
- OIDCRelyingPartyTO found = oidcRelyingPartyService.read(rpTO.getKey());
+ OIDCRelyingPartyTO found = (OIDCRelyingPartyTO) clientAppService.read(rpTO.getKey());
assertNotNull(found);
assertFalse(StringUtils.isBlank(found.getClientId()));
assertTrue(StringUtils.isBlank(found.getClientSecret()));
@@ -68,8 +68,8 @@ public class OIDCRelyingPartyITCase extends AbstractITCase {
rpTO.setClientId("newClientId");
rpTO.setAccessPolicy(accessPolicyTO.getKey());
- oidcRelyingPartyService.update(rpTO);
- OIDCRelyingPartyTO updated = oidcRelyingPartyService.read(rpTO.getKey());
+ clientAppService.update(rpTO);
+ OIDCRelyingPartyTO updated = (OIDCRelyingPartyTO) clientAppService.read(rpTO.getKey());
assertNotNull(updated);
assertEquals("newClientId", updated.getClientId());
@@ -81,10 +81,10 @@ public class OIDCRelyingPartyITCase extends AbstractITCase {
OIDCRelyingPartyTO rpTO = buildRelyingParty();
rpTO = createOIDCRelyingParty(rpTO);
- oidcRelyingPartyService.delete(rpTO.getKey());
+ clientAppService.delete(rpTO.getKey());
try {
- oidcRelyingPartyService.read(rpTO.getKey());
+ clientAppService.read(rpTO.getKey());
fail("This should not happen");
} catch (SyncopeClientException e) {
assertNotNull(e);
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ServiceProviderITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ServiceProviderITCase.java
index 32cd25a..b531285 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ServiceProviderITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2ServiceProviderITCase.java
@@ -44,7 +44,7 @@ public class SAML2ServiceProviderITCase extends AbstractITCase {
SAML2ServiceProviderTO samlSpTO = buildSAML2SP();
samlSpTO = createSAML2SP(samlSpTO);
- SAML2ServiceProviderTO found = saml2ServiceProviderService.read(samlSpTO.getKey());
+ SAML2ServiceProviderTO found = (SAML2ServiceProviderTO) clientAppService.read(samlSpTO.getKey());
assertNotNull(found);
assertFalse(StringUtils.isBlank(found.getEntityId()));
assertFalse(StringUtils.isBlank(found.getMetadataLocation()));
@@ -66,8 +66,8 @@ public class SAML2ServiceProviderITCase extends AbstractITCase {
samlSpTO.setEntityId("newEntityId");
samlSpTO.setAccessPolicy(accessPolicyTO.getKey());
- saml2ServiceProviderService.update(samlSpTO);
- SAML2ServiceProviderTO updated = saml2ServiceProviderService.read(samlSpTO.getKey());
+ clientAppService.update(samlSpTO);
+ SAML2ServiceProviderTO updated = (SAML2ServiceProviderTO) clientAppService.read(samlSpTO.getKey());
assertNotNull(updated);
assertEquals("newEntityId", updated.getEntityId());
@@ -79,10 +79,10 @@ public class SAML2ServiceProviderITCase extends AbstractITCase {
SAML2ServiceProviderTO samlSpTO = buildSAML2SP();
samlSpTO = createSAML2SP(samlSpTO);
- saml2ServiceProviderService.delete(samlSpTO.getKey());
+ clientAppService.delete(samlSpTO.getKey());
try {
- saml2ServiceProviderService.read(samlSpTO.getKey());
+ clientAppService.read(samlSpTO.getKey());
fail("This should not happen");
} catch (SyncopeClientException e) {
assertNotNull(e);