You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2021/04/08 08:30:45 UTC
[syncope] branch master updated: [SYNCOPE-1545] WA > SAML 2.0 (#259)
This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new 6b42a8f [SYNCOPE-1545] WA > SAML 2.0 (#259)
6b42a8f is described below
commit 6b42a8f609930f10c27058604ff9fbdc1e6a8bcc
Author: Francesco Chicchiriccò <il...@users.noreply.github.com>
AuthorDate: Thu Apr 8 10:29:52 2021 +0200
[SYNCOPE-1545] WA > SAML 2.0 (#259)
---
.../console/clientapps/CASSPDirectoryPanel.java | 8 +-
.../console/clientapps/OIDCRPDirectoryPanel.java | 14 +-
.../console/clientapps/SAML2SPDirectoryPanel.java | 8 +-
.../client/console/commons/AMConstants.java | 3 +
.../apache/syncope/client/console/pages/WA.java | 49 +++++-
.../console/panels/AuthModuleDirectoryPanel.java | 4 +-
.../syncope/client/console/panels/SAML2.java | 72 +++++++++
.../panels/SAML2IdPEntityDirectoryPanel.java | 180 +++++++++++++++++++++
...Panel.java => SAML2SPEntityDirectoryPanel.java} | 150 ++++++++++-------
.../console/rest/SAML2IdPEntityRestClient.java | 34 ++--
.../console/rest/SAML2SPEntityRestClient.java | 45 ++++++
.../console/wizards/SAML2EntityWizardBuilder.java | 65 ++++++++
.../wizards/SAML2IdPEntityWizardBuilder.java | 106 ++++++++++++
.../wizards/SAML2SPEntityWizardBuilder.java | 104 ++++++++++++
.../syncope/client/console/panels/SAML2.html | 6 +-
.../panels/SAML2IdPEntityDirectoryPanel.properties | 20 +++
.../SAML2IdPEntityDirectoryPanel_fr_CA.properties | 20 +++
.../SAML2IdPEntityDirectoryPanel_it.properties | 20 +++
.../SAML2IdPEntityDirectoryPanel_ja.properties | 20 +++
.../SAML2IdPEntityDirectoryPanel_pt_BR.properties | 20 +++
.../SAML2IdPEntityDirectoryPanel_ru.properties | 20 +++
.../panels/SAML2SPEntityDirectoryPanel.properties | 20 +++
.../SAML2SPEntityDirectoryPanel_fr_CA.properties | 20 +++
.../SAML2SPEntityDirectoryPanel_it.properties | 20 +++
.../SAML2SPEntityDirectoryPanel_ja.properties | 20 +++
.../SAML2SPEntityDirectoryPanel_pt_BR.properties | 20 +++
.../SAML2SPEntityDirectoryPanel_ru.properties | 20 +++
.../wizards/SAML2EntityWizardBuilder$Metadata.html | 6 +-
.../wizards/SAML2EntityWizardBuilder$Pem.html | 6 +-
.../SAML2SPEntityWizardBuilder$Profile.html | 6 +-
.../notifications/MailTemplateDirectoryPanel.java | 3 +-
.../console/panels/DomainDirectoryPanel.java | 6 +-
.../reports/ReportTemplateDirectoryPanel.java | 3 +-
.../markup/html/form/BinaryFieldDownload.java | 2 +-
.../wicket/markup/html/form/BinaryFieldPanel.java | 8 +-
.../wicket/markup/html/form/TextEditorPanel.java | 67 ++++++++
.../wicket/markup/html/form/TextEditorPanel.html | 51 ++++++
.../lib/to/{CASSPTO.java => CASSPClientAppTO.java} | 4 +-
.../apache/syncope/common/lib/to/ClientAppTO.java | 3 +-
.../apache/syncope/common/lib/to/OIDCJWKSTO.java | 38 ++---
.../to/{OIDCRPTO.java => OIDCRPClientAppTO.java} | 4 +-
.../{SAML2SPKeystoreTO.java => SAML2EntityTO.java} | 93 +++++------
...ML2IdPMetadataTO.java => SAML2IdPEntityTO.java} | 92 ++++-------
.../to/{SAML2SPTO.java => SAML2SPClientAppTO.java} | 4 +-
...SAML2SPMetadataTO.java => SAML2SPEntityTO.java} | 83 ++++------
.../syncope/common/lib/types/AMEntitlement.java | 18 +--
.../common/lib/wa/GoogleMfaAuthAccount.java | 18 ---
.../syncope/common/lib/wa/GoogleMfaAuthToken.java | 18 ---
.../common/lib/wa/ImpersonationAccount.java | 62 +++----
.../apache/syncope/common/lib/wa/U2FDevice.java | 20 ---
.../syncope/common/lib/wa/WebAuthnAccount.java | 20 +--
.../common/rest/api/beans/U2FDeviceQuery.java | 20 ---
.../rest/api/service/AuthProfileService.java | 2 +-
.../common/rest/api/service/OIDCJWKSService.java | 2 +-
...dataService.java => SAML2IdPEntityService.java} | 52 +++---
.../rest/api/service/SAML2IdPMetadataService.java | 98 -----------
...ofileService.java => SAML2SPEntityService.java} | 60 ++++---
.../rest/api/service/SAML2SPKeystoreService.java | 94 -----------
.../service/wa/GoogleMfaAuthAccountService.java | 41 ++---
.../api/service/wa/GoogleMfaAuthTokenService.java | 24 ++-
.../rest/api/service/wa/ImpersonationService.java | 47 ++----
.../api/service/wa/U2FRegistrationService.java | 36 +----
.../service/wa/WebAuthnRegistrationService.java | 35 ++--
.../apache/syncope/core/logic/ClientAppLogic.java | 24 +--
.../apache/syncope/core/logic/OIDCJWKSLogic.java | 2 +-
...MetadataLogic.java => SAML2IdPEntityLogic.java} | 72 ++++-----
.../syncope/core/logic/SAML2IdPMetadataLogic.java | 101 ------------
...PKeystoreLogic.java => SAML2SPEntityLogic.java} | 83 +++++-----
.../core/logic/wa/GoogleMfaAuthAccountLogic.java | 72 ++-------
.../core/logic/wa/GoogleMfaAuthTokenLogic.java | 27 +---
.../syncope/core/logic/wa/ImpersonationLogic.java | 68 +++-----
.../core/logic/wa/U2FRegistrationLogic.java | 54 +------
.../syncope/core/logic/wa/WAClientAppLogic.java | 18 +--
.../core/logic/wa/WebAuthnRegistrationLogic.java | 22 +--
.../core/rest/cxf/service/OIDCJWKSServiceImpl.java | 4 +-
...iceImpl.java => SAML2IdPEntityServiceImpl.java} | 30 ++--
.../cxf/service/SAML2IdPMetadataServiceImpl.java | 54 -------
...viceImpl.java => SAML2SPEntityServiceImpl.java} | 33 ++--
.../wa/GoogleMfaAuthAccountServiceImpl.java | 29 +---
.../service/wa/GoogleMfaAuthTokenServiceImpl.java | 17 +-
.../cxf/service/wa/ImpersonationServiceImpl.java | 33 +---
.../cxf/service/wa/U2FRegistrationServiceImpl.java | 27 +---
.../wa/WebAuthnRegistrationServiceImpl.java | 27 +---
.../core/persistence/api/dao/auth/CASSPDAO.java | 16 +-
.../core/persistence/api/dao/auth/OIDCRPDAO.java | 18 +--
...L2SPKeystoreDAO.java => SAML2IdPEntityDAO.java} | 12 +-
.../core/persistence/api/dao/auth/SAML2SPDAO.java | 18 +--
...L2IdPMetadataDAO.java => SAML2SPEntityDAO.java} | 12 +-
.../api/dao/auth/SAML2SPMetadataDAO.java | 32 ----
.../auth/{CASSP.java => CASSPClientApp.java} | 2 +-
.../auth/{OIDCRP.java => OIDCRPClientApp.java} | 2 +-
.../{SAML2SPMetadata.java => SAML2IdPEntity.java} | 24 ++-
.../api/entity/auth/SAML2IdPMetadata.java | 49 ------
.../auth/{SAML2SP.java => SAML2SPClientApp.java} | 2 +-
.../{SAML2SPKeystore.java => SAML2SPEntity.java} | 12 +-
.../core/persistence/jpa/dao/auth/JPACASSPDAO.java | 36 ++---
.../persistence/jpa/dao/auth/JPAOIDCRPDAO.java | 40 ++---
...PMetadataDAO.java => JPASAML2IdPEntityDAO.java} | 38 ++---
.../persistence/jpa/dao/auth/JPASAML2SPDAO.java | 40 ++---
...SPMetadataDAO.java => JPASAML2SPEntityDAO.java} | 43 +++--
.../jpa/dao/auth/JPASAML2SPKeystoreDAO.java | 62 -------
.../persistence/jpa/entity/JPAEntityFactory.java | 44 +++--
.../auth/{JPACASSP.java => JPACASSPClientApp.java} | 8 +-
.../jpa/entity/auth/JPAClientAppUtils.java | 12 +-
.../jpa/entity/auth/JPAClientAppUtilsFactory.java | 24 +--
.../{JPAOIDCRP.java => JPAOIDCRPClientApp.java} | 14 +-
...AML2IdPMetadata.java => JPASAML2IdPEntity.java} | 66 ++++----
.../{JPASAML2SP.java => JPASAML2SPClientApp.java} | 22 +--
...ASAML2SPMetadata.java => JPASAML2SPEntity.java} | 35 ++--
.../jpa/entity/auth/JPASAML2SPKeystore.java | 61 -------
.../persistence/jpa/inner/AuthProfileTest.java | 8 +-
.../core/persistence/jpa/inner/CASSPTest.java | 5 +-
.../core/persistence/jpa/inner/OIDCRPTest.java | 4 +-
...dPMetadataTest.java => SAML2IdPEntityTest.java} | 60 +++----
...2SPKeystoreTest.java => SAML2SPEntityTest.java} | 130 +++++++--------
.../persistence/jpa/inner/SAML2SPMetadataTest.java | 83 ----------
.../core/persistence/jpa/inner/SAML2SPTest.java | 4 +-
.../core/persistence/jpa/outer/PolicyTest.java | 7 +-
.../src/test/resources/domains/MasterContent.xml | 2 +-
...reBinder.java => SAML2IdPEntityDataBinder.java} | 13 +-
.../api/data/SAML2IdPMetadataDataBinder.java | 32 ----
...ataBinder.java => SAML2SPEntityDataBinder.java} | 13 +-
.../java/data/ClientAppDataBinderImpl.java | 78 ++++-----
.../java/data/SAML2IdPEntityDataBinderImpl.java | 84 ++++++++++
.../java/data/SAML2IdPMetadataDataBinderImpl.java | 80 ---------
.../java/data/SAML2SPEntityDataBinderImpl.java | 65 ++++++++
.../java/data/SAML2SPKeystoreBinderImpl.java | 71 --------
.../java/data/SAML2SPMetadataBinderImpl.java | 72 ---------
.../console/panels/CamelRoutesDirectoryPanel.java | 4 +-
.../console/panels/BpmnProcessDirectoryPanel.java | 3 +-
.../client/console/panels/SAML2SPPanel.html | 2 +-
.../persistence/jpa/entity/JPASAML2SP4UIIdP.java | 2 +-
.../jpa/entity/JPASAML2SP4UIIdPItem.java | 4 +-
.../jpa/entity/JPASAML2SP4UIUserTemplate.java | 2 +-
.../org/apache/syncope/fit/AbstractITCase.java | 36 ++---
.../apache/syncope/fit/core/ClientAppITCase.java | 36 ++---
.../apache/syncope/fit/core/OIDCJWKSITCase.java | 2 +-
.../syncope/fit/core/SAML2IdPEntityITCase.java | 100 ++++++++++++
.../syncope/fit/core/SAML2IdPMetadataITCase.java | 120 --------------
...IDCJWKSITCase.java => SAML2SPEntityITCase.java} | 62 ++++---
.../syncope/fit/core/SAML2SPKeystoreITCase.java | 114 -------------
.../syncope/fit/core/SAML2SPMetadataITCase.java | 110 -------------
.../fit/core/wa/GoogleMfaAuthAccountITCase.java | 14 +-
.../fit/core/wa/GoogleMfaAuthTokenITCase.java | 18 +--
.../syncope/fit/core/wa/ImpersonationITCase.java | 40 ++---
.../syncope/fit/core/wa/U2FRegistrationITCase.java | 33 +---
.../syncope/fit/core/wa/WAClientAppITCase.java | 10 +-
.../syncope/fit/core/wa/WebAuthnAccountITCase.java | 10 +-
.../org/apache/syncope/fit/AbstractITCase.java | 12 +-
.../org/apache/syncope/fit/sra/CASSRAITCase.java | 8 +-
.../org/apache/syncope/fit/sra/OIDCSRAITCase.java | 8 +-
.../org/apache/syncope/fit/sra/SAML2SRAITCase.java | 8 +-
.../org/apache/syncope/fit/ui/OIDC4UIITCase.java | 8 +-
.../apache/syncope/fit/ui/SAML2SP4UIITCase.java | 8 +-
pom.xml | 8 +-
src/site/site.xml | 7 +-
src/site/xdoc/integration.xml | 9 +-
.../wa/starter/config/SyncopeWAConfiguration.java | 40 +++--
...SyncopeWAGoogleMfaAuthCredentialRepository.java | 51 ++----
.../SyncopeWAGoogleMfaAuthTokenRepository.java | 8 +-
...SPTOMapper.java => CASSPClientAppTOMapper.java} | 8 +-
...PTOMapper.java => OIDCRPClientAppTOMapper.java} | 10 +-
...TOMapper.java => SAML2SPClientAppTOMapper.java} | 8 +-
.../oidc/SyncopeWAOIDCJWKSGeneratorService.java | 2 +-
.../pac4j/saml/SyncopeWASAML2ClientCustomizer.java | 2 +-
.../SyncopeWASAML2ClientKeystoreGenerator.java | 58 +++----
.../SyncopeWASAML2ClientMetadataGenerator.java | 56 ++++---
.../pac4j/saml/SyncopeWASAML2MetadataResolver.java | 12 +-
.../metadata/RestfulSamlIdPMetadataGenerator.java | 48 +++---
.../metadata/RestfulSamlIdPMetadataLocator.java | 48 ++++--
.../SyncopeWASurrogateAuthenticationService.java | 32 ++--
.../starter/u2f/SyncopeWAU2FDeviceRepository.java | 7 +-
.../SyncopeWAWebAuthnCredentialRepository.java | 4 +-
.../wa/starter/SyncopeCoreTestingServer.java | 116 +++++--------
.../wa/starter/SyncopeWAServiceRegistryTest.java | 16 +-
.../saml/SyncopeWASAML2ClientCustomizerTest.java | 33 ++--
.../SyncopeWASAML2ClientKeystoreGeneratorTest.java | 51 ++----
.../SyncopeWASAML2ClientMetadataGeneratorTest.java | 38 ++---
.../saml/SyncopeWASAML2MetadataResolverTest.java | 26 ++-
...yncopeWASurrogateAuthenticationServiceTest.java | 43 ++---
180 files changed, 2725 insertions(+), 3376 deletions(-)
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/CASSPDirectoryPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/CASSPDirectoryPanel.java
index bae8353..dc673c8 100644
--- a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/CASSPDirectoryPanel.java
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/CASSPDirectoryPanel.java
@@ -19,7 +19,7 @@
package org.apache.syncope.client.console.clientapps;
import java.util.List;
-import org.apache.syncope.common.lib.to.CASSPTO;
+import org.apache.syncope.common.lib.to.CASSPClientAppTO;
import org.apache.syncope.common.lib.types.AMEntitlement;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.wicket.PageReference;
@@ -28,14 +28,14 @@ import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.model.StringResourceModel;
-public class CASSPDirectoryPanel extends ClientAppDirectoryPanel<CASSPTO> {
+public class CASSPDirectoryPanel extends ClientAppDirectoryPanel<CASSPClientAppTO> {
private static final long serialVersionUID = 1L;
public CASSPDirectoryPanel(final String id, final PageReference pageRef) {
super(id, ClientAppType.CASSP, pageRef);
- CASSPTO defaultItem = new CASSPTO();
+ CASSPClientAppTO defaultItem = new CASSPClientAppTO();
this.addNewItemPanelBuilder(
new ClientAppModalPanelBuilder<>(ClientAppType.CASSP, defaultItem, modal, pageRef), true);
@@ -45,7 +45,7 @@ public class CASSPDirectoryPanel extends ClientAppDirectoryPanel<CASSPTO> {
}
@Override
- protected void addCustomColumnFields(final List<IColumn<CASSPTO, String>> columns) {
+ protected void addCustomColumnFields(final List<IColumn<CASSPClientAppTO, String>> columns) {
columns.add(new PropertyColumn<>(new StringResourceModel("serviceId", this), "serviceId", "serviceId"));
}
}
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/OIDCRPDirectoryPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/OIDCRPDirectoryPanel.java
index 708e3aa..3169d59 100644
--- a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/OIDCRPDirectoryPanel.java
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/OIDCRPDirectoryPanel.java
@@ -20,7 +20,7 @@ package org.apache.syncope.client.console.clientapps;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.to.OIDCRPTO;
+import org.apache.syncope.common.lib.to.OIDCRPClientAppTO;
import org.apache.syncope.common.lib.types.AMEntitlement;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.wicket.AttributeModifier;
@@ -35,14 +35,14 @@ import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.StringResourceModel;
-public class OIDCRPDirectoryPanel extends ClientAppDirectoryPanel<OIDCRPTO> {
+public class OIDCRPDirectoryPanel extends ClientAppDirectoryPanel<OIDCRPClientAppTO> {
private static final long serialVersionUID = 1L;
public OIDCRPDirectoryPanel(final String id, final PageReference pageRef) {
super(id, ClientAppType.OIDCRP, pageRef);
- OIDCRPTO defaultItem = new OIDCRPTO();
+ OIDCRPClientAppTO defaultItem = new OIDCRPClientAppTO();
this.addNewItemPanelBuilder(
new ClientAppModalPanelBuilder<>(ClientAppType.OIDCRP, defaultItem, modal, pageRef), true);
@@ -52,17 +52,17 @@ public class OIDCRPDirectoryPanel extends ClientAppDirectoryPanel<OIDCRPTO> {
}
@Override
- protected void addCustomColumnFields(final List<IColumn<OIDCRPTO, String>> columns) {
+ protected void addCustomColumnFields(final List<IColumn<OIDCRPClientAppTO, String>> columns) {
columns.add(new PropertyColumn<>(new StringResourceModel("clientId", this), "clientId", "clientId"));
columns.add(new PropertyColumn<>(
new StringResourceModel("redirectUris", this), "redirectUris", "redirectUris"));
- columns.add(new AbstractColumn<OIDCRPTO, String>(new StringResourceModel("logout")) {
+ columns.add(new AbstractColumn<OIDCRPClientAppTO, String>(new StringResourceModel("logout")) {
@Override
public void populateItem(
- final Item<ICellPopulator<OIDCRPTO>> item,
+ final Item<ICellPopulator<OIDCRPClientAppTO>> item,
final String componentId,
- final IModel<OIDCRPTO> rowModel) {
+ final IModel<OIDCRPClientAppTO> rowModel) {
item.add(new Label(componentId, StringUtils.EMPTY));
if (StringUtils.isNotBlank(rowModel.getObject().getLogoutUri())) {
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/SAML2SPDirectoryPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/SAML2SPDirectoryPanel.java
index 19b8a90..b14106d 100644
--- a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/SAML2SPDirectoryPanel.java
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/SAML2SPDirectoryPanel.java
@@ -20,7 +20,7 @@ package org.apache.syncope.client.console.clientapps;
import java.util.List;
import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.BooleanPropertyColumn;
-import org.apache.syncope.common.lib.to.SAML2SPTO;
+import org.apache.syncope.common.lib.to.SAML2SPClientAppTO;
import org.apache.syncope.common.lib.types.AMEntitlement;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.wicket.PageReference;
@@ -29,14 +29,14 @@ import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.model.StringResourceModel;
-public class SAML2SPDirectoryPanel extends ClientAppDirectoryPanel<SAML2SPTO> {
+public class SAML2SPDirectoryPanel extends ClientAppDirectoryPanel<SAML2SPClientAppTO> {
private static final long serialVersionUID = 1L;
public SAML2SPDirectoryPanel(final String id, final PageReference pageRef) {
super(id, ClientAppType.SAML2SP, pageRef);
- SAML2SPTO defaultItem = new SAML2SPTO();
+ SAML2SPClientAppTO defaultItem = new SAML2SPClientAppTO();
this.addNewItemPanelBuilder(
new ClientAppModalPanelBuilder<>(ClientAppType.SAML2SP, defaultItem, modal, pageRef), true);
@@ -46,7 +46,7 @@ public class SAML2SPDirectoryPanel extends ClientAppDirectoryPanel<SAML2SPTO> {
}
@Override
- protected void addCustomColumnFields(final List<IColumn<SAML2SPTO, String>> columns) {
+ protected void addCustomColumnFields(final List<IColumn<SAML2SPClientAppTO, String>> columns) {
columns.add(new PropertyColumn<>(new StringResourceModel("entityId", this), "entityId", "entityId"));
columns.add(new BooleanPropertyColumn<>(
new StringResourceModel("signAssertions", this), "signAssertions", "signAssertions"));
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/commons/AMConstants.java b/client/am/console/src/main/java/org/apache/syncope/client/console/commons/AMConstants.java
index 9410d4d..be7301e 100644
--- a/client/am/console/src/main/java/org/apache/syncope/client/console/commons/AMConstants.java
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/commons/AMConstants.java
@@ -33,6 +33,9 @@ public final class AMConstants {
public static final String PREF_ACCESS_POLICY_CONF_REQUIRED_ATTRS_PAGINATOR_ROWS =
"accesspolicy.conf.requiredattrs.paginator.rows";
+ public static final String PREF_SAML2_IDP_ENTITY_PAGINATOR_ROWS = "saml2idpentity.properties.paginator.rows";
+ public static final String PREF_SAML2_SP_ENTITY_PAGINATOR_ROWS = "saml2spentity.properties.paginator.rows";
+
private AMConstants() {
// private constructor for static utility class
}
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/pages/WA.java b/client/am/console/src/main/java/org/apache/syncope/client/console/pages/WA.java
index 1b291e9..b8fb6d9 100644
--- a/client/am/console/src/main/java/org/apache/syncope/client/console/pages/WA.java
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/pages/WA.java
@@ -18,14 +18,23 @@
*/
package org.apache.syncope.client.console.pages;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.client.console.SyncopeWebApplication;
import org.apache.syncope.client.console.annotations.AMPage;
import org.apache.syncope.client.console.panels.AuthModuleDirectoryPanel;
import org.apache.syncope.client.console.clientapps.ClientApps;
+import org.apache.syncope.client.console.panels.SAML2;
import org.apache.syncope.client.console.panels.WAConfigDirectoryPanel;
import org.apache.syncope.client.console.rest.WAConfigRestClient;
import org.apache.syncope.client.ui.commons.Constants;
@@ -51,9 +60,13 @@ public class WA extends BasePage {
private static final long serialVersionUID = 9200112197134882164L;
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
@SpringBean
private ServiceOps serviceOps;
+ private String waPrefix = "";
+
public WA(final PageParameters parameters) {
super(parameters);
@@ -85,6 +98,36 @@ public class WA extends BasePage {
content.add(tabbedPanel);
body.add(content);
+
+ if (!serviceOps.list(NetworkService.Type.WA).isEmpty()) {
+ String actuatorEndpoint = serviceOps.list(NetworkService.Type.WA).get(0).getAddress() + "/actuator/env";
+ try {
+ Response response = WebClient.create(
+ actuatorEndpoint,
+ SyncopeWebApplication.get().getAnonymousUser(),
+ SyncopeWebApplication.get().getAnonymousKey(),
+ null).
+ accept(MediaType.APPLICATION_JSON_TYPE).get();
+ if (response.getStatus() == Response.Status.OK.getStatusCode()) {
+ JsonNode env = MAPPER.readTree((InputStream) response.getEntity());
+ if (env.has("propertySources")) {
+ for (JsonNode propertySource : env.get("propertySources")) {
+ if (propertySource.has("properties")) {
+ JsonNode properties = propertySource.get("properties");
+ if (properties.has("cas.server.prefix")) {
+ JsonNode prefix = properties.get("cas.server.prefix");
+ if (prefix.has("value")) {
+ waPrefix = StringUtils.removeEnd(prefix.get("value").asText(), "/");
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ LOG.error("While contacting {}", actuatorEndpoint, e);
+ }
+ }
}
private List<ITab> buildTabList() {
@@ -114,17 +157,17 @@ public class WA extends BasePage {
});
}
- tabs.add(new AbstractTab(Model.of("SAML 2.0 IdP")) {
+ tabs.add(new AbstractTab(Model.of("SAML 2.0")) {
private static final long serialVersionUID = 5211692813425391144L;
@Override
public Panel getPanel(final String panelId) {
- return new AjaxTextFieldPanel(panelId, panelId, Model.of(""));
+ return new SAML2(panelId, waPrefix, getPageReference());
}
});
- tabs.add(new AbstractTab(Model.of("OIDC 1.0 Provider")) {
+ tabs.add(new AbstractTab(Model.of("OIDC 1.0")) {
private static final long serialVersionUID = 5211692813425391144L;
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AuthModuleDirectoryPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AuthModuleDirectoryPanel.java
index dfdd43c..0749077 100644
--- a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AuthModuleDirectoryPanel.java
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AuthModuleDirectoryPanel.java
@@ -27,7 +27,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.commons.AMConstants;
import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
-import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.panels.AuthModuleDirectoryPanel.AuthModuleProvider;
import org.apache.syncope.client.console.rest.AuthModuleRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
@@ -35,6 +34,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wizards.AuthModuleWizardBuilder;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.DirectoryDataProvider;
+import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
import org.apache.syncope.client.ui.commons.wizards.AjaxWizard;
import org.apache.syncope.common.lib.to.AuthModuleTO;
import org.apache.syncope.common.lib.types.AMEntitlement;
@@ -143,7 +143,7 @@ public class AuthModuleDirectoryPanel
LOG.error("While deleting {}", model.getObject().getKey(), e);
SyncopeConsoleSession.get().onException(e);
}
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ ((BaseWebPage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.DELETE, AMEntitlement.AUTH_MODULE_DELETE, true);
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2.java b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2.java
new file mode 100644
index 0000000..1082d5e
--- /dev/null
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2.java
@@ -0,0 +1,72 @@
+/*
+ * 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.panels;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.types.AMEntitlement;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
+import org.apache.wicket.extensions.markup.html.tabs.ITab;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.Model;
+
+public class SAML2 extends Panel {
+
+ private static final long serialVersionUID = 1L;
+
+ public SAML2(final String id, final String waPrefix, final PageReference pageRef) {
+ super(id);
+
+ add(new AjaxBootstrapTabbedPanel<>("saml2", buildTabList(waPrefix, pageRef)));
+ }
+
+ private List<ITab> buildTabList(final String waPrefix, final PageReference pageRef) {
+ List<ITab> tabs = new ArrayList<>();
+
+ if (SyncopeConsoleSession.get().owns(AMEntitlement.SAML2_IDP_ENTITY_LIST, SyncopeConstants.ROOT_REALM)) {
+ tabs.add(new AbstractTab(Model.of("Identity Provider")) {
+
+ private static final long serialVersionUID = 5211692813425391144L;
+
+ @Override
+ public Panel getPanel(final String panelId) {
+ return new SAML2IdPEntityDirectoryPanel(panelId, waPrefix, pageRef);
+ }
+ });
+ }
+
+ if (SyncopeConsoleSession.get().owns(AMEntitlement.SAML2_SP_ENTITY_LIST, SyncopeConstants.ROOT_REALM)) {
+ tabs.add(new AbstractTab(Model.of("Service Provider")) {
+
+ private static final long serialVersionUID = 5211692813425391144L;
+
+ @Override
+ public Panel getPanel(final String panelId) {
+ return new SAML2SPEntityDirectoryPanel(panelId, waPrefix, pageRef);
+ }
+ });
+ }
+
+ return tabs;
+ }
+}
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel.java
new file mode 100644
index 0000000..a870a68
--- /dev/null
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel.java
@@ -0,0 +1,180 @@
+/*
+ * 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.panels;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.syncope.client.console.commons.AMConstants;
+import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
+import org.apache.syncope.client.console.panels.SAML2IdPEntityDirectoryPanel.SAML2IdPEntityProvider;
+import org.apache.syncope.client.console.rest.SAML2IdPEntityRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
+import org.apache.syncope.client.console.wizards.SAML2IdPEntityWizardBuilder;
+import org.apache.syncope.client.ui.commons.Constants;
+import org.apache.syncope.client.ui.commons.DirectoryDataProvider;
+import org.apache.syncope.client.ui.commons.wizards.AjaxWizard;
+import org.apache.syncope.common.lib.to.SAML2IdPEntityTO;
+import org.apache.syncope.common.lib.types.AMEntitlement;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
+import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.html.link.ExternalLink;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.StringResourceModel;
+
+public class SAML2IdPEntityDirectoryPanel extends DirectoryPanel<
+ SAML2IdPEntityTO, SAML2IdPEntityTO, SAML2IdPEntityProvider, SAML2IdPEntityRestClient> {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String metadataURL;
+
+ public SAML2IdPEntityDirectoryPanel(final String id, final String waPrefix, final PageReference pageRef) {
+ super(id, pageRef);
+ this.metadataURL = waPrefix + "/idp/metadata";
+
+ disableCheckBoxes();
+
+ modal.size(Modal.Size.Large);
+ modal.addSubmitButton();
+
+ modal.setWindowClosedCallback(target -> {
+ updateResultTable(target);
+ modal.show(false);
+ });
+
+ addNewItemPanelBuilder(new SAML2IdPEntityWizardBuilder(new SAML2IdPEntityTO(), pageRef), false);
+
+ initResultTable();
+ }
+
+ @Override
+ protected List<IColumn<SAML2IdPEntityTO, String>> getColumns() {
+ List<IColumn<SAML2IdPEntityTO, String>> columns = new ArrayList<>();
+
+ columns.add(new PropertyColumn<>(
+ new StringResourceModel(Constants.KEY_FIELD_NAME, this),
+ Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME));
+ columns.add(new AbstractColumn<SAML2IdPEntityTO, String>(Model.of("URL")) {
+
+ @Override
+ public void populateItem(
+ final Item<ICellPopulator<SAML2IdPEntityTO>> cellItem,
+ final String componentId,
+ final IModel<SAML2IdPEntityTO> rowModel) {
+
+ cellItem.add(new ExternalLink(
+ componentId,
+ Model.of(metadataURL),
+ Model.of(metadataURL)) {
+
+ @Override
+ protected void onComponentTag(final ComponentTag tag) {
+ super.onComponentTag(tag);
+
+ tag.setName("a");
+ if (metadataURL.startsWith("http")) {
+ tag.put("href", getDefaultModelObject().toString());
+ tag.put("target", "_blank");
+ }
+ }
+ });
+ }
+ });
+
+ return columns;
+ }
+
+ @Override
+ protected ActionsPanel<SAML2IdPEntityTO> getActions(final IModel<SAML2IdPEntityTO> model) {
+ ActionsPanel<SAML2IdPEntityTO> panel = super.getActions(model);
+
+ panel.add(new ActionLink<SAML2IdPEntityTO>() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target, final SAML2IdPEntityTO ignore) {
+ send(SAML2IdPEntityDirectoryPanel.this, Broadcast.EXACT,
+ new AjaxWizard.EditItemActionEvent<>(
+ SAML2IdPEntityRestClient.get(model.getObject().getKey()), target));
+ }
+ }, ActionLink.ActionType.EDIT, AMEntitlement.SAML2_IDP_ENTITY_SET);
+
+ return panel;
+ }
+
+ @Override
+ protected Collection<ActionLink.ActionType> getBatches() {
+ return List.of();
+ }
+
+ @Override
+ protected SAML2IdPEntityProvider dataProvider() {
+ return new SAML2IdPEntityProvider(rows);
+ }
+
+ @Override
+ protected String paginatorRowsKey() {
+ return AMConstants.PREF_SAML2_IDP_ENTITY_PAGINATOR_ROWS;
+ }
+
+ protected static final class SAML2IdPEntityProvider extends DirectoryDataProvider<SAML2IdPEntityTO> {
+
+ private static final long serialVersionUID = 5282134321828253058L;
+
+ private final SortableDataProviderComparator<SAML2IdPEntityTO> comparator;
+
+ public SAML2IdPEntityProvider(final int paginatorRows) {
+ super(paginatorRows);
+ setSort(Constants.KEY_FIELD_NAME, SortOrder.ASCENDING);
+ comparator = new SortableDataProviderComparator<>(this);
+ }
+
+ @Override
+ public Iterator<? extends SAML2IdPEntityTO> iterator(final long first, final long count) {
+ List<SAML2IdPEntityTO> list = SAML2IdPEntityRestClient.list();
+ list.sort(comparator);
+ return list.subList((int) first, (int) first + (int) count).iterator();
+ }
+
+ @Override
+ public long size() {
+ return SAML2IdPEntityRestClient.list().size();
+ }
+
+ @Override
+ public IModel<SAML2IdPEntityTO> model(final SAML2IdPEntityTO metadata) {
+ return new CompoundPropertyModel<>(metadata);
+ }
+ }
+}
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AuthModuleDirectoryPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel.java
similarity index 50%
copy from client/am/console/src/main/java/org/apache/syncope/client/console/panels/AuthModuleDirectoryPanel.java
copy to client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel.java
index dfdd43c..8a67cd2 100644
--- a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AuthModuleDirectoryPanel.java
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel.java
@@ -18,25 +18,26 @@
*/
package org.apache.syncope.client.console.panels;
+import static org.apache.wicket.Component.RENDER;
+
import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.commons.AMConstants;
import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
-import org.apache.syncope.client.console.pages.BasePage;
-import org.apache.syncope.client.console.panels.AuthModuleDirectoryPanel.AuthModuleProvider;
-import org.apache.syncope.client.console.rest.AuthModuleRestClient;
+import org.apache.syncope.client.console.panels.SAML2SPEntityDirectoryPanel.SAML2SPEntityProvider;
+import org.apache.syncope.client.console.rest.SAML2SPEntityRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
-import org.apache.syncope.client.console.wizards.AuthModuleWizardBuilder;
+import org.apache.syncope.client.console.wizards.SAML2SPEntityWizardBuilder;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.DirectoryDataProvider;
+import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
import org.apache.syncope.client.ui.commons.wizards.AjaxWizard;
-import org.apache.syncope.common.lib.to.AuthModuleTO;
+import org.apache.syncope.common.lib.to.SAML2SPEntityTO;
import org.apache.syncope.common.lib.types.AMEntitlement;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -44,98 +45,108 @@ import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDa
import org.apache.wicket.event.Broadcast;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
-import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.html.link.ExternalLink;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;
-public class AuthModuleDirectoryPanel
- extends DirectoryPanel<AuthModuleTO, AuthModuleTO, AuthModuleProvider, AuthModuleRestClient> {
+public class SAML2SPEntityDirectoryPanel extends DirectoryPanel<
+ SAML2SPEntityTO, SAML2SPEntityTO, SAML2SPEntityProvider, SAML2SPEntityRestClient> {
private static final long serialVersionUID = 1L;
- public AuthModuleDirectoryPanel(final String id, final PageReference pageRef) {
+ private final String waPrefix;
+
+ public SAML2SPEntityDirectoryPanel(final String id, final String waPrefix, final PageReference pageRef) {
super(id, pageRef);
+ this.waPrefix = waPrefix;
disableCheckBoxes();
- this.addNewItemPanelBuilder(new AuthModuleWizardBuilder(new AuthModuleTO(), pageRef), true);
+ modal.size(Modal.Size.Large);
+ modal.addSubmitButton();
- MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, AMEntitlement.AUTH_MODULE_CREATE);
+ modal.setWindowClosedCallback(target -> {
+ updateResultTable(target);
+ modal.show(false);
+ });
- modal.size(Modal.Size.Extra_large);
- initResultTable();
- }
+ addNewItemPanelBuilder(new SAML2SPEntityWizardBuilder(new SAML2SPEntityTO(), pageRef), true);
- @Override
- protected AuthModuleProvider dataProvider() {
- return new AuthModuleProvider(rows);
- }
+ MetaDataRoleAuthorizationStrategy.authorize(addAjaxLink, RENDER, AMEntitlement.SAML2_SP_ENTITY_SET);
- @Override
- protected String paginatorRowsKey() {
- return AMConstants.PREF_AUTHMODULE_PAGINATOR_ROWS;
+ initResultTable();
}
@Override
- protected Collection<ActionLink.ActionType> getBatches() {
- return List.of();
- }
+ protected List<IColumn<SAML2SPEntityTO, String>> getColumns() {
+ List<IColumn<SAML2SPEntityTO, String>> columns = new ArrayList<>();
- @Override
- protected List<IColumn<AuthModuleTO, String>> getColumns() {
- final List<IColumn<AuthModuleTO, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<>(
new StringResourceModel(Constants.KEY_FIELD_NAME, this),
Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME));
- columns.add(new PropertyColumn<>(new ResourceModel(Constants.DESCRIPTION_FIELD_NAME),
- Constants.DESCRIPTION_FIELD_NAME, Constants.DESCRIPTION_FIELD_NAME));
- columns.add(new PropertyColumn<AuthModuleTO, String>(new ResourceModel("type"), "conf") {
- private static final long serialVersionUID = -1822504503325964706L;
+ columns.add(new AbstractColumn<SAML2SPEntityTO, String>(Model.of("URL")) {
@Override
public void populateItem(
- final Item<ICellPopulator<AuthModuleTO>> item,
+ final Item<ICellPopulator<SAML2SPEntityTO>> cellItem,
final String componentId,
- final IModel<AuthModuleTO> rowModel) {
-
- item.add(new Label(componentId, rowModel.getObject().getConf() == null
- ? StringUtils.EMPTY
- : StringUtils.substringBefore(
- rowModel.getObject().getConf().getClass().getSimpleName(), "AuthModuleConf")));
+ final IModel<SAML2SPEntityTO> rowModel) {
+
+ String metadataURL = waPrefix + "/sp/" + rowModel.getObject().getKey() + "/metadata";
+ cellItem.add(new ExternalLink(
+ componentId,
+ Model.of(metadataURL),
+ Model.of(metadataURL)) {
+
+ @Override
+ protected void onComponentTag(final ComponentTag tag) {
+ super.onComponentTag(tag);
+
+ tag.setName("a");
+ if (metadataURL.startsWith("http")) {
+ tag.put("href", getDefaultModelObject().toString());
+ tag.put("target", "_blank");
+ }
+ }
+ });
}
});
+
return columns;
}
@Override
- public ActionsPanel<AuthModuleTO> getActions(final IModel<AuthModuleTO> model) {
- ActionsPanel<AuthModuleTO> panel = super.getActions(model);
+ protected ActionsPanel<SAML2SPEntityTO> getActions(final IModel<SAML2SPEntityTO> model) {
+ ActionsPanel<SAML2SPEntityTO> panel = super.getActions(model);
- panel.add(new ActionLink<AuthModuleTO>() {
+ panel.add(new ActionLink<SAML2SPEntityTO>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
- public void onClick(final AjaxRequestTarget target, final AuthModuleTO ignore) {
- send(AuthModuleDirectoryPanel.this, Broadcast.EXACT, new AjaxWizard.EditItemActionEvent<>(
- AuthModuleRestClient.read(model.getObject().getKey()), target));
+ public void onClick(final AjaxRequestTarget target, final SAML2SPEntityTO ignore) {
+ send(SAML2SPEntityDirectoryPanel.this, Broadcast.EXACT,
+ new AjaxWizard.EditItemActionEvent<>(
+ SAML2SPEntityRestClient.get(model.getObject().getKey()), target));
}
- }, ActionLink.ActionType.EDIT, AMEntitlement.AUTH_MODULE_UPDATE);
+ }, ActionLink.ActionType.EDIT, AMEntitlement.SAML2_SP_ENTITY_SET);
- panel.add(new ActionLink<AuthModuleTO>() {
+ panel.add(new ActionLink<SAML2SPEntityTO>() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
- public void onClick(final AjaxRequestTarget target, final AuthModuleTO ignore) {
+ public void onClick(final AjaxRequestTarget target, final SAML2SPEntityTO ignore) {
try {
- AuthModuleRestClient.delete(model.getObject().getKey());
+ SAML2SPEntityRestClient.delete(model.getObject().getKey());
SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
target.add(container);
@@ -143,40 +154,55 @@ public class AuthModuleDirectoryPanel
LOG.error("While deleting {}", model.getObject().getKey(), e);
SyncopeConsoleSession.get().onException(e);
}
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ ((BaseWebPage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.DELETE, AMEntitlement.AUTH_MODULE_DELETE, true);
return panel;
}
- protected static final class AuthModuleProvider extends DirectoryDataProvider<AuthModuleTO> {
+ @Override
+ protected Collection<ActionLink.ActionType> getBatches() {
+ return List.of();
+ }
+
+ @Override
+ protected SAML2SPEntityProvider dataProvider() {
+ return new SAML2SPEntityProvider(rows);
+ }
+
+ @Override
+ protected String paginatorRowsKey() {
+ return AMConstants.PREF_SAML2_SP_ENTITY_PAGINATOR_ROWS;
+ }
+
+ protected static final class SAML2SPEntityProvider extends DirectoryDataProvider<SAML2SPEntityTO> {
- private static final long serialVersionUID = -185944053385660794L;
+ private static final long serialVersionUID = 5282134321828253058L;
- private final SortableDataProviderComparator<AuthModuleTO> comparator;
+ private final SortableDataProviderComparator<SAML2SPEntityTO> comparator;
- private AuthModuleProvider(final int paginatorRows) {
+ public SAML2SPEntityProvider(final int paginatorRows) {
super(paginatorRows);
setSort(Constants.KEY_FIELD_NAME, SortOrder.ASCENDING);
comparator = new SortableDataProviderComparator<>(this);
}
@Override
- public Iterator<AuthModuleTO> iterator(final long first, final long count) {
- List<AuthModuleTO> result = AuthModuleRestClient.list();
- result.sort(comparator);
- return result.subList((int) first, (int) first + (int) count).iterator();
+ public Iterator<? extends SAML2SPEntityTO> iterator(final long first, final long count) {
+ List<SAML2SPEntityTO> list = SAML2SPEntityRestClient.list();
+ list.sort(comparator);
+ return list.subList((int) first, (int) first + (int) count).iterator();
}
@Override
public long size() {
- return AuthModuleRestClient.list().size();
+ return SAML2SPEntityRestClient.list().size();
}
@Override
- public IModel<AuthModuleTO> model(final AuthModuleTO object) {
- return new CompoundPropertyModel<>(object);
+ public IModel<SAML2SPEntityTO> model(final SAML2SPEntityTO metadata) {
+ return new CompoundPropertyModel<>(metadata);
}
}
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/OIDCRPDAO.java b/client/am/console/src/main/java/org/apache/syncope/client/console/rest/SAML2IdPEntityRestClient.java
similarity index 52%
copy from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/OIDCRPDAO.java
copy to client/am/console/src/main/java/org/apache/syncope/client/console/rest/SAML2IdPEntityRestClient.java
index 517c92b..8f6ce3b 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/OIDCRPDAO.java
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/rest/SAML2IdPEntityRestClient.java
@@ -16,30 +16,26 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.syncope.core.persistence.api.dao.auth;
-
-import org.apache.syncope.core.persistence.api.dao.DAO;
+package org.apache.syncope.client.console.rest;
import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
-
-public interface OIDCRPDAO extends DAO<OIDCRP> {
-
- OIDCRP find(String key);
-
- OIDCRP findByClientAppId(Long clientAppId);
-
- OIDCRP findByName(String name);
-
- OIDCRP findByClientId(String clientId);
+import java.util.stream.Collectors;
+import org.apache.syncope.common.lib.to.SAML2IdPEntityTO;
+import org.apache.syncope.common.rest.api.service.SAML2IdPEntityService;
- List<OIDCRP> findAll();
+public class SAML2IdPEntityRestClient extends BaseRestClient {
- OIDCRP save(OIDCRP clientApp);
+ private static final long serialVersionUID = -1392090291817187902L;
- void delete(String key);
+ public static List<SAML2IdPEntityTO> list() {
+ return getService(SAML2IdPEntityService.class).list().stream().collect(Collectors.toList());
+ }
- void deleteByClientId(String clientId);
+ public static SAML2IdPEntityTO get(final String key) {
+ return getService(SAML2IdPEntityService.class).get(key);
+ }
- void delete(OIDCRP clientApp);
+ public static void set(final SAML2IdPEntityTO entityTO) {
+ getService(SAML2IdPEntityService.class).set(entityTO);
+ }
}
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/rest/SAML2SPEntityRestClient.java b/client/am/console/src/main/java/org/apache/syncope/client/console/rest/SAML2SPEntityRestClient.java
new file mode 100644
index 0000000..98b3822
--- /dev/null
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/rest/SAML2SPEntityRestClient.java
@@ -0,0 +1,45 @@
+/*
+ * 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 java.util.List;
+import java.util.stream.Collectors;
+import org.apache.syncope.common.lib.to.SAML2SPEntityTO;
+import org.apache.syncope.common.rest.api.service.SAML2SPEntityService;
+
+public class SAML2SPEntityRestClient extends BaseRestClient {
+
+ private static final long serialVersionUID = -1392090291817187902L;
+
+ public static List<SAML2SPEntityTO> list() {
+ return getService(SAML2SPEntityService.class).list().stream().collect(Collectors.toList());
+ }
+
+ public static SAML2SPEntityTO get(final String key) {
+ return getService(SAML2SPEntityService.class).get(key);
+ }
+
+ public static void set(final SAML2SPEntityTO entityTO) {
+ getService(SAML2SPEntityService.class).set(entityTO);
+ }
+
+ public static void delete(final String key) {
+ getService(SAML2SPEntityService.class).delete(key);
+ }
+}
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/SAML2EntityWizardBuilder.java b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/SAML2EntityWizardBuilder.java
new file mode 100644
index 0000000..0e7393a
--- /dev/null
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/SAML2EntityWizardBuilder.java
@@ -0,0 +1,65 @@
+/*
+ * 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.wizards;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel;
+import org.apache.syncope.common.lib.to.SAML2EntityTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.extensions.wizard.WizardStep;
+import org.apache.wicket.model.PropertyModel;
+
+abstract class SAML2EntityWizardBuilder<T extends SAML2EntityTO> extends BaseAjaxWizardBuilder<T> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected SAML2EntityWizardBuilder(final T defaultItem, final PageReference pageRef) {
+ super(defaultItem, pageRef);
+ }
+
+ protected class Metadata extends WizardStep {
+
+ private static final long serialVersionUID = -3043839139187792810L;
+
+ Metadata(final T entity, final PageReference pageRef) {
+ add(new XMLEditorPanel(null, new PropertyModel<>(entity, "metadata"), false, pageRef));
+ }
+
+ @Override
+ public String getTitle() {
+ return "Metadata";
+ }
+ }
+
+ protected abstract class Pem extends WizardStep {
+
+ private static final long serialVersionUID = -3043839139187792810L;
+
+ protected final String property;
+
+ Pem(final String property) {
+ this.property = property;
+ }
+
+ @Override
+ public String getTitle() {
+ return StringUtils.capitalize(property);
+ }
+ }
+}
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPEntityWizardBuilder.java b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPEntityWizardBuilder.java
new file mode 100644
index 0000000..16ff6d8
--- /dev/null
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPEntityWizardBuilder.java
@@ -0,0 +1,106 @@
+/*
+ * 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.wizards;
+
+import java.io.Serializable;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+import org.apache.syncope.client.console.rest.SAML2IdPEntityRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.TextEditorPanel;
+import org.apache.syncope.common.lib.to.SAML2IdPEntityTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.extensions.wizard.WizardModel;
+import org.apache.wicket.model.PropertyModel;
+
+public class SAML2IdPEntityWizardBuilder extends SAML2EntityWizardBuilder<SAML2IdPEntityTO> {
+
+ private static final long serialVersionUID = 1L;
+
+ public SAML2IdPEntityWizardBuilder(final SAML2IdPEntityTO defaultItem, final PageReference pageRef) {
+ super(defaultItem, pageRef);
+ }
+
+ @Override
+ protected Serializable onApplyInternal(final SAML2IdPEntityTO modelObject) {
+ if (modelObject.getMetadata() != null) {
+ modelObject.setMetadata(Base64.getEncoder().encodeToString(
+ modelObject.getMetadata().getBytes(StandardCharsets.UTF_8)));
+ }
+ if (modelObject.getSigningCertificate() != null) {
+ modelObject.setSigningCertificate(Base64.getEncoder().encodeToString(
+ modelObject.getSigningCertificate().getBytes(StandardCharsets.UTF_8)));
+ }
+ if (modelObject.getSigningKey() != null) {
+ modelObject.setSigningKey(Base64.getEncoder().encodeToString(
+ modelObject.getSigningKey().getBytes(StandardCharsets.UTF_8)));
+ }
+ if (modelObject.getEncryptionCertificate() != null) {
+ modelObject.setEncryptionCertificate(Base64.getEncoder().encodeToString(
+ modelObject.getEncryptionCertificate().getBytes(StandardCharsets.UTF_8)));
+ }
+ if (modelObject.getEncryptionKey() != null) {
+ modelObject.setEncryptionKey(Base64.getEncoder().encodeToString(
+ modelObject.getEncryptionKey().getBytes(StandardCharsets.UTF_8)));
+ }
+ SAML2IdPEntityRestClient.set(modelObject);
+ return modelObject;
+ }
+
+ @Override
+ protected WizardModel buildModelSteps(final SAML2IdPEntityTO modelObject, final WizardModel wizardModel) {
+ if (modelObject.getMetadata() != null) {
+ modelObject.setMetadata(new String(Base64.getDecoder().decode(
+ modelObject.getMetadata()), StandardCharsets.UTF_8));
+ }
+ if (modelObject.getSigningCertificate() != null) {
+ modelObject.setSigningCertificate(new String(Base64.getDecoder().decode(
+ modelObject.getSigningCertificate()), StandardCharsets.UTF_8));
+ }
+ if (modelObject.getSigningKey() != null) {
+ modelObject.setSigningKey(new String(Base64.getDecoder().decode(
+ modelObject.getSigningKey()), StandardCharsets.UTF_8));
+ }
+ if (modelObject.getEncryptionCertificate() != null) {
+ modelObject.setEncryptionCertificate(new String(Base64.getDecoder().decode(
+ modelObject.getEncryptionCertificate()), StandardCharsets.UTF_8));
+ }
+ if (modelObject.getEncryptionKey() != null) {
+ modelObject.setEncryptionKey(new String(Base64.getDecoder().decode(
+ modelObject.getEncryptionKey()), StandardCharsets.UTF_8));
+ }
+
+ wizardModel.add(new Metadata(modelObject, pageRef));
+ wizardModel.add(new TextPem(modelObject, "signingCertificate", pageRef));
+ wizardModel.add(new TextPem(modelObject, "signingKey", pageRef));
+ wizardModel.add(new TextPem(modelObject, "encryptionCertificate", pageRef));
+ wizardModel.add(new TextPem(modelObject, "encryptionKey", pageRef));
+ return wizardModel;
+ }
+
+ protected class TextPem extends Pem {
+
+ private static final long serialVersionUID = 1L;
+
+ public TextPem(final SAML2IdPEntityTO entity, final String property, final PageReference pageRef) {
+ super(property);
+
+ add(new TextEditorPanel(null, new PropertyModel<>(entity, property), false, pageRef));
+ }
+ }
+}
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/SAML2SPEntityWizardBuilder.java b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/SAML2SPEntityWizardBuilder.java
new file mode 100644
index 0000000..4c2321d
--- /dev/null
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/SAML2SPEntityWizardBuilder.java
@@ -0,0 +1,104 @@
+/*
+ * 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.wizards;
+
+import java.io.Serializable;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+import javax.ws.rs.core.MediaType;
+import org.apache.syncope.client.console.rest.SAML2SPEntityRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.BinaryFieldPanel;
+import org.apache.syncope.client.ui.commons.Constants;
+import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.client.ui.commons.wizards.AjaxWizard;
+import org.apache.syncope.common.lib.to.SAML2SPEntityTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.extensions.wizard.WizardModel;
+import org.apache.wicket.extensions.wizard.WizardStep;
+import org.apache.wicket.model.PropertyModel;
+
+public class SAML2SPEntityWizardBuilder extends SAML2EntityWizardBuilder<SAML2SPEntityTO> {
+
+ private static final long serialVersionUID = 1L;
+
+ public SAML2SPEntityWizardBuilder(final SAML2SPEntityTO defaultItem, final PageReference pageRef) {
+ super(defaultItem, pageRef);
+ }
+
+ @Override
+ protected Serializable onApplyInternal(final SAML2SPEntityTO modelObject) {
+ if (modelObject.getMetadata() != null) {
+ modelObject.setMetadata(Base64.getEncoder().encodeToString(
+ modelObject.getMetadata().getBytes(StandardCharsets.UTF_8)));
+ }
+ SAML2SPEntityRestClient.set(modelObject);
+ return modelObject;
+ }
+
+ @Override
+ protected WizardModel buildModelSteps(final SAML2SPEntityTO modelObject, final WizardModel wizardModel) {
+ if (modelObject.getMetadata() != null) {
+ modelObject.setMetadata(new String(Base64.getDecoder().decode(
+ modelObject.getMetadata()), StandardCharsets.UTF_8));
+ }
+
+ wizardModel.add(new Profile(modelObject, mode == AjaxWizard.Mode.CREATE));
+ wizardModel.add(new Metadata(modelObject, pageRef));
+ wizardModel.add(new BinaryPem(modelObject, "keystore", pageRef));
+ return wizardModel;
+ }
+
+ protected static class Profile extends WizardStep {
+
+ private static final long serialVersionUID = -3043839139187792810L;
+
+ Profile(final SAML2SPEntityTO entity, final boolean isNew) {
+ AjaxTextFieldPanel key = new AjaxTextFieldPanel(
+ Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME,
+ new PropertyModel<>(entity, Constants.KEY_FIELD_NAME));
+ key.addRequiredLabel();
+ key.setEnabled(isNew);
+ add(key);
+ }
+ }
+
+ protected class BinaryPem extends Pem {
+
+ private static final long serialVersionUID = 1L;
+
+ public BinaryPem(final SAML2SPEntityTO entity, final String property, final PageReference pageRef) {
+ super(property);
+
+ add(new BinaryFieldPanel(
+ "content",
+ "",
+ new PropertyModel<>(entity, property),
+ MediaType.APPLICATION_OCTET_STREAM,
+ entity.getKey()) {
+
+ private static final long serialVersionUID = -3268213909514986831L;
+
+ @Override
+ protected PageReference getPageReference() {
+ return pageRef;
+ }
+ });
+ }
+ }
+}
diff --git a/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2.html
similarity index 83%
copy from ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html
copy to client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2.html
index 7bd3fbd..a82819c 100644
--- a/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2.html
@@ -18,10 +18,6 @@ under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
- <div class="logviewer-btn">
- <a class="btn btn-success" wicket:id="downloadMetadata">
- <span class="fa fa-download"></span> Metadata
- </a>
- </div>
+ <div wicket:id="saml2"/>
</wicket:panel>
</html>
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel.properties
new file mode 100644
index 0000000..cc10b5c
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=Edit ${key}
+any.new=New IdP Entity
+any.finish=Submit ${key}
+any.cancel=Cancel ${key}
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_fr_CA.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_fr_CA.properties
new file mode 100644
index 0000000..d3c8c14
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_fr_CA.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=Modifier ${key}
+any.new=New IdP Entity
+any.finish=Soumettre ${key}
+any.cancel=Annuler ${key}
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_it.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_it.properties
new file mode 100644
index 0000000..93e6cda
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_it.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=Modifica ${key}
+any.new=Nuova Entit\u00e0 IdP
+any.finish=Invia ${key}
+any.cancel=Annulla ${key}
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_ja.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_ja.properties
new file mode 100644
index 0000000..93d0367
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_ja.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=${key} \u3092\u7de8\u96c6
+any.new=New IdP Entity
+any.finish=${key} \u3092\u5b9f\u884c
+any.cancel=${key} \u3092\u30ad\u30e3\u30f3\u30bb\u30eb
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_pt_BR.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_pt_BR.properties
new file mode 100644
index 0000000..cc10b5c
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_pt_BR.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=Edit ${key}
+any.new=New IdP Entity
+any.finish=Submit ${key}
+any.cancel=Cancel ${key}
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_ru.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_ru.properties
new file mode 100644
index 0000000..003acb1
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel_ru.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c ${key}
+any.new=New IdP Entity
+any.finish=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c ${key}
+any.cancel=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c ${key}
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel.properties
new file mode 100644
index 0000000..5289997
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=Edit ${key}
+any.new=New SP Entity
+any.finish=Submit ${key}
+any.cancel=Cancel ${key}
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_fr_CA.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_fr_CA.properties
new file mode 100644
index 0000000..c8a88c8
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_fr_CA.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=Modifier ${key}
+any.new=New SP Entity
+any.finish=Soumettre ${key}
+any.cancel=Annuler ${key}
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_it.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_it.properties
new file mode 100644
index 0000000..9129629
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_it.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=Modifica ${key}
+any.new=Nuova Entit\u00e0 SP
+any.finish=Invia ${key}
+any.cancel=Annulla ${key}
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_ja.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_ja.properties
new file mode 100644
index 0000000..cf51cb1
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_ja.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=${key} \u3092\u7de8\u96c6
+any.new=New SP Entity
+any.finish=${key} \u3092\u5b9f\u884c
+any.cancel=${key} \u3092\u30ad\u30e3\u30f3\u30bb\u30eb
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_pt_BR.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_pt_BR.properties
new file mode 100644
index 0000000..5289997
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_pt_BR.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=Edit ${key}
+any.new=New SP Entity
+any.finish=Submit ${key}
+any.cancel=Cancel ${key}
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_ru.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_ru.properties
new file mode 100644
index 0000000..651eac5
--- /dev/null
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel_ru.properties
@@ -0,0 +1,20 @@
+# 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.
+any.edit=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c ${key}
+any.new=New SP Entity
+any.finish=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c ${key}
+any.cancel=\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c ${key}
diff --git a/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html b/client/am/console/src/main/resources/org/apache/syncope/client/console/wizards/SAML2EntityWizardBuilder$Metadata.html
similarity index 83%
copy from ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html
copy to client/am/console/src/main/resources/org/apache/syncope/client/console/wizards/SAML2EntityWizardBuilder$Metadata.html
index 7bd3fbd..aefa83b 100644
--- a/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/wizards/SAML2EntityWizardBuilder$Metadata.html
@@ -18,10 +18,6 @@ under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
- <div class="logviewer-btn">
- <a class="btn btn-success" wicket:id="downloadMetadata">
- <span class="fa fa-download"></span> Metadata
- </a>
- </div>
+ <div wicket:id="content"/>
</wicket:panel>
</html>
diff --git a/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html b/client/am/console/src/main/resources/org/apache/syncope/client/console/wizards/SAML2EntityWizardBuilder$Pem.html
similarity index 83%
copy from ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html
copy to client/am/console/src/main/resources/org/apache/syncope/client/console/wizards/SAML2EntityWizardBuilder$Pem.html
index 7bd3fbd..aefa83b 100644
--- a/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/wizards/SAML2EntityWizardBuilder$Pem.html
@@ -18,10 +18,6 @@ under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
- <div class="logviewer-btn">
- <a class="btn btn-success" wicket:id="downloadMetadata">
- <span class="fa fa-download"></span> Metadata
- </a>
- </div>
+ <div wicket:id="content"/>
</wicket:panel>
</html>
diff --git a/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html b/client/am/console/src/main/resources/org/apache/syncope/client/console/wizards/SAML2SPEntityWizardBuilder$Profile.html
similarity index 83%
copy from ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html
copy to client/am/console/src/main/resources/org/apache/syncope/client/console/wizards/SAML2SPEntityWizardBuilder$Profile.html
index 7bd3fbd..993f780 100644
--- a/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/wizards/SAML2SPEntityWizardBuilder$Profile.html
@@ -18,10 +18,6 @@ under the License.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
- <div class="logviewer-btn">
- <a class="btn btn-success" wicket:id="downloadMetadata">
- <span class="fa fa-download"></span> Metadata
- </a>
- </div>
+ <div class="form-group"><span wicket:id="key">[key]</span></div>
</wicket:panel>
</html>
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/MailTemplateDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/MailTemplateDirectoryPanel.java
index 47c7f8d..5619d2f 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/MailTemplateDirectoryPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/MailTemplateDirectoryPanel.java
@@ -53,6 +53,7 @@ import org.apache.wicket.model.StringResourceModel;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel;
import org.apache.syncope.client.ui.commons.Constants;
+import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
import org.apache.syncope.client.ui.commons.panels.WizardModalPanel;
import org.apache.wicket.model.PropertyModel;
@@ -251,7 +252,7 @@ public class MailTemplateDirectoryPanel
SyncopeConsoleSession.get().onException(e);
}
}
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ ((BaseWebPage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DomainDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DomainDirectoryPanel.java
index 10088bd..85a2f10 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DomainDirectoryPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DomainDirectoryPanel.java
@@ -27,13 +27,13 @@ import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.ui.commons.DirectoryDataProvider;
import org.apache.syncope.client.console.commons.IdRepoConstants;
import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
-import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.panels.DomainDirectoryPanel.DomainProvider;
import org.apache.syncope.client.console.rest.SyncopeRestClient;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.ui.commons.Constants;
+import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
import org.apache.syncope.common.keymaster.client.api.DomainOps;
import org.apache.syncope.common.keymaster.client.api.KeymasterException;
import org.apache.syncope.common.keymaster.client.api.model.Domain;
@@ -99,7 +99,7 @@ public class DomainDirectoryPanel extends DirectoryPanel<Domain, Domain, DomainP
@Override
protected ActionsPanel<Domain> getActions(final IModel<Domain> model) {
- final ActionsPanel<Domain> panel = super.getActions(model);
+ ActionsPanel<Domain> panel = super.getActions(model);
panel.add(new ActionLink<Domain>() {
@@ -142,7 +142,7 @@ public class DomainDirectoryPanel extends DirectoryPanel<Domain, Domain, DomainP
LOG.error("While deleting {}", domain.getKey(), e);
SyncopeConsoleSession.get().onException(e);
}
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ ((BaseWebPage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}, ActionLink.ActionType.DELETE, IdRepoEntitlement.KEYMASTER, true);
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/reports/ReportTemplateDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/reports/ReportTemplateDirectoryPanel.java
index 40b2535..6e50db9 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/reports/ReportTemplateDirectoryPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/reports/ReportTemplateDirectoryPanel.java
@@ -53,6 +53,7 @@ import org.apache.syncope.client.console.reports.ReportTemplateDirectoryPanel.Re
import org.apache.syncope.client.console.rest.ReportRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel;
+import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
import org.apache.syncope.client.ui.commons.panels.WizardModalPanel;
import org.apache.syncope.common.lib.types.ReportTemplateFormat;
import org.apache.wicket.model.PropertyModel;
@@ -262,7 +263,7 @@ public class ReportTemplateDirectoryPanel
SyncopeConsoleSession.get().onException(e);
}
}
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ ((BaseWebPage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}
}
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldDownload.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldDownload.java
index a84b080..9c5fec0 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldDownload.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldDownload.java
@@ -60,7 +60,7 @@ public abstract class BinaryFieldDownload extends AbstractAjaxBehavior {
public void initiate(final AjaxRequestTarget target) {
String url = getCallbackUrl().toString();
if (addAntiCache) {
- url = url + (url.contains("?") ? "&" : "?");
+ url += (url.contains("?") ? "&" : "?");
url = url + "antiCache=" + System.currentTimeMillis();
}
target.appendJavaScript("setTimeout(\"window.location.href='" + url + "'\", 100);");
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
index 6219134..decccf0 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
@@ -37,11 +37,11 @@ import org.apache.syncope.client.console.SyncopeWebApplication;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.console.commons.PreviewUtils;
-import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.ui.commons.HttpResourceStream;
import org.apache.syncope.client.ui.commons.markup.html.form.FieldPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.preview.AbstractBinaryPreviewer;
import org.apache.syncope.client.ui.commons.markup.html.form.BaseBinaryFieldPanel;
+import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
import org.apache.syncope.client.ui.commons.rest.ResponseHolder;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -123,7 +123,7 @@ public class BinaryFieldPanel extends BaseBinaryFieldPanel {
public void renderHead(final IHeaderResponse response) {
if (previewer == null) {
FileinputJsReference.INSTANCE.renderHead(response);
- final JQuery fileinputJS = $(fileUpload).chain(new IFunction() {
+ JQuery fileinputJS = $(fileUpload).chain(new IFunction() {
private static final long serialVersionUID = -2285418135375523652L;
@@ -200,7 +200,7 @@ public class BinaryFieldPanel extends BaseBinaryFieldPanel {
SyncopeConsoleSession.get().error(getString("tooLargeFile").
replace("${maxUploadSizeB}", String.valueOf(maxUploadSize.bytes())).
replace("${maxUploadSizeMB}", String.valueOf(maxUploadSize.bytes() / 1000000L)));
- ((BasePage) getPageReference().getPage()).getNotificationPanel().refresh(target);
+ ((BaseWebPage) getPageReference().getPage()).getNotificationPanel().refresh(target);
} else {
byte[] uploadedBytes = uploaded.getBytes();
String uploadedEncoded = Base64.getEncoder().encodeToString(uploadedBytes);
@@ -257,7 +257,7 @@ public class BinaryFieldPanel extends BaseBinaryFieldPanel {
}
private void changePreviewer(final Component panelPreview) {
- final Fragment fragment = new Fragment("panelPreview", "previewFragment", container);
+ Fragment fragment = new Fragment("panelPreview", "previewFragment", container);
fragment.add(panelPreview);
container.addOrReplace(fragment);
uploadForm.addOrReplace(container);
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/TextEditorPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/TextEditorPanel.java
new file mode 100644
index 0000000..5be7a9d
--- /dev/null
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/TextEditorPanel.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.client.console.wicket.markup.html.form;
+
+import org.apache.syncope.client.console.panels.AbstractModalPanel;
+import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.OnLoadHeaderItem;
+import org.apache.wicket.markup.html.form.TextArea;
+import org.apache.wicket.model.IModel;
+
+public class TextEditorPanel extends AbstractModalPanel<String> {
+
+ private static final long serialVersionUID = -5110368813584745668L;
+
+ private final IModel<String> content;
+
+ private final boolean readOnly;
+
+ public TextEditorPanel(final IModel<String> content) {
+ this(null, content, false, null);
+ }
+
+ public TextEditorPanel(
+ final BaseModal<String> modal,
+ final IModel<String> content,
+ final boolean readOnly,
+ final PageReference pageRef) {
+
+ super(modal, pageRef);
+ this.content = content;
+ this.readOnly = readOnly;
+ TextArea<String> textEditorInfoDefArea = new TextArea<>("textEditorInfo", this.content);
+ textEditorInfoDefArea.setMarkupId("textEditorInfo").setOutputMarkupPlaceholderTag(true);
+ add(textEditorInfoDefArea);
+ }
+
+ @Override
+ public void renderHead(final IHeaderResponse response) {
+ super.renderHead(response);
+ response.render(OnLoadHeaderItem.forScript(
+ "CodeMirror.fromTextArea(document.getElementById('textEditorInfo'), {"
+ + " readOnly: " + readOnly + ", "
+ + " lineNumbers: true, "
+ + " lineWrapping: true, "
+ + " mode: 'text/plain', "
+ + " autoRefresh: true"
+ + "}).on('change', updateTextArea);"));
+ }
+}
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/TextEditorPanel.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/TextEditorPanel.html
new file mode 100644
index 0000000..3a3af30
--- /dev/null
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/TextEditorPanel.html
@@ -0,0 +1,51 @@
+<!--
+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:head>
+ <link rel="stylesheet" type="text/css" href="webjars/codemirror/${codemirror.version}/lib/codemirror.css"/>
+
+ <script type="text/javascript" src="webjars/codemirror/${codemirror.version}/lib/codemirror.js"></script>
+ <script type="text/javascript" src="webjars/codemirror/${codemirror.version}/addon/display/autorefresh.js"></script>
+ <script type="text/javascript" src="webjars/codemirror/${codemirror.version}/addon/search/search.js"></script>
+ <script type="text/javascript" src="webjars/codemirror/${codemirror.version}/addon/search/searchcursor.js"></script>
+ <script type="text/javascript">
+ function updateTextArea(editor) {
+ document.getElementById("textEditorInfoDefForm").children["textEditorInfo"].value = editor.getValue();
+ }
+ </script>
+ <style>
+ .w_content_3 {
+ padding: 0;
+ color: #333333;
+ font-family: Verdana,Tahoma,sans-serif;
+ font-size: 100%;
+ border: 1px solid #BBBBBB;
+ padding: 1%;
+ }
+ </style>
+ </wicket:head>
+ <wicket:panel>
+ <div style="padding: 1%;">
+ <div class="w_content_3" id="textEditorInfoDefForm">
+ <textarea wicket:id="textEditorInfo" id="textEditorInfo" name="textEditorInfo" style="width: 100%; height: 350px;">
+ </textarea>
+ </div>
+ </div>
+ </wicket:panel>
+</html>
\ No newline at end of file
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/CASSPTO.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/CASSPClientAppTO.java
similarity index 95%
rename from common/am/lib/src/main/java/org/apache/syncope/common/lib/to/CASSPTO.java
rename to common/am/lib/src/main/java/org/apache/syncope/common/lib/to/CASSPClientAppTO.java
index f940618..e8b6480 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/CASSPTO.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/CASSPClientAppTO.java
@@ -25,7 +25,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@Schema(allOf = {ClientAppTO.class})
-public class CASSPTO extends ClientAppTO {
+public class CASSPClientAppTO extends ClientAppTO {
private static final long serialVersionUID = -5370888503924521351L;
@@ -58,7 +58,7 @@ public class CASSPTO extends ClientAppTO {
if (obj.getClass() != getClass()) {
return false;
}
- CASSPTO rhs = (CASSPTO) obj;
+ CASSPClientAppTO rhs = (CASSPClientAppTO) obj;
return new EqualsBuilder()
.appendSuper(super.equals(obj))
.append(this.serviceId, rhs.serviceId)
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/ClientAppTO.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/ClientAppTO.java
index f00da29..0fc84c8 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/ClientAppTO.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/ClientAppTO.java
@@ -33,7 +33,8 @@ import org.apache.syncope.common.lib.Attr;
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "_class")
@JsonPropertyOrder(value = { "_class", "key", "description" })
-@Schema(subTypes = { OIDCRPTO.class, SAML2SPTO.class, CASSPTO.class }, discriminatorProperty = "_class")
+@Schema(subTypes = { OIDCRPClientAppTO.class, SAML2SPClientAppTO.class, CASSPClientAppTO.class },
+ discriminatorProperty = "_class")
public abstract class ClientAppTO implements NamedEntityTO {
private static final long serialVersionUID = 6577639976115661357L;
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCJWKSTO.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCJWKSTO.java
index b5794df..ea7e14c 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCJWKSTO.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCJWKSTO.java
@@ -26,6 +26,25 @@ public class OIDCJWKSTO implements EntityTO {
private static final long serialVersionUID = 1285073386484048953L;
+ public static class Builder {
+
+ private final OIDCJWKSTO instance = new OIDCJWKSTO();
+
+ public OIDCJWKSTO.Builder json(final String json) {
+ instance.setJson(json);
+ return this;
+ }
+
+ public OIDCJWKSTO.Builder key(final String key) {
+ instance.setKey(key);
+ return this;
+ }
+
+ public OIDCJWKSTO build() {
+ return instance;
+ }
+ }
+
private String key;
private String json;
@@ -83,23 +102,4 @@ public class OIDCJWKSTO implements EntityTO {
.append("json", json)
.toString();
}
-
- public static class Builder {
-
- private final OIDCJWKSTO instance = new OIDCJWKSTO();
-
- public OIDCJWKSTO.Builder json(final String json) {
- instance.setJson(json);
- return this;
- }
-
- public OIDCJWKSTO.Builder key(final String key) {
- instance.setKey(key);
- return this;
- }
-
- public OIDCJWKSTO build() {
- return instance;
- }
- }
}
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCRPTO.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCRPClientAppTO.java
similarity index 97%
rename from common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCRPTO.java
rename to common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCRPClientAppTO.java
index 38b27cd..5c9034b 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCRPTO.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCRPClientAppTO.java
@@ -31,7 +31,7 @@ import org.apache.syncope.common.lib.types.OIDCResponseType;
import org.apache.syncope.common.lib.types.OIDCSubjectType;
@Schema(allOf = { ClientAppTO.class })
-public class OIDCRPTO extends ClientAppTO {
+public class OIDCRPClientAppTO extends ClientAppTO {
private static final long serialVersionUID = -6370888503924521351L;
@@ -128,7 +128,7 @@ public class OIDCRPTO extends ClientAppTO {
if (obj.getClass() != getClass()) {
return false;
}
- OIDCRPTO rhs = (OIDCRPTO) obj;
+ OIDCRPClientAppTO rhs = (OIDCRPClientAppTO) obj;
return new EqualsBuilder()
.appendSuper(super.equals(obj))
.append(this.clientId, rhs.clientId)
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPKeystoreTO.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2EntityTO.java
similarity index 59%
rename from common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPKeystoreTO.java
rename to common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2EntityTO.java
index d2c1fb4..17ce492 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPKeystoreTO.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2EntityTO.java
@@ -18,20 +18,40 @@
*/
package org.apache.syncope.common.lib.to;
+import javax.ws.rs.PathParam;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
-import javax.ws.rs.PathParam;
-public class SAML2SPKeystoreTO implements EntityTO {
+public abstract class SAML2EntityTO implements EntityTO {
- private static final long serialVersionUID = 3211073386484148953L;
+ private static final long serialVersionUID = 1L;
- private String key;
+ protected abstract static class Builder<P extends SAML2EntityTO, B extends Builder<P, B>> {
- private String keystore;
+ protected P instance;
+
+ protected abstract P newInstance();
+
+ protected P getInstance() {
+ if (instance == null) {
+ instance = newInstance();
+ }
+ return instance;
+ }
+
+ @SuppressWarnings("unchecked")
+ public B key(final String key) {
+ getInstance().setKey(key);
+ return (B) this;
+ }
+
+ public P build() {
+ return getInstance();
+ }
+ }
- private String owner;
+ private String key;
@Override
public String getKey() {
@@ -44,31 +64,6 @@ public class SAML2SPKeystoreTO implements EntityTO {
this.key = key;
}
- public String getKeystore() {
- return keystore;
- }
-
- public void setKeystore(final String keystore) {
- this.keystore = keystore;
- }
-
- public String getOwner() {
- return owner;
- }
-
- public void setOwner(final String owner) {
- this.owner = owner;
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().
- append(key).
- append(keystore).
- append(owner).
- build();
- }
-
@Override
public boolean equals(final Object obj) {
if (this == obj) {
@@ -80,39 +75,23 @@ public class SAML2SPKeystoreTO implements EntityTO {
if (getClass() != obj.getClass()) {
return false;
}
- SAML2SPKeystoreTO other = (SAML2SPKeystoreTO) obj;
+ SAML2EntityTO other = (SAML2EntityTO) obj;
return new EqualsBuilder().
append(key, other.key).
- append(keystore, other.keystore).
- append(owner, other.owner).
build();
}
@Override
- public String toString() {
- return new ToStringBuilder(this)
- .appendSuper(super.toString())
- .append("key", key)
- .append("owner", owner)
- .toString();
+ public int hashCode() {
+ return new HashCodeBuilder().
+ append(key).
+ build();
}
- public static class Builder {
-
- private final SAML2SPKeystoreTO instance = new SAML2SPKeystoreTO();
-
- public Builder keystore(final String keystore) {
- instance.setKeystore(keystore);
- return this;
- }
-
- public Builder owner(final String owner) {
- instance.setOwner(owner);
- return this;
- }
-
- public SAML2SPKeystoreTO build() {
- return instance;
- }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).
+ append("key", key).
+ toString();
}
}
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2IdPMetadataTO.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2IdPEntityTO.java
similarity index 73%
rename from common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2IdPMetadataTO.java
rename to common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2IdPEntityTO.java
index e6263b5..4aaac4e 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2IdPMetadataTO.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2IdPEntityTO.java
@@ -18,77 +18,55 @@
*/
package org.apache.syncope.common.lib.to;
-import javax.ws.rs.PathParam;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
-public class SAML2IdPMetadataTO implements EntityTO {
+public class SAML2IdPEntityTO extends SAML2EntityTO {
private static final long serialVersionUID = 7215073386484048953L;
- private String key;
+ public static class Builder extends SAML2EntityTO.Builder<SAML2IdPEntityTO, Builder> {
- private String metadata;
-
- private String signingCertificate;
-
- private String signingKey;
-
- private String encryptionCertificate;
-
- private String encryptionKey;
-
- private String appliesTo;
-
- public static class Builder {
-
- private final SAML2IdPMetadataTO instance = new SAML2IdPMetadataTO();
+ @Override
+ protected SAML2IdPEntityTO newInstance() {
+ return new SAML2IdPEntityTO();
+ }
public Builder metadata(final String metadata) {
- instance.setMetadata(metadata);
+ getInstance().setMetadata(metadata);
return this;
}
public Builder signingCertificate(final String signingCertificate) {
- instance.setSigningCertificate(signingCertificate);
+ getInstance().setSigningCertificate(signingCertificate);
return this;
}
public Builder signingKey(final String signingKey) {
- instance.setSigningKey(signingKey);
+ getInstance().setSigningKey(signingKey);
return this;
}
public Builder encryptionCertificate(final String encryptionCertificate) {
- instance.setEncryptionCertificate(encryptionCertificate);
+ getInstance().setEncryptionCertificate(encryptionCertificate);
return this;
}
public Builder encryptionKey(final String encryptionKey) {
- instance.setEncryptionKey(encryptionKey);
+ getInstance().setEncryptionKey(encryptionKey);
return this;
}
+ }
- public Builder appliesTo(final String appliesTo) {
- instance.setAppliesTo(appliesTo);
- return this;
- }
+ private String metadata;
- public SAML2IdPMetadataTO build() {
- return instance;
- }
- }
+ private String signingCertificate;
- @Override
- public String getKey() {
- return key;
- }
+ private String signingKey;
- @PathParam("key")
- @Override
- public void setKey(final String key) {
- this.key = key;
- }
+ private String encryptionCertificate;
+
+ private String encryptionKey;
public String getMetadata() {
return metadata;
@@ -130,12 +108,16 @@ public class SAML2IdPMetadataTO implements EntityTO {
this.encryptionKey = encryptionKey;
}
- public String getAppliesTo() {
- return appliesTo;
- }
-
- public void setAppliesTo(final String appliesTo) {
- this.appliesTo = appliesTo;
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().
+ appendSuper(super.hashCode()).
+ append(metadata).
+ append(encryptionCertificate).
+ append(encryptionKey).
+ append(signingCertificate).
+ append(signingKey).
+ build();
}
@Override
@@ -149,28 +131,14 @@ public class SAML2IdPMetadataTO implements EntityTO {
if (getClass() != obj.getClass()) {
return false;
}
- SAML2IdPMetadataTO other = (SAML2IdPMetadataTO) obj;
+ SAML2IdPEntityTO other = (SAML2IdPEntityTO) obj;
return new EqualsBuilder().
- append(key, other.key).
+ appendSuper(super.equals(obj)).
append(metadata, other.metadata).
append(encryptionCertificate, other.encryptionCertificate).
append(encryptionKey, other.encryptionKey).
append(signingCertificate, other.signingCertificate).
append(signingKey, other.signingKey).
- append(appliesTo, other.appliesTo).
- build();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().
- append(key).
- append(metadata).
- append(encryptionCertificate).
- append(encryptionKey).
- append(signingCertificate).
- append(signingKey).
- append(appliesTo).
build();
}
}
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPTO.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPClientAppTO.java
similarity index 98%
rename from common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPTO.java
rename to common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPClientAppTO.java
index 109d0c4..13c6afe 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPTO.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPClientAppTO.java
@@ -31,7 +31,7 @@ import java.util.ArrayList;
import java.util.List;
@Schema(allOf = { ClientAppTO.class })
-public class SAML2SPTO extends ClientAppTO {
+public class SAML2SPClientAppTO extends ClientAppTO {
private static final long serialVersionUID = -6370888503924521351L;
@@ -230,7 +230,7 @@ public class SAML2SPTO extends ClientAppTO {
if (obj.getClass() != getClass()) {
return false;
}
- SAML2SPTO rhs = (SAML2SPTO) obj;
+ SAML2SPClientAppTO rhs = (SAML2SPClientAppTO) obj;
return new EqualsBuilder()
.appendSuper(super.equals(obj))
.append(this.entityId, rhs.entityId)
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPMetadataTO.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPEntityTO.java
similarity index 60%
rename from common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPMetadataTO.java
rename to common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPEntityTO.java
index 07ae1b7..ee1f1d8 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPMetadataTO.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/SAML2SPEntityTO.java
@@ -20,28 +20,39 @@ package org.apache.syncope.common.lib.to;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import javax.ws.rs.PathParam;
-public class SAML2SPMetadataTO implements EntityTO {
+public class SAML2SPEntityTO extends SAML2EntityTO {
private static final long serialVersionUID = 6215073386484048953L;
- private String key;
+ public static class Builder extends SAML2EntityTO.Builder<SAML2SPEntityTO, Builder> {
- private String metadata;
+ @Override
+ protected SAML2SPEntityTO newInstance() {
+ return new SAML2SPEntityTO();
+ }
- private String owner;
+ public Builder keystore(final String keystore) {
+ getInstance().setKeystore(keystore);
+ return this;
+ }
- @Override
- public String getKey() {
- return key;
+ public Builder metadata(final String metadata) {
+ getInstance().setMetadata(metadata);
+ return this;
+ }
}
- @PathParam("key")
- @Override
- public void setKey(final String key) {
- this.key = key;
+ private String keystore;
+
+ private String metadata;
+
+ public String getKeystore() {
+ return keystore;
+ }
+
+ public void setKeystore(final String keystore) {
+ this.keystore = keystore;
}
public String getMetadata() {
@@ -52,20 +63,12 @@ public class SAML2SPMetadataTO implements EntityTO {
this.metadata = metadata;
}
- public String getOwner() {
- return owner;
- }
-
- public void setOwner(final String owner) {
- this.owner = owner;
- }
-
@Override
public int hashCode() {
return new HashCodeBuilder().
- append(key).
+ appendSuper(super.hashCode()).
+ append(keystore).
append(metadata).
- append(owner).
build();
}
@@ -80,39 +83,11 @@ public class SAML2SPMetadataTO implements EntityTO {
if (getClass() != obj.getClass()) {
return false;
}
- SAML2SPMetadataTO other = (SAML2SPMetadataTO) obj;
+ SAML2SPEntityTO other = (SAML2SPEntityTO) obj;
return new EqualsBuilder().
- append(key, other.key).
+ appendSuper(super.equals(obj)).
+ append(keystore, other.keystore).
append(metadata, other.metadata).
- append(owner, other.owner).
build();
}
-
- @Override
- public String toString() {
- return new ToStringBuilder(this)
- .appendSuper(super.toString())
- .append("key", key)
- .append("owner", owner)
- .toString();
- }
-
- public static class Builder {
-
- private final SAML2SPMetadataTO instance = new SAML2SPMetadataTO();
-
- public Builder metadata(final String metadata) {
- instance.setMetadata(metadata);
- return this;
- }
-
- public Builder owner(final String owner) {
- instance.setOwner(owner);
- return this;
- }
-
- public SAML2SPMetadataTO build() {
- return instance;
- }
- }
}
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/types/AMEntitlement.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/types/AMEntitlement.java
index 1a8a7e0..b777034 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/types/AMEntitlement.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/types/AMEntitlement.java
@@ -56,17 +56,19 @@ public final class AMEntitlement {
public static final String AUTH_MODULE_DELETE = "AUTH_MODULE_DELETE";
- public static final String SAML2_IDP_METADATA_SET = "SAML2_IDP_METADATA_SET";
+ public static final String SAML2_IDP_ENTITY_SET = "SAML2_IDP_ENTITY_SET";
- public static final String SAML2_IDP_METADATA_READ = "SAML2_IDP_METADATA_READ";
+ public static final String SAML2_IDP_ENTITY_LIST = "SAML2_IDP_ENTITY_LIST";
- public static final String SAML2_SP_METADATA_SET = "SAML2_SP_METADATA_SET";
+ public static final String SAML2_IDP_ENTITY_GET = "SAML2_IDP_ENTITY_GET";
- public static final String SAML2_SP_METADATA_READ = "SAML2_SP_METADATA_READ";
+ public static final String SAML2_SP_ENTITY_SET = "SAML2_SP_ENTITY_SET";
- public static final String SAML2_SP_KEYSTORE_SET = "SAML2_SP_KEYSTORE_SET";
+ public static final String SAML2_SP_ENTITY_DELETE = "SAML2_SP_ENTITY_DELETE";
- public static final String SAML2_SP_KEYSTORE_READ = "SAML2_SP_KEYSTORE_READ";
+ public static final String SAML2_SP_ENTITY_LIST = "SAML2_SP_ENTITY_LIST";
+
+ public static final String SAML2_SP_ENTITY_GET = "SAML2_SP_ENTITY_GET";
public static final String GOOGLE_MFA_DELETE_TOKEN = "GOOGLE_MFA_DELETE_TOKEN";
@@ -106,8 +108,6 @@ public final class AMEntitlement {
public static final String U2F_SEARCH_DEVICES = "U2F_SEARCH_DEVICES";
- public static final String U2F_UPDATE_DEVICE = "U2F_UPDATE_DEVICE";
-
public static final String WA_CONFIG_LIST = "WA_CONFIG_LIST";
public static final String WA_CONFIG_SET = "WA_CONFIG_SET";
@@ -130,8 +130,6 @@ public final class AMEntitlement {
public static final String IMPERSONATION_CREATE_ACCOUNT = "IMPERSONATION_CREATE_ACCOUNT";
- public static final String IMPERSONATION_UPDATE_ACCOUNT = "IMPERSONATION_UPDATE_ACCOUNT";
-
public static final String IMPERSONATION_DELETE_ACCOUNT = "IMPERSONATION_DELETE_ACCOUNT";
public static final String IMPERSONATION_READ_ACCOUNT = "IMPERSONATION_READ_ACCOUNT";
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/GoogleMfaAuthAccount.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/GoogleMfaAuthAccount.java
index aa48e98..da78867 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/GoogleMfaAuthAccount.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/GoogleMfaAuthAccount.java
@@ -65,18 +65,11 @@ public class GoogleMfaAuthAccount implements BaseBean {
return this;
}
- public GoogleMfaAuthAccount.Builder key(final String key) {
- instance.setKey(key);
- return this;
- }
-
public GoogleMfaAuthAccount build() {
return instance;
}
}
- private String key;
-
private String secretKey;
private String name;
@@ -89,14 +82,6 @@ public class GoogleMfaAuthAccount implements BaseBean {
private Date registrationDate;
- public String getKey() {
- return key;
- }
-
- public void setKey(final String key) {
- this.key = key;
- }
-
public String getName() {
return name;
}
@@ -151,7 +136,6 @@ public class GoogleMfaAuthAccount implements BaseBean {
public int hashCode() {
return new HashCodeBuilder()
.appendSuper(super.hashCode())
- .append(key)
.append(secretKey)
.append(name)
.append(id)
@@ -175,7 +159,6 @@ public class GoogleMfaAuthAccount implements BaseBean {
GoogleMfaAuthAccount rhs = (GoogleMfaAuthAccount) obj;
return new EqualsBuilder()
.appendSuper(super.equals(obj))
- .append(this.key, rhs.key)
.append(this.secretKey, rhs.secretKey)
.append(this.name, rhs.name)
.append(this.id, rhs.id)
@@ -188,7 +171,6 @@ public class GoogleMfaAuthAccount implements BaseBean {
@Override
public String toString() {
return new ToStringBuilder(this)
- .append("key", key)
.append("name", name)
.append("secretKey", secretKey)
.append("id", id)
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/GoogleMfaAuthToken.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/GoogleMfaAuthToken.java
index 6d2a26c..a1ce05a 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/GoogleMfaAuthToken.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/GoogleMfaAuthToken.java
@@ -43,30 +43,15 @@ public class GoogleMfaAuthToken implements BaseBean {
return this;
}
- public GoogleMfaAuthToken.Builder key(final String key) {
- instance.setKey(key);
- return this;
- }
-
public GoogleMfaAuthToken build() {
return instance;
}
}
- private String key;
-
private int otp;
private Date issueDate;
- public String getKey() {
- return key;
- }
-
- public void setKey(final String key) {
- this.key = key;
- }
-
public int getOtp() {
return otp;
}
@@ -89,7 +74,6 @@ public class GoogleMfaAuthToken implements BaseBean {
public int hashCode() {
return new HashCodeBuilder()
.appendSuper(super.hashCode())
- .append(key)
.append(otp)
.append(issueDate)
.toHashCode();
@@ -109,7 +93,6 @@ public class GoogleMfaAuthToken implements BaseBean {
GoogleMfaAuthToken rhs = (GoogleMfaAuthToken) obj;
return new EqualsBuilder()
.appendSuper(super.equals(obj))
- .append(this.key, rhs.key)
.append(this.otp, rhs.otp)
.append(this.issueDate, rhs.issueDate)
.isEquals();
@@ -118,7 +101,6 @@ public class GoogleMfaAuthToken implements BaseBean {
@Override
public String toString() {
return new ToStringBuilder(this)
- .append("key", key)
.append("token", otp)
.append("issueDate", issueDate)
.toString();
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/ImpersonationAccount.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/ImpersonationAccount.java
index 153efeb..6d80d3c 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/ImpersonationAccount.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/ImpersonationAccount.java
@@ -27,33 +27,35 @@ public class ImpersonationAccount implements BaseBean {
private static final long serialVersionUID = 2285073386484048953L;
- private String owner;
+ public static class Builder {
- private String key;
+ private final ImpersonationAccount instance = new ImpersonationAccount();
- public String getKey() {
- return key;
- }
+ public ImpersonationAccount.Builder impersonated(final String impersonated) {
+ instance.setImpersonated(impersonated);
+ return this;
+ }
- public void setKey(final String key) {
- this.key = key;
+ public ImpersonationAccount build() {
+ return instance;
+ }
}
- public String getOwner() {
- return owner;
+ private String impersonated;
+
+ public String getImpersonated() {
+ return impersonated;
}
- public void setOwner(final String owner) {
- this.owner = owner;
+ public void setImpersonated(final String impersonated) {
+ this.impersonated = impersonated;
}
@Override
public int hashCode() {
return new HashCodeBuilder()
- .appendSuper(super.hashCode())
- .append(key)
- .append(owner)
- .toHashCode();
+ .append(impersonated)
+ .toHashCode();
}
@Override
@@ -69,36 +71,14 @@ public class ImpersonationAccount implements BaseBean {
}
ImpersonationAccount rhs = (ImpersonationAccount) obj;
return new EqualsBuilder()
- .appendSuper(super.equals(obj))
- .append(this.key, rhs.key)
- .append(this.owner, rhs.owner)
- .isEquals();
+ .append(this.impersonated, rhs.impersonated)
+ .isEquals();
}
@Override
public String toString() {
return new ToStringBuilder(this)
- .append("key", key)
- .append("owner", owner)
- .toString();
- }
-
- public static class Builder {
-
- private final ImpersonationAccount instance = new ImpersonationAccount();
-
- public ImpersonationAccount.Builder key(final String key) {
- instance.setKey(key);
- return this;
- }
-
- public ImpersonationAccount.Builder owner(final String owner) {
- instance.setOwner(owner);
- return this;
- }
-
- public ImpersonationAccount build() {
- return instance;
- }
+ .append("key", impersonated)
+ .toString();
}
}
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/U2FDevice.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/U2FDevice.java
index a37e471..a0c465b 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/U2FDevice.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/U2FDevice.java
@@ -20,7 +20,6 @@ package org.apache.syncope.common.lib.wa;
import java.util.Date;
import java.util.Optional;
-import javax.ws.rs.PathParam;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -44,11 +43,6 @@ public class U2FDevice implements BaseBean {
return this;
}
- public U2FDevice.Builder key(final String key) {
- instance.setKey(key);
- return this;
- }
-
public U2FDevice.Builder id(final long id) {
instance.setId(id);
return this;
@@ -61,21 +55,10 @@ public class U2FDevice implements BaseBean {
private long id;
- private String key;
-
private String record;
private Date issueDate;
- public String getKey() {
- return key;
- }
-
- @PathParam("key")
- public void setKey(final String key) {
- this.key = key;
- }
-
public String getRecord() {
return record;
}
@@ -106,7 +89,6 @@ public class U2FDevice implements BaseBean {
public int hashCode() {
return new HashCodeBuilder()
.appendSuper(super.hashCode())
- .append(key)
.append(record)
.append(id)
.append(issueDate)
@@ -127,7 +109,6 @@ public class U2FDevice implements BaseBean {
U2FDevice rhs = (U2FDevice) obj;
return new EqualsBuilder()
.appendSuper(super.equals(obj))
- .append(this.key, rhs.key)
.append(this.record, rhs.record)
.append(this.id, rhs.id)
.append(this.issueDate, rhs.issueDate)
@@ -137,7 +118,6 @@ public class U2FDevice implements BaseBean {
@Override
public String toString() {
return new ToStringBuilder(this)
- .append("key", key)
.append("record", record)
.append("id", id)
.append("issueDate", issueDate)
diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/WebAuthnAccount.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/WebAuthnAccount.java
index f5f8169..e601fb4 100644
--- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/WebAuthnAccount.java
+++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/wa/WebAuthnAccount.java
@@ -36,11 +36,6 @@ public class WebAuthnAccount implements BaseBean {
private final WebAuthnAccount instance = new WebAuthnAccount();
- public WebAuthnAccount.Builder key(final String key) {
- instance.setKey(key);
- return this;
- }
-
public WebAuthnAccount.Builder credential(final WebAuthnDeviceCredential credential) {
instance.getCredentials().add(credential);
return this;
@@ -61,18 +56,8 @@ public class WebAuthnAccount implements BaseBean {
}
}
- private String key;
-
private final List<WebAuthnDeviceCredential> credentials = new ArrayList<>();
- public String getKey() {
- return key;
- }
-
- public void setKey(final String key) {
- this.key = key;
- }
-
@JacksonXmlElementWrapper(localName = "credentials")
@JacksonXmlProperty(localName = "credential")
public List<WebAuthnDeviceCredential> getCredentials() {
@@ -83,7 +68,6 @@ public class WebAuthnAccount implements BaseBean {
public int hashCode() {
return new HashCodeBuilder()
.appendSuper(super.hashCode())
- .append(key)
.append(credentials)
.toHashCode();
}
@@ -102,7 +86,6 @@ public class WebAuthnAccount implements BaseBean {
WebAuthnAccount rhs = (WebAuthnAccount) obj;
return new EqualsBuilder()
.appendSuper(super.equals(obj))
- .append(this.key, rhs.key)
.append(this.credentials, rhs.credentials)
.isEquals();
}
@@ -110,8 +93,7 @@ public class WebAuthnAccount implements BaseBean {
@Override
public String toString() {
return new ToStringBuilder(this)
- .append("key", key)
- .append("records", credentials)
+ .append("credentials", credentials)
.toString();
}
}
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/U2FDeviceQuery.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/U2FDeviceQuery.java
index 2011538..5e9f930 100644
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/U2FDeviceQuery.java
+++ b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/U2FDeviceQuery.java
@@ -23,7 +23,6 @@ import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Date;
import javax.ws.rs.QueryParam;
-import org.apache.syncope.common.rest.api.service.JAXRSService;
public class U2FDeviceQuery extends AbstractQuery {
@@ -36,11 +35,6 @@ public class U2FDeviceQuery extends AbstractQuery {
return new U2FDeviceQuery();
}
- public U2FDeviceQuery.Builder entityKey(final String entityKey) {
- getInstance().setEntityKey(entityKey);
- return this;
- }
-
public U2FDeviceQuery.Builder owner(final String owner) {
getInstance().setOwner(owner);
return this;
@@ -59,24 +53,10 @@ public class U2FDeviceQuery extends AbstractQuery {
private Long id;
- private String entityKey;
-
private Date expirationDate;
private String owner;
- @Parameter(name = JAXRSService.PARAM_ENTITY_KEY, in = ParameterIn.QUERY,
- schema =
- @Schema(implementation = String.class, example = "50592942-73ec-44c4-a377-e859524245e4"))
- public String getEntityKey() {
- return entityKey;
- }
-
- @QueryParam(JAXRSService.PARAM_ENTITY_KEY)
- public void setEntityKey(final String entityKey) {
- this.entityKey = entityKey;
- }
-
@Parameter(name = "id", in = ParameterIn.QUERY, schema =
@Schema(implementation = Long.class))
public Long getId() {
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AuthProfileService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AuthProfileService.java
index af565f9..4f6a89d 100644
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AuthProfileService.java
+++ b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AuthProfileService.java
@@ -31,7 +31,7 @@ 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.AuthProfileTO;
-import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.rest.api.RESTHeaders;
/**
* REST operations for Auth profiles.
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/OIDCJWKSService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/OIDCJWKSService.java
index edf20cc..b2a8346 100644
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/OIDCJWKSService.java
+++ b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/OIDCJWKSService.java
@@ -50,7 +50,7 @@ public interface OIDCJWKSService extends JAXRSService {
@GET
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- OIDCJWKSTO get();
+ OIDCJWKSTO read();
@ApiResponses({
@ApiResponse(responseCode = "201",
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2SPMetadataService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPEntityService.java
similarity index 51%
rename from common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2SPMetadataService.java
rename to common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPEntityService.java
index 733f7ea..d2f58ad 100644
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2SPMetadataService.java
+++ b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPEntityService.java
@@ -18,13 +18,10 @@
*/
package org.apache.syncope.common.rest.api.service;
-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 java.util.List;
import javax.validation.constraints.NotNull;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@@ -32,63 +29,50 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.SAML2SPMetadataTO;
+import org.apache.syncope.common.lib.to.SAML2IdPEntityTO;
import org.apache.syncope.common.rest.api.RESTHeaders;
/**
- * REST operations for SAML 2.0 SP metadata.
+ * REST operations for SAML 2.0 IdP metadata.
*/
@Tag(name = "SAML 2.0")
@SecurityRequirements({
@SecurityRequirement(name = "BasicAuthentication"),
@SecurityRequirement(name = "Bearer") })
-@Path("saml2sp/metadata")
-public interface SAML2SPMetadataService extends JAXRSService {
+@Path("saml2/idp")
+public interface SAML2IdPEntityService extends JAXRSService {
+
+ String DEFAULT_OWNER = "Syncope";
/**
- * Returns a document outlining metadata for Syncope as SAML 2.0 SP.
+ * Returns the SAML 2.0 IdP entities.
*
- * @param name indicates the SAML 2.0 SP metadata document owner.
- * @return SAML 2.0 SP metadata
+ * @return SAML 2.0 IdP entities
*/
@GET
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- SAML2SPMetadataTO readFor(@QueryParam("name") String name);
+ List<SAML2IdPEntityTO> list();
/**
- * Returns the SAML 2.0 SP metadata matching the given key.
+ * Returns the SAML 2.0 IdP entity matching the given key.
*
- * @param key key of requested SAML 2.0 SP metadata
- * @return SAML 2.0 SP metadata with matching id
+ * @param key key of requested SAML 2.0 IdP entity
+ * @return SAML 2.0 IdP entity with matching key
*/
@GET
@Path("{key}")
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- SAML2SPMetadataTO read(@NotNull @PathParam("key") String key);
+ SAML2IdPEntityTO get(@NotNull @PathParam("key") String key);
/**
- * Store the metadata to finalize the metadata generation process.
+ * Store the entity to finalize the generation process.
*
- * @param metadataTO SAML2SPMetadataTO to be created
- * @return Response object featuring Location header of created SAML 2.0 SP metadata
+ * @param entityTO entity to be created
*/
- @ApiResponses({
- @ApiResponse(responseCode = "201",
- description = "SAML2SPMetadata successfully created", headers = {
- @Header(name = RESTHeaders.RESOURCE_KEY, schema =
- @Schema(type = "string"),
- description = "UUID generated for the entity created"),
- @Header(name = HttpHeaders.LOCATION, schema =
- @Schema(type = "string"),
- description = "URL of the entity created") }),
- @ApiResponse(responseCode = "409",
- description = "Metadata already existing") })
@POST
+ @Path("{key}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- Response set(@NotNull SAML2SPMetadataTO metadataTO);
+ void set(@NotNull SAML2IdPEntityTO entityTO);
}
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPMetadataService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPMetadataService.java
deleted file mode 100644
index 1bf105a..0000000
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2IdPMetadataService.java
+++ /dev/null
@@ -1,98 +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;
-
-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 javax.validation.constraints.NotNull;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.SAML2IdPMetadataTO;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-
-/**
- * REST operations for SAML 2.0 IdP metadata.
- */
-@Tag(name = "SAML 2.0")
-@SecurityRequirements({
- @SecurityRequirement(name = "BasicAuthentication"),
- @SecurityRequirement(name = "Bearer") })
-@Path("saml2idp/metadata")
-public interface SAML2IdPMetadataService extends JAXRSService {
-
- String DEFAULT_OWNER = "Syncope";
-
- /**
- * Returns a document outlining keys and metadata of Syncope as SAML 2.0 IdP.
- *
- * @param appliesTo indicates the SAML 2.0 IdP metadata document owner and applicability, where a value of 'Syncope'
- * indicates the Syncope server as the global owner of the metadata and keys.
- * @return SAML 2.0 IdP metadata
- */
- @GET
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- SAML2IdPMetadataTO readFor(@QueryParam("appliesTo") @DefaultValue(DEFAULT_OWNER) String appliesTo);
-
- /**
- * Returns the SAML 2.0 IdP metadata matching the given key.
- *
- * @param key key of requested SAML 2.0 IdP metadata
- * @return SAML 2.0 IdP metadata with matching id
- */
- @GET
- @Path("{key}")
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- SAML2IdPMetadataTO read(@NotNull @PathParam("key") String key);
-
- /**
- * Store the metadata and keys to finalize the metadata generation process.
- *
- * @param saml2IdPMetadataTO SAML2IdPMetadata to be created
- * @return Response object featuring Location header of created SAML 2.0 IdP metadata
- */
- @ApiResponses({
- @ApiResponse(responseCode = "201",
- description = "SAML2IdPMetadata successfully created", headers = {
- @Header(name = RESTHeaders.RESOURCE_KEY, schema =
- @Schema(type = "string"),
- description = "UUID generated for the entity created"),
- @Header(name = HttpHeaders.LOCATION, schema =
- @Schema(type = "string"),
- description = "URL of the entity created") }),
- @ApiResponse(responseCode = "409",
- description = "Metadata already existing") })
- @POST
- @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- Response set(@NotNull SAML2IdPMetadataTO saml2IdPMetadataTO);
-}
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AuthProfileService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2SPEntityService.java
similarity index 66%
copy from common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AuthProfileService.java
copy to common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2SPEntityService.java
index af565f9..5009cb7 100644
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/AuthProfileService.java
+++ b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2SPEntityService.java
@@ -18,56 +18,70 @@
*/
package org.apache.syncope.common.rest.api.service;
+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 java.util.List;
import javax.validation.constraints.NotNull;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
+import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import java.util.List;
-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.AuthProfileTO;
-import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.lib.to.SAML2SPEntityTO;
+import org.apache.syncope.common.rest.api.RESTHeaders;
/**
- * REST operations for Auth profiles.
+ * REST operations for SAML 2.0 SP entity.
*/
-@Tag(name = "AuthProfiles")
+@Tag(name = "SAML 2.0")
@SecurityRequirements({
@SecurityRequirement(name = "BasicAuthentication"),
@SecurityRequirement(name = "Bearer") })
-@Path("authProfiles")
-public interface AuthProfileService extends JAXRSService {
+@Path("saml2/sp")
+public interface SAML2SPEntityService extends JAXRSService {
+ /**
+ * Returns the SAML 2.0 SP entities.
+ *
+ * @return SAML 2.0 SP entities
+ */
@GET
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- List<AuthProfileTO> list();
+ List<SAML2SPEntityTO> list();
+ /**
+ * Returns the SAML 2.0 SP entity matching the given key.
+ *
+ * @param key key of requested SAML 2.0 SP entity
+ * @return SAML 2.0 SP entity with matching key
+ */
@GET
@Path("{key}")
- @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- AuthProfileTO read(@NotNull @PathParam("key") String key);
+ SAML2SPEntityTO get(@NotNull @PathParam("key") String key);
- @GET
- @Path("owners/{owner}")
+ /**
+ * Store the entity to finalize the generation process.
+ *
+ * @param entityTO entity to be created
+ */
+ @POST
+ @Path("{key}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- AuthProfileTO readByOwner(@NotNull @PathParam("owner") String owner);
+ void set(@NotNull SAML2SPEntityTO entityTO);
+ /**
+ * Delets the SAML 2.0 SP entity matching the given key.
+ *
+ * @param key key of requested SAML 2.0 SP entity
+ */
@DELETE
@Path("{key}")
- @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
void delete(@NotNull @PathParam("key") String key);
-
- @DELETE
- @Path("owners/{owner}")
- @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- void deleteByOwner(@NotNull @PathParam("owner") String owner);
}
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2SPKeystoreService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2SPKeystoreService.java
deleted file mode 100644
index 96bb97d..0000000
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SAML2SPKeystoreService.java
+++ /dev/null
@@ -1,94 +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;
-
-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 javax.validation.constraints.NotNull;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.SAML2SPKeystoreTO;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-
-/**
- * REST operations for SAML 2.0 SP Keystore.
- */
-@Tag(name = "SAML 2.0")
-@SecurityRequirements({
- @SecurityRequirement(name = "BasicAuthentication"),
- @SecurityRequirement(name = "Bearer") })
-@Path("saml2sp/keystore")
-public interface SAML2SPKeystoreService extends JAXRSService {
-
- /**
- * Returns a document outlining keystore for Syncope as SAML 2.0 SP.
- *
- * @param name indicates the SAML 2.0 SP keystore document owner.
- * @return SAML 2.0 SP keystore
- */
- @GET
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- SAML2SPKeystoreTO readFor(@QueryParam("name") String name);
-
- /**
- * Returns the SAML 2.0 SP keystore matching the given key.
- *
- * @param key key of requested SAML 2.0 SP keystore
- * @return SAML 2.0 SP keystore with matching id
- */
- @GET
- @Path("{key}")
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- SAML2SPKeystoreTO read(@NotNull @PathParam("key") String key);
-
- /**
- * Store the keystore to finalize the keystore generation process.
- *
- * @param keystoreTO SAML2SPMetadataKeystoreTO to be created
- * @return Response object featuring Location header of created SAML 2.0 SP keystore
- */
- @ApiResponses({
- @ApiResponse(responseCode = "201",
- description = "SAML2SPKeystoreTO successfully created", headers = {
- @Header(name = RESTHeaders.RESOURCE_KEY, schema =
- @Schema(type = "string"),
- description = "UUID generated for the entity created"),
- @Header(name = HttpHeaders.LOCATION, schema =
- @Schema(type = "string"),
- description = "URL of the entity created") }),
- @ApiResponse(responseCode = "409",
- description = "Metadata already existing") })
- @POST
- @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- Response set(@NotNull SAML2SPKeystoreTO keystoreTO);
-}
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/GoogleMfaAuthAccountService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/GoogleMfaAuthAccountService.java
index 16c9d6e..087dbad 100644
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/GoogleMfaAuthAccountService.java
+++ b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/GoogleMfaAuthAccountService.java
@@ -18,10 +18,6 @@
*/
package org.apache.syncope.common.rest.api.service.wa;
-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;
@@ -35,7 +31,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.wa.GoogleMfaAuthAccount;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -51,35 +46,23 @@ public interface GoogleMfaAuthAccountService extends JAXRSService {
@DELETE
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Path("accts/owners/{owner}")
- void deleteFor(@NotNull @PathParam("owner") String owner);
-
- @DELETE
- @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Path("accts/{key}")
- void delete(@NotNull @PathParam("key") String key);
+ @Path("accts/{owner}")
+ void delete(@NotNull @PathParam("owner") String owner);
@DELETE
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Path("accts")
- void delete();
+ void deleteAll();
- @ApiResponses({
- @ApiResponse(responseCode = "201",
- description = "GoogleMfaAuthAccount successfully created", headers = {
- @Header(name = RESTHeaders.RESOURCE_KEY, schema =
- @Schema(type = "string"),
- description = "UUID generated for the entity created") }) })
@POST
- @Path("accts/owners/{owner}")
+ @Path("accts/{owner}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- Response create(@NotNull @PathParam("owner") String owner, @NotNull GoogleMfaAuthAccount acct);
+ void create(@NotNull @PathParam("owner") String owner, @NotNull GoogleMfaAuthAccount acct);
@PUT
- @Path("accts/owners/{owner}")
+ @Path("accts/{owner}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
void update(@NotNull @PathParam("owner") String owner, @NotNull GoogleMfaAuthAccount acct);
@@ -87,14 +70,8 @@ public interface GoogleMfaAuthAccountService extends JAXRSService {
@GET
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Path("accts/owners/{owner}")
- PagedResult<GoogleMfaAuthAccount> readFor(@NotNull @PathParam("owner") String owner);
-
- @GET
- @Path("accts/{key}")
- @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- GoogleMfaAuthAccount read(@NotNull @PathParam("key") String key);
+ @Path("accts/{owner}")
+ PagedResult<GoogleMfaAuthAccount> read(@NotNull @PathParam("owner") String owner);
@GET
@Path("accts/id/{id}")
@@ -103,8 +80,8 @@ public interface GoogleMfaAuthAccountService extends JAXRSService {
GoogleMfaAuthAccount read(@NotNull @PathParam("id") long id);
@GET
+ @Path("accts")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Path("accts")
PagedResult<GoogleMfaAuthAccount> list();
}
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/GoogleMfaAuthTokenService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/GoogleMfaAuthTokenService.java
index 8ce865a..f070460 100644
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/GoogleMfaAuthTokenService.java
+++ b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/GoogleMfaAuthTokenService.java
@@ -51,25 +51,25 @@ public interface GoogleMfaAuthTokenService extends JAXRSService {
void delete(@QueryParam("expirationDate") Date expirationDate);
@DELETE
- @Path("tokens/owners/{owner}/{otp}")
+ @Path("tokens/{owner}/{otp}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
void delete(@NotNull @PathParam("owner") String owner, @NotNull @PathParam("otp") int otp);
@DELETE
- @Path("tokens/owners/{owner}")
+ @Path("tokens/{owner}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- void deleteFor(@NotNull @PathParam("owner") String owner);
+ void delete(@NotNull @PathParam("owner") String owner);
@DELETE
- @Path("tokens/{otp}")
+ @Path("tokens/otp/{otp}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
void delete(@NotNull @PathParam("otp") int otp);
@PUT
- @Path("tokens/owners/{owner}")
+ @Path("tokens/{owner}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
void store(@NotNull @PathParam("owner") String owner, @NotNull GoogleMfaAuthToken token);
@@ -77,20 +77,14 @@ public interface GoogleMfaAuthTokenService extends JAXRSService {
@GET
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Path("tokens/owners/{owner}/{otp}")
- GoogleMfaAuthToken readFor(@NotNull @PathParam("owner") String owner, @NotNull @PathParam("otp") int otp);
+ @Path("tokens/{owner}/{otp}")
+ GoogleMfaAuthToken read(@NotNull @PathParam("owner") String owner, @NotNull @PathParam("otp") int otp);
@GET
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Path("tokens/owners/{owner}")
- PagedResult<GoogleMfaAuthToken> readFor(@NotNull @PathParam("owner") String owner);
-
- @GET
- @Path("tokens/{key}")
- @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- GoogleMfaAuthToken read(@NotNull @PathParam("key") String key);
+ @Path("tokens/{owner}")
+ PagedResult<GoogleMfaAuthToken> read(@NotNull @PathParam("owner") String owner);
@GET
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/ImpersonationService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/ImpersonationService.java
index 67ac6d4..63d96cb 100644
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/ImpersonationService.java
+++ b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/ImpersonationService.java
@@ -16,68 +16,47 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.syncope.common.rest.api.service.wa;
-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.wa.ImpersonationAccount;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.common.rest.api.service.JAXRSService;
-
+import java.util.List;
import javax.validation.constraints.NotNull;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import java.util.List;
+import org.apache.syncope.common.lib.wa.ImpersonationAccount;
+import org.apache.syncope.common.rest.api.RESTHeaders;
+import org.apache.syncope.common.rest.api.service.JAXRSService;
@Tag(name = "WA")
@SecurityRequirements({
@SecurityRequirement(name = "BasicAuthentication"),
- @SecurityRequirement(name = "Bearer")})
+ @SecurityRequirement(name = "Bearer") })
@Path("wa/impersonation")
public interface ImpersonationService extends JAXRSService {
- @GET
- @Path("accounts/{owner}")
- @Consumes({MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML})
- @Produces({MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML})
- List<ImpersonationAccount> findByOwner(@NotNull @PathParam("owner") String owner);
@GET
- @Path("authz/{owner}")
- @Consumes({MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML})
- @Produces({MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML})
- ImpersonationAccount find(@NotNull @PathParam("owner") String owner,
- @NotNull @QueryParam("id") String id);
-
- @POST
+ @Path("{owner}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- Response create(@NotNull ImpersonationAccount account);
+ List<ImpersonationAccount> read(@NotNull @PathParam("owner") String owner);
- @DELETE
- @Path("accounts/{owner}")
+ @POST
+ @Path("{owner}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- Response delete(@NotNull @PathParam("owner") String owner, @NotNull @QueryParam("id") String id);
+ void create(@NotNull @PathParam("owner") String owner, @NotNull ImpersonationAccount account);
- @ApiResponses(
- @ApiResponse(responseCode = "204", description = "Operation was successful"))
- @PUT
+ @DELETE
+ @Path("{owner}/{impersonated}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- void update(@NotNull ImpersonationAccount account);
-
+ void delete(@NotNull @PathParam("owner") String owner, @NotNull @PathParam("impersonated") String impersonated);
}
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/U2FRegistrationService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/U2FRegistrationService.java
index 3680546..ee8bd8b 100644
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/U2FRegistrationService.java
+++ b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/U2FRegistrationService.java
@@ -18,12 +18,6 @@
*/
package org.apache.syncope.common.rest.api.service.wa;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.enums.ParameterIn;
-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;
@@ -33,12 +27,10 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.wa.U2FDevice;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -55,38 +47,16 @@ public interface U2FRegistrationService extends JAXRSService {
@DELETE
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- Response delete(@BeanParam U2FDeviceQuery query);
+ void delete(@BeanParam U2FDeviceQuery query);
- @ApiResponses({
- @ApiResponse(responseCode = "201",
- description = "U2FRegistration successfully created", headers = {
- @Header(name = RESTHeaders.RESOURCE_KEY, schema =
- @Schema(type = "string"),
- description = "UUID generated for the entity created") }) })
@POST
- @Path("owners/{owner}")
+ @Path("{owner}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- Response create(@NotNull @PathParam("owner") String owner, @NotNull U2FDevice device);
-
- @Parameter(name = "key", description = "U2F device key", in = ParameterIn.PATH, schema =
- @Schema(type = "string"))
- @ApiResponses(
- @ApiResponse(responseCode = "204", description = "Operation was successful"))
- @PUT
- @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 U2FDevice device);
+ void create(@NotNull @PathParam("owner") String owner, @NotNull U2FDevice device);
@GET
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
PagedResult<U2FDevice> search(@BeanParam U2FDeviceQuery query);
-
- @GET
- @Path("{key}")
- @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- U2FDevice read(@NotNull @PathParam("key") String key);
}
diff --git a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/WebAuthnRegistrationService.java b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/WebAuthnRegistrationService.java
index 4d38434..f420395 100644
--- a/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/WebAuthnRegistrationService.java
+++ b/common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/WebAuthnRegistrationService.java
@@ -18,10 +18,6 @@
*/
package org.apache.syncope.common.rest.api.service.wa;
-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;
@@ -36,7 +32,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.wa.WebAuthnAccount;
import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.JAXRSService;
@@ -54,43 +49,31 @@ public interface WebAuthnRegistrationService extends JAXRSService {
List<WebAuthnAccount> list();
@GET
- @Path("{key}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- WebAuthnAccount read(@NotNull @PathParam("key") String key);
-
- @GET
- @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Path("owners/{owner}")
- WebAuthnAccount readFor(@NotNull @PathParam("owner") String owner);
+ @Path("{owner}")
+ WebAuthnAccount read(@NotNull @PathParam("owner") String owner);
@DELETE
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Path("owners/{owner}")
- Response delete(@NotNull @PathParam("owner") String owner);
+ @Path("{owner}")
+ void delete(@NotNull @PathParam("owner") String owner);
@DELETE
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- @Path("owners/{owner}/{credentialId}")
- Response delete(@NotNull @PathParam("owner") String owner, @NotNull @PathParam("credentialId") String credentialId);
+ @Path("{owner}/{credentialId}")
+ void delete(@NotNull @PathParam("owner") String owner, @NotNull @PathParam("credentialId") String credentialId);
- @ApiResponses({
- @ApiResponse(responseCode = "201",
- description = "WebAuthn successfully created", headers = {
- @Header(name = RESTHeaders.RESOURCE_KEY, schema =
- @Schema(type = "string"),
- description = "UUID generated for the entity created") }) })
@POST
- @Path("owners/{owner}")
+ @Path("{owner}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
- Response create(@NotNull @PathParam("owner") String owner, @NotNull WebAuthnAccount account);
+ void create(@NotNull @PathParam("owner") String owner, @NotNull WebAuthnAccount account);
@PUT
- @Path("owners/{owner}")
+ @Path("{owner}")
@Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
void update(@NotNull @PathParam("owner") String owner, @NotNull WebAuthnAccount account);
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/ClientAppLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/ClientAppLogic.java
index df0dc11..94c70fc 100644
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/ClientAppLogic.java
+++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/ClientAppLogic.java
@@ -45,17 +45,17 @@ import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.auth.CASSPDAO;
import org.apache.syncope.core.persistence.api.dao.auth.OIDCRPDAO;
import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.CASSP;
import org.apache.syncope.core.persistence.api.entity.auth.ClientApp;
import org.apache.syncope.core.persistence.api.entity.auth.ClientAppUtils;
import org.apache.syncope.core.persistence.api.entity.auth.ClientAppUtilsFactory;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SP;
import org.apache.syncope.core.provisioning.api.data.ClientAppDataBinder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.CASSPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.OIDCRPClientApp;
@Component
public class ClientAppLogic extends AbstractTransactionalLogic<ClientAppTO> {
@@ -116,7 +116,7 @@ public class ClientAppLogic extends AbstractTransactionalLogic<ClientAppTO> {
public <T extends ClientAppTO> T read(final ClientAppType type, final String key) {
switch (type) {
case OIDCRP:
- OIDCRP oidcrp = oidcrpDAO.find(key);
+ OIDCRPClientApp oidcrp = oidcrpDAO.find(key);
if (oidcrp == null) {
throw new NotFoundException("Client app " + key + " not found");
}
@@ -125,7 +125,7 @@ public class ClientAppLogic extends AbstractTransactionalLogic<ClientAppTO> {
return binder.getClientAppTO(oidcrp);
case CASSP:
- CASSP cassp = casspDAO.find(key);
+ CASSPClientApp cassp = casspDAO.find(key);
if (cassp == null) {
throw new NotFoundException("Client app " + key + " not found");
}
@@ -135,7 +135,7 @@ public class ClientAppLogic extends AbstractTransactionalLogic<ClientAppTO> {
return binder.getClientAppTO(cassp);
case SAML2SP:
default:
- SAML2SP saml2sp = saml2spDAO.find(key);
+ SAML2SPClientApp saml2sp = saml2spDAO.find(key);
if (saml2sp == null) {
throw new NotFoundException("Client app " + key + " not found");
}
@@ -167,7 +167,7 @@ public class ClientAppLogic extends AbstractTransactionalLogic<ClientAppTO> {
switch (type) {
case OIDCRP:
- OIDCRP oidcrp = oidcrpDAO.find(clientAppTO.getKey());
+ OIDCRPClientApp oidcrp = oidcrpDAO.find(clientAppTO.getKey());
if (oidcrp == null) {
throw new NotFoundException("Client app " + clientAppTO.getKey() + " not found");
}
@@ -175,7 +175,7 @@ public class ClientAppLogic extends AbstractTransactionalLogic<ClientAppTO> {
oidcrpDAO.save(oidcrp);
break;
case CASSP:
- CASSP cassp = casspDAO.find(clientAppTO.getKey());
+ CASSPClientApp cassp = casspDAO.find(clientAppTO.getKey());
if (cassp == null) {
throw new NotFoundException("Client app " + clientAppTO.getKey() + " not found");
}
@@ -184,7 +184,7 @@ public class ClientAppLogic extends AbstractTransactionalLogic<ClientAppTO> {
break;
case SAML2SP:
default:
- SAML2SP saml2sp = saml2spDAO.find(clientAppTO.getKey());
+ SAML2SPClientApp saml2sp = saml2spDAO.find(clientAppTO.getKey());
if (saml2sp == null) {
throw new NotFoundException("Client app " + clientAppTO.getKey() + " not found");
}
@@ -197,14 +197,14 @@ public class ClientAppLogic extends AbstractTransactionalLogic<ClientAppTO> {
public void delete(final ClientAppType type, final String key) {
switch (type) {
case OIDCRP:
- OIDCRP oidcrp = oidcrpDAO.find(key);
+ OIDCRPClientApp oidcrp = oidcrpDAO.find(key);
if (oidcrp == null) {
throw new NotFoundException("Client app " + key + " not found");
}
oidcrpDAO.delete(oidcrp);
break;
case CASSP:
- CASSP cassp = casspDAO.find(key);
+ CASSPClientApp cassp = casspDAO.find(key);
if (cassp == null) {
throw new NotFoundException("Client app " + key + " not found");
}
@@ -212,7 +212,7 @@ public class ClientAppLogic extends AbstractTransactionalLogic<ClientAppTO> {
break;
case SAML2SP:
default:
- SAML2SP saml2sp = saml2spDAO.find(key);
+ SAML2SPClientApp saml2sp = saml2spDAO.find(key);
if (saml2sp == null) {
throw new NotFoundException("Client app " + key + " not found");
}
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/OIDCJWKSLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/OIDCJWKSLogic.java
index 6ee3fbf..3720a30 100644
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/OIDCJWKSLogic.java
+++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/OIDCJWKSLogic.java
@@ -46,7 +46,7 @@ public class OIDCJWKSLogic extends AbstractTransactionalLogic<OIDCJWKSTO> {
@PreAuthorize("hasRole('" + AMEntitlement.OIDC_JWKS_READ + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
@Transactional(readOnly = true)
- public OIDCJWKSTO get() {
+ public OIDCJWKSTO read() {
return Optional.ofNullable(dao.get()).
map(binder::get).
orElseThrow(() -> new NotFoundException("OIDC JWKS not found"));
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPMetadataLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2IdPEntityLogic.java
similarity index 50%
rename from core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPMetadataLogic.java
rename to core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2IdPEntityLogic.java
index c9dca18..bab3989 100644
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPMetadataLogic.java
+++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2IdPEntityLogic.java
@@ -19,81 +19,81 @@
package org.apache.syncope.core.logic;
import java.lang.reflect.Method;
+import java.util.List;
import java.util.Optional;
+import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.SAML2SPMetadataTO;
+import org.apache.syncope.common.lib.to.SAML2IdPEntityTO;
import org.apache.syncope.common.lib.types.AMEntitlement;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPMetadataDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPMetadata;
-import org.apache.syncope.core.provisioning.api.data.SAML2SPMetadataBinder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPEntity;
+import org.apache.syncope.core.persistence.api.dao.auth.SAML2IdPEntityDAO;
+import org.apache.syncope.core.provisioning.api.data.SAML2IdPEntityDataBinder;
@Component
-public class SAML2SPMetadataLogic extends AbstractTransactionalLogic<SAML2SPMetadataTO> {
+public class SAML2IdPEntityLogic extends AbstractTransactionalLogic<SAML2IdPEntityTO> {
@Autowired
- private SAML2SPMetadataBinder binder;
+ private SAML2IdPEntityDataBinder binder;
@Autowired
- private SAML2SPMetadataDAO saml2SPMetadataDAO;
+ private SAML2IdPEntityDAO entityDAO;
- @PreAuthorize("hasRole('" + AMEntitlement.SAML2_SP_METADATA_READ + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
+ @PreAuthorize("hasRole('" + AMEntitlement.SAML2_IDP_ENTITY_LIST + "')")
@Transactional(readOnly = true)
- public SAML2SPMetadataTO read(final String key) {
- return Optional.ofNullable(saml2SPMetadataDAO.find(key)).
- map(binder::getSAML2SPMetadataTO).
- orElseThrow(() -> new NotFoundException(key + " not found"));
+ public List<SAML2IdPEntityTO> list() {
+ return entityDAO.findAll().stream().
+ map(binder::getSAML2IdPEntityTO).
+ collect(Collectors.toList());
}
- @PreAuthorize("hasRole('" + AMEntitlement.SAML2_SP_METADATA_READ + "') "
+ @PreAuthorize("hasRole('" + AMEntitlement.SAML2_IDP_ENTITY_GET + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
@Transactional(readOnly = true)
- public SAML2SPMetadataTO readFor(final String name) {
- return Optional.ofNullable(saml2SPMetadataDAO.findByOwner(name)).
- map(binder::getSAML2SPMetadataTO).
- orElseThrow(() -> new NotFoundException("SAML2 SP Metadata owned by " + name + " not found"));
+ public SAML2IdPEntityTO get(final String key) {
+ return Optional.ofNullable(entityDAO.find(key)).
+ map(binder::getSAML2IdPEntityTO).
+ orElseThrow(() -> new NotFoundException(key + " not found"));
}
- @PreAuthorize("hasRole('" + AMEntitlement.SAML2_SP_METADATA_SET + "') "
+ @PreAuthorize("hasRole('" + AMEntitlement.SAML2_IDP_ENTITY_SET + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public SAML2SPMetadataTO set(final SAML2SPMetadataTO metadataTO) {
- SAML2SPMetadata metadata = saml2SPMetadataDAO.findByOwner(metadataTO.getOwner());
- if (metadata == null) {
- return binder.getSAML2SPMetadataTO(saml2SPMetadataDAO.save(binder.create(metadataTO)));
- }
- throw SyncopeClientException.build(ClientExceptionType.EntityExists);
+ public SAML2IdPEntityTO set(final SAML2IdPEntityTO entityTO) {
+ SAML2IdPEntity entity = Optional.ofNullable(entityDAO.find(entityTO.getKey())).
+ map(metadata -> binder.update(metadata, entityTO)).
+ orElseGet(() -> binder.create(entityTO));
+ return binder.getSAML2IdPEntityTO(entityDAO.save(entity));
}
@Override
- protected SAML2SPMetadataTO resolveReference(final Method method, final Object... args)
+ protected SAML2IdPEntityTO resolveReference(final Method method, final Object... args)
throws UnresolvedReferenceException {
- String name = null;
+
+ String key = null;
if (ArrayUtils.isNotEmpty(args)) {
- for (int i = 0; name == null && i < args.length; i++) {
+ for (int i = 0; key == null && i < args.length; i++) {
if (args[i] instanceof String) {
- name = (String) args[i];
- } else if (args[i] instanceof SAML2SPMetadataTO) {
- name = ((SAML2SPMetadataTO) args[i]).getOwner();
+ key = (String) args[i];
+ } else if (args[i] instanceof SAML2IdPEntityTO) {
+ key = ((SAML2IdPEntityTO) args[i]).getKey();
}
}
}
- if (name != null) {
+ if (key != null) {
try {
- return binder.getSAML2SPMetadataTO(saml2SPMetadataDAO.findByOwner(name));
- } catch (final Throwable ignore) {
+ return binder.getSAML2IdPEntityTO(entityDAO.find(key));
+ } catch (Throwable ignore) {
LOG.debug("Unresolved reference", ignore);
throw new UnresolvedReferenceException(ignore);
}
}
+
throw new UnresolvedReferenceException();
}
}
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2IdPMetadataLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2IdPMetadataLogic.java
deleted file mode 100644
index e6e5b40..0000000
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2IdPMetadataLogic.java
+++ /dev/null
@@ -1,101 +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.util.Optional;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.to.SAML2IdPMetadataTO;
-import org.apache.syncope.common.lib.types.AMEntitlement;
-import org.apache.syncope.common.lib.types.IdRepoEntitlement;
-import org.apache.syncope.core.persistence.api.dao.DuplicateException;
-import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.dao.auth.SAML2IdPMetadataDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPMetadata;
-import org.apache.syncope.core.provisioning.api.data.SAML2IdPMetadataDataBinder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-@Component
-public class SAML2IdPMetadataLogic extends AbstractTransactionalLogic<SAML2IdPMetadataTO> {
-
- @Autowired
- private SAML2IdPMetadataDataBinder binder;
-
- @Autowired
- private SAML2IdPMetadataDAO saml2IdPMetadataDAO;
-
- @PreAuthorize("hasRole('" + AMEntitlement.SAML2_IDP_METADATA_READ + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- @Transactional(readOnly = true)
- public SAML2IdPMetadataTO read(final String key) {
- return Optional.ofNullable(saml2IdPMetadataDAO.find(key)).
- map(binder::getSAML2IdPMetadataTO).
- orElseThrow(() -> new NotFoundException("SAML2 IdP Metadata " + key + " not found"));
- }
-
- @PreAuthorize("hasRole('" + AMEntitlement.SAML2_IDP_METADATA_READ + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- @Transactional(readOnly = true)
- public SAML2IdPMetadataTO readFor(final String appliesTo) {
- return Optional.ofNullable(saml2IdPMetadataDAO.findByOwner(appliesTo)).
- map(binder::getSAML2IdPMetadataTO).
- orElseThrow(() -> new NotFoundException("SAML2 IdP Metadata owned by " + appliesTo + " not found"));
- }
-
- @PreAuthorize("hasRole('" + AMEntitlement.SAML2_IDP_METADATA_SET + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public SAML2IdPMetadataTO set(final SAML2IdPMetadataTO saml2IdPMetadataTO) {
- SAML2IdPMetadata saml2IdPMetadata = saml2IdPMetadataDAO.findByOwner(saml2IdPMetadataTO.getAppliesTo());
- if (saml2IdPMetadata == null) {
- return binder.getSAML2IdPMetadataTO(saml2IdPMetadataDAO.save(binder.create(saml2IdPMetadataTO)));
- }
- throw new DuplicateException("SAML 2.0 IdP metadata for " + saml2IdPMetadataTO.getAppliesTo());
- }
-
- @Override
- protected SAML2IdPMetadataTO resolveReference(final Method method, final Object... args)
- throws UnresolvedReferenceException {
-
- String appliesTo = null;
-
- if (ArrayUtils.isNotEmpty(args)) {
- for (int i = 0; appliesTo == null && i < args.length; i++) {
- if (args[i] instanceof String) {
- appliesTo = (String) args[i];
- } else if (args[i] instanceof SAML2IdPMetadataTO) {
- appliesTo = ((SAML2IdPMetadataTO) args[i]).getAppliesTo();
- }
- }
- }
-
- if (appliesTo != null) {
- try {
- return binder.getSAML2IdPMetadataTO(saml2IdPMetadataDAO.findByOwner(appliesTo));
- } catch (Throwable ignore) {
- LOG.debug("Unresolved reference", ignore);
- throw new UnresolvedReferenceException(ignore);
- }
- }
-
- throw new UnresolvedReferenceException();
- }
-}
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPKeystoreLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPEntityLogic.java
similarity index 51%
rename from core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPKeystoreLogic.java
rename to core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPEntityLogic.java
index b8aaa5b..a3f5e81 100644
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPKeystoreLogic.java
+++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPEntityLogic.java
@@ -18,78 +18,85 @@
*/
package org.apache.syncope.core.logic;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.SAML2SPKeystoreTO;
+import org.apache.syncope.common.lib.to.SAML2SPEntityTO;
import org.apache.syncope.common.lib.types.AMEntitlement;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPKeystoreDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPKeystore;
-import org.apache.syncope.core.provisioning.api.data.SAML2SPKeystoreBinder;
+import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPEntityDAO;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPEntity;
+import org.apache.syncope.core.provisioning.api.data.SAML2SPEntityDataBinder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-import java.lang.reflect.Method;
-import java.util.Optional;
-
@Component
-public class SAML2SPKeystoreLogic extends AbstractTransactionalLogic<SAML2SPKeystoreTO> {
+public class SAML2SPEntityLogic extends AbstractTransactionalLogic<SAML2SPEntityTO> {
@Autowired
- private SAML2SPKeystoreBinder binder;
+ private SAML2SPEntityDataBinder binder;
@Autowired
- private SAML2SPKeystoreDAO saml2SPKeystoreDAO;
+ private SAML2SPEntityDAO entityDAO;
- @PreAuthorize("hasRole('" + AMEntitlement.SAML2_SP_KEYSTORE_READ + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
+ @PreAuthorize("hasRole('" + AMEntitlement.SAML2_SP_ENTITY_LIST + "')")
@Transactional(readOnly = true)
- public SAML2SPKeystoreTO read(final String key) {
- return Optional.ofNullable(saml2SPKeystoreDAO.find(key)).
- map(binder::getSAML2SPKeystoreTO).
- orElseThrow(() -> new NotFoundException(key + " not found"));
+ public List<SAML2SPEntityTO> list() {
+ return entityDAO.findAll().stream().
+ map(binder::getSAML2SPEntityTO).
+ collect(Collectors.toList());
}
- @PreAuthorize("hasRole('" + AMEntitlement.SAML2_SP_KEYSTORE_READ + "') "
+ @PreAuthorize("hasRole('" + AMEntitlement.SAML2_SP_ENTITY_GET + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
@Transactional(readOnly = true)
- public SAML2SPKeystoreTO get(final String name) {
- return Optional.ofNullable(saml2SPKeystoreDAO.findByOwner(name)).
- map(binder::getSAML2SPKeystoreTO).
- orElseThrow(() -> new NotFoundException("SAML2 SP keystore owned by " + name + " not found"));
+ public SAML2SPEntityTO read(final String key) {
+ return Optional.ofNullable(entityDAO.find(key)).
+ map(binder::getSAML2SPEntityTO).
+ orElseThrow(() -> new NotFoundException(key + " not found"));
}
- @PreAuthorize("hasRole('" + AMEntitlement.SAML2_SP_KEYSTORE_SET + "') "
+ @PreAuthorize("hasRole('" + AMEntitlement.SAML2_SP_ENTITY_SET + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public SAML2SPKeystoreTO set(final SAML2SPKeystoreTO keystoreTO) {
- SAML2SPKeystore keystore = saml2SPKeystoreDAO.findByOwner(keystoreTO.getOwner());
- if (keystore == null) {
- return binder.getSAML2SPKeystoreTO(saml2SPKeystoreDAO.save(binder.create(keystoreTO)));
- }
- throw SyncopeClientException.build(ClientExceptionType.EntityExists);
+ public SAML2SPEntityTO set(final SAML2SPEntityTO entityTO) {
+ SAML2SPEntity entity = Optional.ofNullable(entityDAO.find(entityTO.getKey())).
+ map(metadata -> binder.update(metadata, entityTO)).
+ orElseGet(() -> binder.create(entityTO));
+ return binder.getSAML2SPEntityTO(entityDAO.save(entity));
+ }
+
+ @PreAuthorize("hasRole('" + AMEntitlement.SAML2_SP_ENTITY_DELETE + "')")
+ public void delete(final String key) {
+ Optional.ofNullable(entityDAO.find(key)).ifPresentOrElse(
+ entityDAO::delete,
+ () -> {
+ throw new NotFoundException(key + " not found");
+ });
}
@Override
- protected SAML2SPKeystoreTO resolveReference(final Method method, final Object... args)
+ protected SAML2SPEntityTO resolveReference(final Method method, final Object... args)
throws UnresolvedReferenceException {
- String name = null;
+
+ String key = null;
if (ArrayUtils.isNotEmpty(args)) {
- for (int i = 0; name == null && i < args.length; i++) {
+ for (int i = 0; key == null && i < args.length; i++) {
if (args[i] instanceof String) {
- name = (String) args[i];
- } else if (args[i] instanceof SAML2SPKeystoreTO) {
- name = ((SAML2SPKeystoreTO) args[i]).getOwner();
+ key = (String) args[i];
+ } else if (args[i] instanceof SAML2SPEntityTO) {
+ key = ((SAML2SPEntityTO) args[i]).getKey();
}
}
}
- if (name != null) {
+ if (key != null) {
try {
- return binder.getSAML2SPKeystoreTO(saml2SPKeystoreDAO.findByOwner(name));
+ return binder.getSAML2SPEntityTO(entityDAO.find(key));
} catch (final Throwable ignore) {
LOG.debug("Unresolved reference", ignore);
throw new UnresolvedReferenceException(ignore);
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/GoogleMfaAuthAccountLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/GoogleMfaAuthAccountLogic.java
index 07e8969..a2c3540 100644
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/GoogleMfaAuthAccountLogic.java
+++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/GoogleMfaAuthAccountLogic.java
@@ -28,7 +28,6 @@ import org.apache.syncope.core.logic.AbstractAuthProfileLogic;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.auth.AuthProfile;
-import org.apache.syncope.core.spring.security.SecureRandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
@@ -40,6 +39,18 @@ public class GoogleMfaAuthAccountLogic extends AbstractAuthProfileLogic {
@Autowired
private EntityFactory entityFactory;
+ @PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_LIST_ACCOUNTS + "') "
+ + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
+ @Transactional(readOnly = true)
+ public List<GoogleMfaAuthAccount> list() {
+ return authProfileDAO.findAll().
+ stream().
+ map(AuthProfile::getGoogleMfaAuthAccounts).
+ filter(Objects::nonNull).
+ flatMap(List::stream).
+ collect(Collectors.toList());
+ }
+
@PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_DELETE_ACCOUNT + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
public void deleteFor(final String owner) {
@@ -60,11 +71,7 @@ public class GoogleMfaAuthAccountLogic extends AbstractAuthProfileLogic {
@PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_CREATE_ACCOUNT + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public String create(final String owner, final GoogleMfaAuthAccount account) {
- if (account.getKey() == null) {
- account.setKey(SecureRandomUtils.generateRandomUUID().toString());
- }
-
+ public void create(final String owner, final GoogleMfaAuthAccount account) {
AuthProfile profile = authProfileDAO.findByOwner(owner).orElseGet(() -> {
AuthProfile authProfile = entityFactory.newEntity(AuthProfile.class);
authProfile.setOwner(owner);
@@ -75,7 +82,6 @@ public class GoogleMfaAuthAccountLogic extends AbstractAuthProfileLogic {
accounts.add(account);
profile.setGoogleMfaAuthAccounts(accounts);
authProfileDAO.save(profile);
- return account.getKey();
}
@PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_UPDATE_ACCOUNT + "') "
@@ -83,8 +89,8 @@ public class GoogleMfaAuthAccountLogic extends AbstractAuthProfileLogic {
public void update(final String owner, final GoogleMfaAuthAccount account) {
AuthProfile authProfile = authProfileDAO.findByOwner(owner).
orElseThrow(() -> new NotFoundException("Could not find account for Owner " + owner));
- final List<GoogleMfaAuthAccount> accounts = authProfile.getGoogleMfaAuthAccounts();
- if (accounts.removeIf(acct -> acct.getKey().equals(account.getKey()))) {
+ List<GoogleMfaAuthAccount> accounts = authProfile.getGoogleMfaAuthAccounts();
+ if (accounts.removeIf(acct -> acct.getId() == account.getId())) {
accounts.add(account);
authProfile.setGoogleMfaAuthAccounts(accounts);
authProfileDAO.save(authProfile);
@@ -93,7 +99,7 @@ public class GoogleMfaAuthAccountLogic extends AbstractAuthProfileLogic {
@PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_READ_ACCOUNT + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public List<GoogleMfaAuthAccount> readFor(final String owner) {
+ public List<GoogleMfaAuthAccount> read(final String owner) {
return authProfileDAO.findByOwner(owner).
stream().
map(AuthProfile::getGoogleMfaAuthAccounts).
@@ -106,23 +112,6 @@ public class GoogleMfaAuthAccountLogic extends AbstractAuthProfileLogic {
@PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_READ_ACCOUNT + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
@Transactional(readOnly = true)
- public GoogleMfaAuthAccount read(final String key) {
- return authProfileDAO.findAll().
- stream().
- map(AuthProfile::getGoogleMfaAuthAccounts).
- filter(Objects::nonNull).
- map(accounts -> accounts.stream().
- filter(acct -> acct.getKey().equals(key)).
- findFirst().
- orElse(null)).
- filter(Objects::nonNull).
- findFirst().
- orElse(null);
- }
-
- @PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_READ_ACCOUNT + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- @Transactional(readOnly = true)
public GoogleMfaAuthAccount read(final long id) {
return authProfileDAO.findAll().
stream().
@@ -136,33 +125,4 @@ public class GoogleMfaAuthAccountLogic extends AbstractAuthProfileLogic {
findFirst().
orElse(null);
}
-
- @PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_DELETE_ACCOUNT + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public void delete(final String key) {
- authProfileDAO.findAll().
- stream().
- filter(profile -> profile.getGoogleMfaAuthAccounts() != null
- && profile.getGoogleMfaAuthAccounts().stream().anyMatch(acct -> acct.getKey().equals(key))).
- findFirst().
- ifPresent(profile -> {
- List<GoogleMfaAuthAccount> accounts = profile.getGoogleMfaAuthAccounts();
- boolean removed = accounts.removeIf(acct -> acct.getKey().equals(key));
- if (removed) {
- authProfileDAO.save(profile);
- }
- });
- }
-
- @PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_LIST_ACCOUNTS + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- @Transactional(readOnly = true)
- public List<GoogleMfaAuthAccount> list() {
- return authProfileDAO.findAll().
- stream().
- map(AuthProfile::getGoogleMfaAuthAccounts).
- filter(Objects::nonNull).
- flatMap(List::stream).
- collect(Collectors.toList());
- }
}
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/GoogleMfaAuthTokenLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/GoogleMfaAuthTokenLogic.java
index 3a7812d..2c0cf78 100644
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/GoogleMfaAuthTokenLogic.java
+++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/GoogleMfaAuthTokenLogic.java
@@ -29,7 +29,6 @@ import org.apache.syncope.core.logic.AbstractAuthProfileLogic;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.auth.AuthProfile;
-import org.apache.syncope.core.spring.security.SecureRandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
@@ -57,7 +56,7 @@ public class GoogleMfaAuthTokenLogic extends AbstractAuthProfileLogic {
@PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_DELETE_TOKEN + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public void deleteFor(final String owner) {
+ public void delete(final String owner) {
authProfileDAO.findByOwner(owner).ifPresent(profile -> {
profile.setGoogleMfaAuthTokens(List.of());
authProfileDAO.save(profile);
@@ -82,11 +81,7 @@ public class GoogleMfaAuthTokenLogic extends AbstractAuthProfileLogic {
@PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_STORE_TOKEN + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public String store(final String owner, final GoogleMfaAuthToken token) {
- if (token.getKey() == null) {
- token.setKey(SecureRandomUtils.generateRandomUUID().toString());
- }
-
+ public void store(final String owner, final GoogleMfaAuthToken token) {
AuthProfile profile = authProfileDAO.findByOwner(owner).orElseGet(() -> {
AuthProfile authProfile = entityFactory.newEntity(AuthProfile.class);
authProfile.setOwner(owner);
@@ -97,13 +92,12 @@ public class GoogleMfaAuthTokenLogic extends AbstractAuthProfileLogic {
tokens.add(token);
profile.setGoogleMfaAuthTokens(tokens);
authProfileDAO.save(profile);
- return token.getKey();
}
@PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_READ_TOKEN + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
@Transactional(readOnly = true)
- public GoogleMfaAuthToken readFor(final String owner, final int otp) {
+ public GoogleMfaAuthToken read(final String owner, final int otp) {
return authProfileDAO.findByOwner(owner).
stream().
map(AuthProfile::getGoogleMfaAuthTokens).
@@ -113,19 +107,6 @@ public class GoogleMfaAuthTokenLogic extends AbstractAuthProfileLogic {
orElseThrow(() -> new NotFoundException("Could not find token for Owner " + owner + " and otp " + otp));
}
- @PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_READ_TOKEN + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- @Transactional(readOnly = true)
- public GoogleMfaAuthToken read(final String key) {
- return authProfileDAO.findAll().
- stream().
- map(AuthProfile::getGoogleMfaAuthTokens).
- flatMap(List::stream).
- filter(token -> token.getKey().equals(key)).
- findFirst().
- orElseThrow(() -> new NotFoundException("Could not find token for " + key));
- }
-
@PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_LIST_TOKENS + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
@Transactional(readOnly = true)
@@ -139,7 +120,7 @@ public class GoogleMfaAuthTokenLogic extends AbstractAuthProfileLogic {
@PreAuthorize("hasRole('" + AMEntitlement.GOOGLE_MFA_READ_TOKEN + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
@Transactional(readOnly = true)
- public List<GoogleMfaAuthToken> readFor(final String owner) {
+ public List<GoogleMfaAuthToken> read(final String owner) {
return authProfileDAO.findByOwner(owner).
map(AuthProfile::getGoogleMfaAuthTokens).
orElse(List.of());
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/ImpersonationLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/ImpersonationLogic.java
index 77839a2..6fd2d02 100644
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/ImpersonationLogic.java
+++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/ImpersonationLogic.java
@@ -16,12 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.syncope.core.logic.wa;
-import org.apache.syncope.common.lib.SyncopeClientException;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.syncope.common.lib.types.AMEntitlement;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.types.IdRepoEntitlement;
import org.apache.syncope.common.lib.wa.ImpersonationAccount;
import org.apache.syncope.core.logic.AbstractAuthProfileLogic;
@@ -30,9 +29,7 @@ import org.apache.syncope.core.persistence.api.entity.auth.AuthProfile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-import java.util.List;
+import org.springframework.transaction.annotation.Transactional;
@Component
public class ImpersonationLogic extends AbstractAuthProfileLogic {
@@ -41,65 +38,38 @@ public class ImpersonationLogic extends AbstractAuthProfileLogic {
private EntityFactory entityFactory;
@PreAuthorize("hasRole('" + AMEntitlement.IMPERSONATION_READ_ACCOUNT + "')"
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public List<ImpersonationAccount> findByOwner(final String owner) {
+ + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
+ @Transactional(readOnly = true)
+ public List<ImpersonationAccount> read(final String owner) {
return authProfileDAO.findByOwner(owner).map(AuthProfile::getImpersonationAccounts).orElse(List.of());
}
- @PreAuthorize("hasRole('" + AMEntitlement.IMPERSONATION_READ_ACCOUNT + "')"
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public ImpersonationAccount find(final String owner, final String id) {
- return authProfileDAO.findByOwner(owner)
- .map(AuthProfile::getImpersonationAccounts)
- .stream()
- .flatMap(List::stream)
- .filter(acct -> acct.getKey().equalsIgnoreCase(id))
- .findFirst()
- .orElseThrow(() -> {
- SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.DelegatedAdministration);
- sce.getElements().add(owner + " is not authorized to impersonate " + id);
- throw sce;
- });
- }
-
@PreAuthorize("hasRole('" + AMEntitlement.IMPERSONATION_CREATE_ACCOUNT + "')"
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public String create(final ImpersonationAccount account) {
- AuthProfile profile = authProfileDAO.findByOwner(account.getOwner()).orElseGet(() -> {
+ + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
+ public void create(final String owner, final ImpersonationAccount account) {
+ AuthProfile profile = authProfileDAO.findByOwner(owner).orElseGet(() -> {
AuthProfile authProfile = entityFactory.newEntity(AuthProfile.class);
- authProfile.setOwner(account.getOwner());
+ authProfile.setOwner(owner);
return authProfile;
});
- if (profile.getImpersonationAccounts()
- .stream()
- .noneMatch(acct -> acct.getKey().equalsIgnoreCase(account.getKey()))) {
- final List<ImpersonationAccount> accounts = new ArrayList<>(profile.getImpersonationAccounts());
+ if (profile.getImpersonationAccounts().stream().
+ noneMatch(acct -> acct.getImpersonated().equalsIgnoreCase(account.getImpersonated()))) {
+
+ List<ImpersonationAccount> accounts = new ArrayList<>(profile.getImpersonationAccounts());
accounts.add(account);
profile.setImpersonationAccounts(accounts);
}
- return authProfileDAO.save(profile).getKey();
- }
- @PreAuthorize("hasRole('" + AMEntitlement.IMPERSONATION_UPDATE_ACCOUNT + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public void update(final ImpersonationAccount account) {
- authProfileDAO.findByOwner(account.getOwner()).ifPresent(profile -> {
- List<ImpersonationAccount> accounts = profile.getImpersonationAccounts();
- if (accounts.removeIf(acct -> acct.getKey().equals(account.getKey()))) {
- accounts.add(account);
- profile.setImpersonationAccounts(accounts);
- authProfileDAO.save(profile);
- }
- });
+ authProfileDAO.save(profile);
}
@PreAuthorize("hasRole('" + AMEntitlement.IMPERSONATION_DELETE_ACCOUNT + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public void delete(final ImpersonationAccount account) {
- authProfileDAO.findByOwner(account.getOwner()).ifPresent(profile -> {
+ + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
+ public void delete(final String owner, final String impersonated) {
+ authProfileDAO.findByOwner(owner).ifPresent(profile -> {
List<ImpersonationAccount> accounts = profile.getImpersonationAccounts();
- if (accounts.removeIf(acct -> acct.getKey().equalsIgnoreCase(account.getKey()))) {
+ if (accounts.removeIf(acct -> acct.getImpersonated().equalsIgnoreCase(impersonated))) {
profile.setImpersonationAccounts(accounts);
authProfileDAO.save(profile);
}
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/U2FRegistrationLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/U2FRegistrationLogic.java
index cf7a0c4..a2e6318 100644
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/U2FRegistrationLogic.java
+++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/U2FRegistrationLogic.java
@@ -23,7 +23,6 @@ import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
-import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.CompareToBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.tuple.Pair;
@@ -34,11 +33,9 @@ import org.apache.syncope.core.logic.AbstractAuthProfileLogic;
import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.auth.AuthProfile;
-import org.apache.syncope.core.spring.security.SecureRandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
@Component
public class U2FRegistrationLogic extends AbstractAuthProfileLogic {
@@ -48,11 +45,7 @@ public class U2FRegistrationLogic extends AbstractAuthProfileLogic {
@PreAuthorize("hasRole('" + AMEntitlement.U2F_CREATE_DEVICE + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public String create(final String owner, final U2FDevice device) {
- if (device.getKey() == null) {
- device.setKey(SecureRandomUtils.generateRandomUUID().toString());
- }
-
+ public void create(final String owner, final U2FDevice device) {
AuthProfile profile = authProfileDAO.findByOwner(owner).orElseGet(() -> {
AuthProfile authProfile = entityFactory.newEntity(AuthProfile.class);
authProfile.setOwner(owner);
@@ -63,33 +56,16 @@ public class U2FRegistrationLogic extends AbstractAuthProfileLogic {
devices.add(device);
profile.setU2FRegisteredDevices(devices);
authProfileDAO.save(profile);
- return device.getKey();
- }
-
- @PreAuthorize("hasRole('" + AMEntitlement.U2F_READ_DEVICE + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- @Transactional(readOnly = true)
- public U2FDevice read(final String key) {
- return authProfileDAO.findAll().
- stream().
- map(AuthProfile::getU2FRegisteredDevices).
- filter(Objects::nonNull).
- flatMap(List::stream).
- filter(record -> record.getKey().equals(key)).
- findFirst().
- orElse(null);
}
@PreAuthorize("hasRole('" + AMEntitlement.U2F_DELETE_DEVICE + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public void delete(final String entityKey, final Long id, final Date expirationDate) {
+ public void delete(final Long id, final Date expirationDate) {
List<AuthProfile> profiles = authProfileDAO.findAll();
profiles.forEach(profile -> {
List<U2FDevice> devices = profile.getU2FRegisteredDevices();
if (devices != null) {
- if (StringUtils.isNotBlank(entityKey)) {
- devices.removeIf(device -> device.getKey().equals(entityKey));
- } else if (id != null) {
+ if (id != null) {
devices.removeIf(device -> device.getId() == id);
} else if (expirationDate != null) {
devices.removeIf(device -> device.getIssueDate().compareTo(expirationDate) < 0);
@@ -104,10 +80,12 @@ public class U2FRegistrationLogic extends AbstractAuthProfileLogic {
@PreAuthorize("hasRole('" + AMEntitlement.U2F_SEARCH_DEVICES + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public Pair<Integer, List<U2FDevice>> search(final String entityKey, final Integer page,
+ public Pair<Integer, List<U2FDevice>> search(
+ final Integer page,
final Integer itemsPerPage, final Long id,
final Date expirationDate,
final List<OrderByClause> orderByClauses) {
+
List<Comparator<U2FDevice>> comparatorList = orderByClauses.
stream().
map(orderByClause -> {
@@ -116,10 +94,6 @@ public class U2FRegistrationLogic extends AbstractAuthProfileLogic {
comparator = (o1, o2) -> new CompareToBuilder().
append(o1.getId(), o2.getId()).toComparison();
}
- if (orderByClause.getField().equals("key")) {
- comparator = (o1, o2) -> new CompareToBuilder().
- append(o1.getKey(), o2.getKey()).toComparison();
- }
if (orderByClause.getField().equals("issueDate")) {
comparator = (o1, o2) -> new CompareToBuilder().
append(o1.getIssueDate(), o2.getIssueDate()).toComparison();
@@ -146,9 +120,6 @@ public class U2FRegistrationLogic extends AbstractAuthProfileLogic {
flatMap(List::stream).
filter(device -> {
EqualsBuilder builder = new EqualsBuilder();
- if (StringUtils.isNotBlank(entityKey)) {
- builder.append(entityKey, device.getKey());
- }
if (id != null) {
builder.append(id, (Long) device.getId());
}
@@ -176,17 +147,4 @@ public class U2FRegistrationLogic extends AbstractAuthProfileLogic {
.collect(Collectors.toList());
return Pair.of(devices.size(), result);
}
-
- @PreAuthorize("hasRole('" + AMEntitlement.U2F_UPDATE_DEVICE + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public void update(final U2FDevice device) {
- authProfileDAO.findAll().forEach(profile -> {
- List<U2FDevice> devices = profile.getU2FRegisteredDevices();
- if (devices.removeIf(d -> d.getKey().equals(device.getKey()))) {
- devices.add(device);
- profile.setU2FRegisteredDevices(devices);
- authProfileDAO.save(profile);
- }
- });
- }
}
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WAClientAppLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WAClientAppLogic.java
index 65d2561..64c8d76 100644
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WAClientAppLogic.java
+++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WAClientAppLogic.java
@@ -29,14 +29,14 @@ import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.dao.auth.CASSPDAO;
import org.apache.syncope.core.persistence.api.dao.auth.OIDCRPDAO;
import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.CASSP;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SP;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.apache.syncope.core.provisioning.api.data.wa.WAClientAppDataBinder;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.CASSPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.OIDCRPClientApp;
@Component
public class WAClientAppLogic {
@@ -85,21 +85,21 @@ public class WAClientAppLogic {
switch (type) {
case OIDCRP:
- OIDCRP oidcrp = oidcrpDAO.findByClientAppId(clientAppId);
+ OIDCRPClientApp oidcrp = oidcrpDAO.findByClientAppId(clientAppId);
if (oidcrp != null) {
clientApp = binder.getWAClientApp(oidcrp);
}
break;
case SAML2SP:
- SAML2SP saml2sp = saml2spDAO.findByClientAppId(clientAppId);
+ SAML2SPClientApp saml2sp = saml2spDAO.findByClientAppId(clientAppId);
if (saml2sp != null) {
clientApp = binder.getWAClientApp(saml2sp);
}
break;
case CASSP:
- CASSP cassp = casspDAO.findByClientAppId(clientAppId);
+ CASSPClientApp cassp = casspDAO.findByClientAppId(clientAppId);
if (cassp != null) {
clientApp = binder.getWAClientApp(cassp);
}
@@ -135,21 +135,21 @@ public class WAClientAppLogic {
switch (type) {
case OIDCRP:
- OIDCRP oidcrp = oidcrpDAO.findByName(name);
+ OIDCRPClientApp oidcrp = oidcrpDAO.findByName(name);
if (oidcrp != null) {
clientApp = binder.getWAClientApp(oidcrp);
}
break;
case SAML2SP:
- SAML2SP saml2sp = saml2spDAO.findByName(name);
+ SAML2SPClientApp saml2sp = saml2spDAO.findByName(name);
if (saml2sp != null) {
clientApp = binder.getWAClientApp(saml2sp);
}
break;
case CASSP:
- CASSP cassp = casspDAO.findByName(name);
+ CASSPClientApp cassp = casspDAO.findByName(name);
if (cassp != null) {
clientApp = binder.getWAClientApp(cassp);
}
diff --git a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WebAuthnRegistrationLogic.java b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WebAuthnRegistrationLogic.java
index 63667fb..5e6469f 100644
--- a/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WebAuthnRegistrationLogic.java
+++ b/core/am/logic/src/main/java/org/apache/syncope/core/logic/wa/WebAuthnRegistrationLogic.java
@@ -28,7 +28,6 @@ import org.apache.syncope.core.logic.AbstractAuthProfileLogic;
import org.apache.syncope.core.persistence.api.dao.NotFoundException;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.auth.AuthProfile;
-import org.apache.syncope.core.spring.security.SecureRandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
@@ -40,18 +39,6 @@ public class WebAuthnRegistrationLogic extends AbstractAuthProfileLogic {
@Autowired
private EntityFactory entityFactory;
- @PreAuthorize("hasRole('" + AMEntitlement.WEBAUTHN_READ_DEVICE + "') "
- + "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- @Transactional(readOnly = true)
- public WebAuthnAccount read(final String key) {
- return authProfileDAO.findAll().
- stream().
- map(AuthProfile::getWebAuthnAccount).
- filter(record -> record.getKey().equals(key)).
- findFirst().
- orElseThrow(() -> new NotFoundException("Could not find account with key " + key));
- }
-
@PreAuthorize("hasRole('" + AMEntitlement.WEBAUTHN_LIST_DEVICE + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
@Transactional(readOnly = true)
@@ -64,7 +51,7 @@ public class WebAuthnRegistrationLogic extends AbstractAuthProfileLogic {
@PreAuthorize("hasRole('" + AMEntitlement.WEBAUTHN_READ_DEVICE + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
@Transactional(readOnly = true)
- public WebAuthnAccount findAccountBy(final String owner) {
+ public WebAuthnAccount read(final String owner) {
return authProfileDAO.findByOwner(owner).
stream().
map(AuthProfile::getWebAuthnAccount).
@@ -99,11 +86,7 @@ public class WebAuthnRegistrationLogic extends AbstractAuthProfileLogic {
@PreAuthorize("hasRole('" + AMEntitlement.WEBAUTHN_CREATE_DEVICE + "') "
+ "or hasRole('" + IdRepoEntitlement.ANONYMOUS + "')")
- public WebAuthnAccount create(final String owner, final WebAuthnAccount account) {
- if (account.getKey() == null) {
- account.setKey(SecureRandomUtils.generateRandomUUID().toString());
- }
-
+ public void create(final String owner, final WebAuthnAccount account) {
AuthProfile profile = authProfileDAO.findByOwner(owner).orElseGet(() -> {
AuthProfile authProfile = entityFactory.newEntity(AuthProfile.class);
authProfile.setOwner(owner);
@@ -111,7 +94,6 @@ public class WebAuthnRegistrationLogic extends AbstractAuthProfileLogic {
});
profile.setWebAuthnAccount(account);
authProfileDAO.save(profile);
- return profile.getWebAuthnAccount();
}
@PreAuthorize("hasRole('" + AMEntitlement.WEBAUTHN_UPDATE_DEVICE + "') "
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/OIDCJWKSServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/OIDCJWKSServiceImpl.java
index dceca86..81aee2c 100644
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/OIDCJWKSServiceImpl.java
+++ b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/OIDCJWKSServiceImpl.java
@@ -35,8 +35,8 @@ public class OIDCJWKSServiceImpl extends AbstractServiceImpl implements OIDCJWKS
private OIDCJWKSLogic logic;
@Override
- public OIDCJWKSTO get() {
- return logic.get();
+ public OIDCJWKSTO read() {
+ return logic.read();
}
@Override
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2SPMetadataServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2IdPEntityServiceImpl.java
similarity index 51%
rename from core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2SPMetadataServiceImpl.java
rename to core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2IdPEntityServiceImpl.java
index bbe775b..6fe5bb7 100644
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2SPMetadataServiceImpl.java
+++ b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2IdPEntityServiceImpl.java
@@ -18,37 +18,31 @@
*/
package org.apache.syncope.core.rest.cxf.service;
-import java.net.URI;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.SAML2SPMetadataTO;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.core.logic.SAML2SPMetadataLogic;
+import java.util.List;
+import org.apache.syncope.common.lib.to.SAML2IdPEntityTO;
+import org.apache.syncope.core.logic.SAML2IdPEntityLogic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import org.apache.syncope.common.rest.api.service.SAML2SPMetadataService;
+import org.apache.syncope.common.rest.api.service.SAML2IdPEntityService;
@Service
-public class SAML2SPMetadataServiceImpl extends AbstractServiceImpl implements SAML2SPMetadataService {
+public class SAML2IdPEntityServiceImpl extends AbstractServiceImpl implements SAML2IdPEntityService {
@Autowired
- private SAML2SPMetadataLogic logic;
+ private SAML2IdPEntityLogic logic;
@Override
- public SAML2SPMetadataTO readFor(final String name) {
- return logic.readFor(name);
+ public List<SAML2IdPEntityTO> list() {
+ return logic.list();
}
@Override
- public SAML2SPMetadataTO read(final String key) {
- return logic.read(key);
+ public SAML2IdPEntityTO get(final String key) {
+ return logic.get(key);
}
@Override
- public Response set(final SAML2SPMetadataTO metadataTO) {
- SAML2SPMetadataTO spMetadata = logic.set(metadataTO);
- URI location = uriInfo.getAbsolutePathBuilder().path(spMetadata.getKey()).build();
- return Response.created(location).
- header(RESTHeaders.RESOURCE_KEY, spMetadata.getKey()).
- build();
+ public void set(final SAML2IdPEntityTO entityTO) {
+ logic.set(entityTO);
}
}
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2IdPMetadataServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2IdPMetadataServiceImpl.java
deleted file mode 100644
index 285b0ad..0000000
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2IdPMetadataServiceImpl.java
+++ /dev/null
@@ -1,54 +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 java.net.URI;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.SAML2IdPMetadataTO;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.core.logic.SAML2IdPMetadataLogic;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.apache.syncope.common.rest.api.service.SAML2IdPMetadataService;
-
-@Service
-public class SAML2IdPMetadataServiceImpl extends AbstractServiceImpl implements SAML2IdPMetadataService {
-
- @Autowired
- private SAML2IdPMetadataLogic logic;
-
- @Override
- public SAML2IdPMetadataTO readFor(final String appliesTo) {
- return logic.readFor(appliesTo);
- }
-
- @Override
- public SAML2IdPMetadataTO read(final String key) {
- return logic.read(key);
- }
-
- @Override
- public Response set(final SAML2IdPMetadataTO saml2IdPMetadataTO) {
- SAML2IdPMetadataTO saml2IdPMetadata = logic.set(saml2IdPMetadataTO);
- URI location = uriInfo.getAbsolutePathBuilder().path(saml2IdPMetadata.getKey()).build();
- return Response.created(location).
- header(RESTHeaders.RESOURCE_KEY, saml2IdPMetadata.getKey()).
- build();
- }
-}
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2SPKeystoreServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2SPEntityServiceImpl.java
similarity index 53%
rename from core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2SPKeystoreServiceImpl.java
rename to core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2SPEntityServiceImpl.java
index 0e68a67..94217d2 100644
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2SPKeystoreServiceImpl.java
+++ b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SAML2SPEntityServiceImpl.java
@@ -18,37 +18,36 @@
*/
package org.apache.syncope.core.rest.cxf.service;
-import java.net.URI;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.SAML2SPKeystoreTO;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.core.logic.SAML2SPKeystoreLogic;
+import java.util.List;
+import org.apache.syncope.common.lib.to.SAML2SPEntityTO;
+import org.apache.syncope.core.logic.SAML2SPEntityLogic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import org.apache.syncope.common.rest.api.service.SAML2SPKeystoreService;
+import org.apache.syncope.common.rest.api.service.SAML2SPEntityService;
@Service
-public class SAML2SPKeystoreServiceImpl extends AbstractServiceImpl implements SAML2SPKeystoreService {
+public class SAML2SPEntityServiceImpl extends AbstractServiceImpl implements SAML2SPEntityService {
@Autowired
- private SAML2SPKeystoreLogic logic;
+ private SAML2SPEntityLogic logic;
@Override
- public SAML2SPKeystoreTO readFor(final String name) {
- return logic.get(name);
+ public List<SAML2SPEntityTO> list() {
+ return logic.list();
}
@Override
- public SAML2SPKeystoreTO read(final String key) {
+ public SAML2SPEntityTO get(final String key) {
return logic.read(key);
}
@Override
- public Response set(final SAML2SPKeystoreTO keystoreTO) {
- SAML2SPKeystoreTO keystore = logic.set(keystoreTO);
- URI location = uriInfo.getAbsolutePathBuilder().path(keystore.getKey()).build();
- return Response.created(location).
- header(RESTHeaders.RESOURCE_KEY, keystore.getKey()).
- build();
+ public void set(final SAML2SPEntityTO entityTO) {
+ logic.set(entityTO);
+ }
+
+ @Override
+ public void delete(final String key) {
+ logic.delete(key);
}
}
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/GoogleMfaAuthAccountServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/GoogleMfaAuthAccountServiceImpl.java
index e16da6f..a3d32ce 100644
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/GoogleMfaAuthAccountServiceImpl.java
+++ b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/GoogleMfaAuthAccountServiceImpl.java
@@ -18,12 +18,9 @@
*/
package org.apache.syncope.core.rest.cxf.service.wa;
-import java.net.URI;
import java.util.List;
-import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.wa.GoogleMfaAuthAccount;
-import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.wa.GoogleMfaAuthAccountService;
import org.apache.syncope.core.logic.wa.GoogleMfaAuthAccountLogic;
import org.apache.syncope.core.rest.cxf.service.AbstractServiceImpl;
@@ -37,27 +34,18 @@ public class GoogleMfaAuthAccountServiceImpl extends AbstractServiceImpl impleme
private GoogleMfaAuthAccountLogic logic;
@Override
- public void deleteFor(final String owner) {
+ public void delete(final String owner) {
logic.deleteFor(owner);
}
@Override
- public void delete(final String key) {
- logic.delete(key);
- }
-
- @Override
- public void delete() {
+ public void deleteAll() {
logic.deleteAll();
}
@Override
- public Response create(final String owner, final GoogleMfaAuthAccount acct) {
- String key = logic.create(owner, acct);
- URI location = uriInfo.getAbsolutePathBuilder().path(key).build();
- return Response.created(location).
- header(RESTHeaders.RESOURCE_KEY, key).
- build();
+ public void create(final String owner, final GoogleMfaAuthAccount acct) {
+ logic.create(owner, acct);
}
@Override
@@ -75,13 +63,8 @@ public class GoogleMfaAuthAccountServiceImpl extends AbstractServiceImpl impleme
}
@Override
- public PagedResult<GoogleMfaAuthAccount> readFor(final String owner) {
- return build(logic.readFor(owner));
- }
-
- @Override
- public GoogleMfaAuthAccount read(final String key) {
- return logic.read(key);
+ public PagedResult<GoogleMfaAuthAccount> read(final String owner) {
+ return build(logic.read(owner));
}
@Override
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/GoogleMfaAuthTokenServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/GoogleMfaAuthTokenServiceImpl.java
index da5375c..f4ce58d 100644
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/GoogleMfaAuthTokenServiceImpl.java
+++ b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/GoogleMfaAuthTokenServiceImpl.java
@@ -49,8 +49,8 @@ public class GoogleMfaAuthTokenServiceImpl extends AbstractServiceImpl implement
}
@Override
- public void deleteFor(final String owner) {
- logic.deleteFor(owner);
+ public void delete(final String owner) {
+ logic.delete(owner);
}
@Override
@@ -64,8 +64,8 @@ public class GoogleMfaAuthTokenServiceImpl extends AbstractServiceImpl implement
}
@Override
- public GoogleMfaAuthToken readFor(final String owner, final int otp) {
- return logic.readFor(owner, otp);
+ public GoogleMfaAuthToken read(final String owner, final int otp) {
+ return logic.read(owner, otp);
}
private PagedResult<GoogleMfaAuthToken> build(final List<GoogleMfaAuthToken> read) {
@@ -78,13 +78,8 @@ public class GoogleMfaAuthTokenServiceImpl extends AbstractServiceImpl implement
}
@Override
- public PagedResult<GoogleMfaAuthToken> readFor(final String owner) {
- return build(logic.readFor(owner));
- }
-
- @Override
- public GoogleMfaAuthToken read(final String key) {
- return logic.read(key);
+ public PagedResult<GoogleMfaAuthToken> read(final String owner) {
+ return build(logic.read(owner));
}
@Override
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/ImpersonationServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/ImpersonationServiceImpl.java
index 1d79c77..2feb8b8 100644
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/ImpersonationServiceImpl.java
+++ b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/ImpersonationServiceImpl.java
@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.syncope.core.rest.cxf.service.wa;
+import java.util.List;
import org.apache.syncope.common.lib.wa.ImpersonationAccount;
import org.apache.syncope.common.rest.api.service.wa.ImpersonationService;
import org.apache.syncope.core.logic.wa.ImpersonationLogic;
@@ -26,11 +26,6 @@ import org.apache.syncope.core.rest.cxf.service.AbstractServiceImpl;
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.List;
-
@Service
public class ImpersonationServiceImpl extends AbstractServiceImpl implements ImpersonationService {
@@ -38,31 +33,17 @@ public class ImpersonationServiceImpl extends AbstractServiceImpl implements Imp
private ImpersonationLogic logic;
@Override
- public List<ImpersonationAccount> findByOwner(final String owner) {
- return logic.findByOwner(owner);
- }
-
- @Override
- public ImpersonationAccount find(final String owner,
- final String id) {
- return logic.find(owner, id);
- }
-
- @Override
- public Response create(final ImpersonationAccount account) {
- logic.create(account);
- URI location = uriInfo.getAbsolutePathBuilder().build();
- return Response.created(location).build();
+ public List<ImpersonationAccount> read(final String owner) {
+ return logic.read(owner);
}
@Override
- public Response delete(final String owner, final String id) {
- logic.delete(logic.find(owner, id));
- return Response.noContent().build();
+ public void create(final String owner, final ImpersonationAccount account) {
+ logic.create(owner, account);
}
@Override
- public void update(final ImpersonationAccount account) {
- logic.update(account);
+ public void delete(final String owner, final String impersonated) {
+ logic.delete(owner, impersonated);
}
}
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/U2FRegistrationServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/U2FRegistrationServiceImpl.java
index 9c94e87..0a5d596 100644
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/U2FRegistrationServiceImpl.java
+++ b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/U2FRegistrationServiceImpl.java
@@ -18,13 +18,10 @@
*/
package org.apache.syncope.core.rest.cxf.service.wa;
-import java.net.URI;
import java.util.List;
-import javax.ws.rs.core.Response;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.to.PagedResult;
import org.apache.syncope.common.lib.wa.U2FDevice;
-import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.beans.U2FDeviceQuery;
import org.apache.syncope.common.rest.api.service.wa.U2FRegistrationService;
import org.apache.syncope.core.logic.wa.U2FRegistrationLogic;
@@ -39,29 +36,18 @@ public class U2FRegistrationServiceImpl extends AbstractServiceImpl implements U
private U2FRegistrationLogic logic;
@Override
- public Response delete(final U2FDeviceQuery query) {
- logic.delete(query.getEntityKey(), query.getId(), query.getExpirationDate());
- return Response.noContent().build();
+ public void delete(final U2FDeviceQuery query) {
+ logic.delete(query.getId(), query.getExpirationDate());
}
@Override
- public void update(final U2FDevice device) {
- logic.update(device);
- }
-
- @Override
- public Response create(final String owner, final U2FDevice device) {
- String key = logic.create(owner, device);
- URI location = uriInfo.getAbsolutePathBuilder().path(key).build();
- return Response.created(location).
- header(RESTHeaders.RESOURCE_KEY, key).
- build();
+ public void create(final String owner, final U2FDevice device) {
+ logic.create(owner, device);
}
@Override
public PagedResult<U2FDevice> search(final U2FDeviceQuery query) {
Pair<Integer, List<U2FDevice>> result = logic.search(
- query.getEntityKey(),
query.getPage(),
query.getSize(),
query.getId(),
@@ -69,9 +55,4 @@ public class U2FRegistrationServiceImpl extends AbstractServiceImpl implements U
getOrderByClauses(query.getOrderBy()));
return buildPagedResult(result.getRight(), query.getPage(), query.getSize(), result.getLeft());
}
-
- @Override
- public U2FDevice read(final String key) {
- return logic.read(key);
- }
}
diff --git a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/WebAuthnRegistrationServiceImpl.java b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/WebAuthnRegistrationServiceImpl.java
index acd8cb9..91105f2 100644
--- a/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/WebAuthnRegistrationServiceImpl.java
+++ b/core/am/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/wa/WebAuthnRegistrationServiceImpl.java
@@ -18,11 +18,8 @@
*/
package org.apache.syncope.core.rest.cxf.service.wa;
-import java.net.URI;
import java.util.List;
-import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.wa.WebAuthnAccount;
-import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.wa.WebAuthnRegistrationService;
import org.apache.syncope.core.logic.wa.WebAuthnRegistrationLogic;
import org.apache.syncope.core.rest.cxf.service.AbstractServiceImpl;
@@ -41,35 +38,23 @@ public class WebAuthnRegistrationServiceImpl extends AbstractServiceImpl impleme
}
@Override
- public WebAuthnAccount read(final String key) {
- return logic.read(key);
+ public WebAuthnAccount read(final String owner) {
+ return logic.read(owner);
}
@Override
- public WebAuthnAccount readFor(final String owner) {
- return logic.findAccountBy(owner);
- }
-
- @Override
- public Response delete(final String owner) {
+ public void delete(final String owner) {
logic.delete(owner);
- return Response.noContent().build();
}
@Override
- public Response delete(final String owner, final String credentialId) {
+ public void delete(final String owner, final String credentialId) {
logic.delete(owner, credentialId);
- return Response.noContent().build();
}
@Override
- public Response create(final String owner, final WebAuthnAccount account) {
- WebAuthnAccount token = logic.create(owner, account);
- URI location = uriInfo.getAbsolutePathBuilder().path(token.getKey()).build();
- return Response.created(location).
- header(RESTHeaders.RESOURCE_KEY, token.getKey()).
- entity(token).
- build();
+ public void create(final String owner, final WebAuthnAccount account) {
+ logic.create(owner, account);
}
@Override
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/CASSPDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/CASSPDAO.java
index 5c179bd..5f44953 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/CASSPDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/CASSPDAO.java
@@ -19,23 +19,23 @@
package org.apache.syncope.core.persistence.api.dao.auth;
import org.apache.syncope.core.persistence.api.dao.DAO;
-import org.apache.syncope.core.persistence.api.entity.auth.CASSP;
import java.util.List;
+import org.apache.syncope.core.persistence.api.entity.auth.CASSPClientApp;
-public interface CASSPDAO extends DAO<CASSP> {
+public interface CASSPDAO extends DAO<CASSPClientApp> {
- CASSP find(String key);
+ CASSPClientApp find(String key);
- CASSP findByClientAppId(Long clientAppId);
+ CASSPClientApp findByClientAppId(Long clientAppId);
- CASSP findByName(String name);
+ CASSPClientApp findByName(String name);
- List<CASSP> findAll();
+ List<CASSPClientApp> findAll();
- CASSP save(CASSP clientApp);
+ CASSPClientApp save(CASSPClientApp clientApp);
void delete(String key);
- void delete(CASSP clientApp);
+ void delete(CASSPClientApp clientApp);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/OIDCRPDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/OIDCRPDAO.java
index 517c92b..412c6da 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/OIDCRPDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/OIDCRPDAO.java
@@ -21,25 +21,25 @@ package org.apache.syncope.core.persistence.api.dao.auth;
import org.apache.syncope.core.persistence.api.dao.DAO;
import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
+import org.apache.syncope.core.persistence.api.entity.auth.OIDCRPClientApp;
-public interface OIDCRPDAO extends DAO<OIDCRP> {
+public interface OIDCRPDAO extends DAO<OIDCRPClientApp> {
- OIDCRP find(String key);
+ OIDCRPClientApp find(String key);
- OIDCRP findByClientAppId(Long clientAppId);
+ OIDCRPClientApp findByClientAppId(Long clientAppId);
- OIDCRP findByName(String name);
+ OIDCRPClientApp findByName(String name);
- OIDCRP findByClientId(String clientId);
+ OIDCRPClientApp findByClientId(String clientId);
- List<OIDCRP> findAll();
+ List<OIDCRPClientApp> findAll();
- OIDCRP save(OIDCRP clientApp);
+ OIDCRPClientApp save(OIDCRPClientApp clientApp);
void delete(String key);
void deleteByClientId(String clientId);
- void delete(OIDCRP clientApp);
+ void delete(OIDCRPClientApp clientApp);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPKeystoreDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2IdPEntityDAO.java
similarity index 81%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPKeystoreDAO.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2IdPEntityDAO.java
index 5352a28..5b29a8f 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPKeystoreDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2IdPEntityDAO.java
@@ -18,15 +18,15 @@
*/
package org.apache.syncope.core.persistence.api.dao.auth;
+import java.util.List;
import org.apache.syncope.core.persistence.api.dao.DAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPKeystore;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPEntity;
-public interface SAML2SPKeystoreDAO extends DAO<SAML2SPKeystore> {
+public interface SAML2IdPEntityDAO extends DAO<SAML2IdPEntity> {
- SAML2SPKeystore find(String key);
+ List<SAML2IdPEntity> findAll();
- SAML2SPKeystore findByOwner(String name);
-
- SAML2SPKeystore save(SAML2SPKeystore keystore);
+ SAML2IdPEntity find(String key);
+ SAML2IdPEntity save(SAML2IdPEntity saml2IdPEntity);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPDAO.java
index 2d2fdbd..b173ab9 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPDAO.java
@@ -21,25 +21,25 @@ package org.apache.syncope.core.persistence.api.dao.auth;
import org.apache.syncope.core.persistence.api.dao.DAO;
import java.util.List;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SP;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPClientApp;
-public interface SAML2SPDAO extends DAO<SAML2SP> {
+public interface SAML2SPDAO extends DAO<SAML2SPClientApp> {
- SAML2SP find(String key);
+ SAML2SPClientApp find(String key);
- SAML2SP findByClientAppId(Long clientAppId);
+ SAML2SPClientApp findByClientAppId(Long clientAppId);
- SAML2SP findByName(String name);
+ SAML2SPClientApp findByName(String name);
- SAML2SP findByEntityId(String clientId);
+ SAML2SPClientApp findByEntityId(String clientId);
- List<SAML2SP> findAll();
+ List<SAML2SPClientApp> findAll();
- SAML2SP save(SAML2SP clientApp);
+ SAML2SPClientApp save(SAML2SPClientApp clientApp);
void delete(String key);
void deleteByEntityId(String entityId);
- void delete(SAML2SP clientApp);
+ void delete(SAML2SPClientApp clientApp);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2IdPMetadataDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPEntityDAO.java
similarity index 79%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2IdPMetadataDAO.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPEntityDAO.java
index b17688b..75f2652 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2IdPMetadataDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPEntityDAO.java
@@ -18,15 +18,17 @@
*/
package org.apache.syncope.core.persistence.api.dao.auth;
+import java.util.List;
import org.apache.syncope.core.persistence.api.dao.DAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPMetadata;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPEntity;
-public interface SAML2IdPMetadataDAO extends DAO<SAML2IdPMetadata> {
+public interface SAML2SPEntityDAO extends DAO<SAML2SPEntity> {
- SAML2IdPMetadata find(String key);
+ List<SAML2SPEntity> findAll();
- SAML2IdPMetadata findByOwner(String appliesTo);
+ SAML2SPEntity find(String key);
- SAML2IdPMetadata save(SAML2IdPMetadata saml2IdPMetadata);
+ SAML2SPEntity save(SAML2SPEntity entity);
+ void delete(SAML2SPEntity entity);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPMetadataDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPMetadataDAO.java
deleted file mode 100644
index ef1894f..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/auth/SAML2SPMetadataDAO.java
+++ /dev/null
@@ -1,32 +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.persistence.api.dao.auth;
-
-import org.apache.syncope.core.persistence.api.dao.DAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPMetadata;
-
-public interface SAML2SPMetadataDAO extends DAO<SAML2SPMetadata> {
-
- SAML2SPMetadata find(String key);
-
- SAML2SPMetadata findByOwner(String name);
-
- SAML2SPMetadata save(SAML2SPMetadata metadata);
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/CASSP.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/CASSPClientApp.java
similarity index 94%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/CASSP.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/CASSPClientApp.java
index 88cf6a5..f4d0e80 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/CASSP.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/CASSPClientApp.java
@@ -18,7 +18,7 @@
*/
package org.apache.syncope.core.persistence.api.entity.auth;
-public interface CASSP extends ClientApp {
+public interface CASSPClientApp extends ClientApp {
void setServiceId(String serviceId);
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/OIDCRP.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/OIDCRPClientApp.java
similarity index 96%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/OIDCRP.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/OIDCRPClientApp.java
index 74b105b..f84b907 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/OIDCRP.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/OIDCRPClientApp.java
@@ -23,7 +23,7 @@ import org.apache.syncope.common.lib.types.OIDCGrantType;
import org.apache.syncope.common.lib.types.OIDCResponseType;
import org.apache.syncope.common.lib.types.OIDCSubjectType;
-public interface OIDCRP extends ClientApp {
+public interface OIDCRPClientApp extends ClientApp {
void setClientId(String id);
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPMetadata.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2IdPEntity.java
similarity index 61%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPMetadata.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2IdPEntity.java
index 78b4c10..27c2747 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPMetadata.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2IdPEntity.java
@@ -18,15 +18,27 @@
*/
package org.apache.syncope.core.persistence.api.entity.auth;
-import org.apache.syncope.core.persistence.api.entity.Entity;
+import org.apache.syncope.core.persistence.api.entity.ProvidedKeyEntity;
-public interface SAML2SPMetadata extends Entity {
+public interface SAML2IdPEntity extends ProvidedKeyEntity {
- String getMetadata();
+ byte[] getMetadata();
- void setMetadata(String metadata);
+ void setMetadata(byte[] metadata);
- String getOwner();
+ byte[] getSigningCertificate();
- void setOwner(String owner);
+ void setSigningCertificate(byte[] signingCertificate);
+
+ byte[] getSigningKey();
+
+ void setSigningKey(byte[] signingKey);
+
+ byte[] getEncryptionCertificate();
+
+ void setEncryptionCertificate(byte[] encryptionCertificate);
+
+ byte[] getEncryptionKey();
+
+ void setEncryptionKey(byte[] encryptionKey);
}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2IdPMetadata.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2IdPMetadata.java
deleted file mode 100644
index a91eb61..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2IdPMetadata.java
+++ /dev/null
@@ -1,49 +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.persistence.api.entity.auth;
-
-import org.apache.syncope.core.persistence.api.entity.Entity;
-
-public interface SAML2IdPMetadata extends Entity {
-
- String getMetadata();
-
- void setMetadata(String metadata);
-
- String getSigningCertificate();
-
- void setSigningCertificate(String signingCertificate);
-
- String getSigningKey();
-
- void setSigningKey(String signingKey);
-
- String getEncryptionCertificate();
-
- void setEncryptionCertificate(String encryptionCertificate);
-
- String getEncryptionKey();
-
- void setEncryptionKey(String encryptionKey);
-
- String getAppliesTo();
-
- void setAppliesTo(String appliesTo);
-
-}
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SP.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPClientApp.java
similarity index 97%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SP.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPClientApp.java
index d3f2d42..5c7ee21 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SP.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPClientApp.java
@@ -23,7 +23,7 @@ import java.util.Set;
import org.apache.syncope.common.lib.types.SAML2SPNameId;
import org.apache.syncope.common.lib.types.XmlSecAlgorithm;
-public interface SAML2SP extends ClientApp {
+public interface SAML2SPClientApp extends ClientApp {
String getEntityId();
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPKeystore.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPEntity.java
similarity index 76%
rename from core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPKeystore.java
rename to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPEntity.java
index 83fe696..4bc6bd4 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPKeystore.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/auth/SAML2SPEntity.java
@@ -18,15 +18,15 @@
*/
package org.apache.syncope.core.persistence.api.entity.auth;
-import org.apache.syncope.core.persistence.api.entity.Entity;
+import org.apache.syncope.core.persistence.api.entity.ProvidedKeyEntity;
-public interface SAML2SPKeystore extends Entity {
+public interface SAML2SPEntity extends ProvidedKeyEntity {
- String getKeystore();
+ byte[] getKeystore();
- void setKeystore(String keystore);
+ void setKeystore(byte[] keystore);
- String getOwner();
+ byte[] getMetadata();
- void setOwner(String owner);
+ void setMetadata(byte[] metadata);
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPACASSPDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPACASSPDAO.java
index c59a459..630509d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPACASSPDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPACASSPDAO.java
@@ -19,9 +19,8 @@
package org.apache.syncope.core.persistence.jpa.dao.auth;
import org.apache.syncope.core.persistence.api.dao.auth.CASSPDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.CASSP;
import org.apache.syncope.core.persistence.jpa.dao.AbstractDAO;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPACASSP;
+import org.apache.syncope.core.persistence.jpa.entity.auth.JPACASSPClientApp;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@@ -29,22 +28,23 @@ import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
import java.util.List;
+import org.apache.syncope.core.persistence.api.entity.auth.CASSPClientApp;
@Repository
-public class JPACASSPDAO extends AbstractDAO<CASSP> implements CASSPDAO {
+public class JPACASSPDAO extends AbstractDAO<CASSPClientApp> implements CASSPDAO {
@Override
- public CASSP find(final String key) {
- return entityManager().find(JPACASSP.class, key);
+ public CASSPClientApp find(final String key) {
+ return entityManager().find(JPACASSPClientApp.class, key);
}
- private CASSP find(final String column, final Object value) {
- TypedQuery<CASSP> query = entityManager().createQuery(
- "SELECT e FROM " + JPACASSP.class.getSimpleName() + " e WHERE e." + column + "=:value",
- CASSP.class);
+ private CASSPClientApp find(final String column, final Object value) {
+ TypedQuery<CASSPClientApp> query = entityManager().createQuery(
+ "SELECT e FROM " + JPACASSPClientApp.class.getSimpleName() + " e WHERE e." + column + "=:value",
+ CASSPClientApp.class);
query.setParameter("value", value);
- CASSP result = null;
+ CASSPClientApp result = null;
try {
result = query.getSingleResult();
} catch (final NoResultException e) {
@@ -55,32 +55,32 @@ public class JPACASSPDAO extends AbstractDAO<CASSP> implements CASSPDAO {
}
@Override
- public CASSP findByClientAppId(final Long clientAppId) {
+ public CASSPClientApp findByClientAppId(final Long clientAppId) {
return find("clientAppId", clientAppId);
}
@Override
- public CASSP findByName(final String name) {
+ public CASSPClientApp findByName(final String name) {
return find("name", name);
}
@Transactional(readOnly = true)
@Override
- public List<CASSP> findAll() {
- TypedQuery<CASSP> query = entityManager().createQuery(
- "SELECT e FROM " + JPACASSP.class.getSimpleName() + " e", CASSP.class);
+ public List<CASSPClientApp> findAll() {
+ TypedQuery<CASSPClientApp> query = entityManager().createQuery(
+ "SELECT e FROM " + JPACASSPClientApp.class.getSimpleName() + " e", CASSPClientApp.class);
return query.getResultList();
}
@Override
- public CASSP save(final CASSP clientApp) {
+ public CASSPClientApp save(final CASSPClientApp clientApp) {
return entityManager().merge(clientApp);
}
@Override
public void delete(final String key) {
- CASSP rpTO = find(key);
+ CASSPClientApp rpTO = find(key);
if (rpTO == null) {
return;
}
@@ -89,7 +89,7 @@ public class JPACASSPDAO extends AbstractDAO<CASSP> implements CASSPDAO {
}
@Override
- public void delete(final CASSP clientApp) {
+ public void delete(final CASSPClientApp clientApp) {
entityManager().remove(clientApp);
}
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPAOIDCRPDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPAOIDCRPDAO.java
index bf6b32a..bd528c7 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPAOIDCRPDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPAOIDCRPDAO.java
@@ -22,27 +22,27 @@ import java.util.List;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
import org.apache.syncope.core.persistence.jpa.dao.AbstractDAO;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPAOIDCRP;
+import org.apache.syncope.core.persistence.jpa.entity.auth.JPAOIDCRPClientApp;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import org.apache.syncope.core.persistence.api.dao.auth.OIDCRPDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
+import org.apache.syncope.core.persistence.api.entity.auth.OIDCRPClientApp;
@Repository
-public class JPAOIDCRPDAO extends AbstractDAO<OIDCRP> implements OIDCRPDAO {
+public class JPAOIDCRPDAO extends AbstractDAO<OIDCRPClientApp> implements OIDCRPDAO {
@Override
- public OIDCRP find(final String key) {
- return entityManager().find(JPAOIDCRP.class, key);
+ public OIDCRPClientApp find(final String key) {
+ return entityManager().find(JPAOIDCRPClientApp.class, key);
}
- private OIDCRP find(final String column, final Object value) {
- TypedQuery<OIDCRP> query = entityManager().createQuery(
- "SELECT e FROM " + JPAOIDCRP.class.getSimpleName() + " e WHERE e." + column + "=:value",
- OIDCRP.class);
+ private OIDCRPClientApp find(final String column, final Object value) {
+ TypedQuery<OIDCRPClientApp> query = entityManager().createQuery(
+ "SELECT e FROM " + JPAOIDCRPClientApp.class.getSimpleName() + " e WHERE e." + column + "=:value",
+ OIDCRPClientApp.class);
query.setParameter("value", value);
- OIDCRP result = null;
+ OIDCRPClientApp result = null;
try {
result = query.getSingleResult();
} catch (final NoResultException e) {
@@ -53,37 +53,37 @@ public class JPAOIDCRPDAO extends AbstractDAO<OIDCRP> implements OIDCRPDAO {
}
@Override
- public OIDCRP findByClientAppId(final Long clientAppId) {
+ public OIDCRPClientApp findByClientAppId(final Long clientAppId) {
return find("clientAppId", clientAppId);
}
@Override
- public OIDCRP findByName(final String name) {
+ public OIDCRPClientApp findByName(final String name) {
return find("name", name);
}
@Override
- public OIDCRP findByClientId(final String clientId) {
+ public OIDCRPClientApp findByClientId(final String clientId) {
return find("clientId", clientId);
}
@Transactional(readOnly = true)
@Override
- public List<OIDCRP> findAll() {
- TypedQuery<OIDCRP> query = entityManager().createQuery(
- "SELECT e FROM " + JPAOIDCRP.class.getSimpleName() + " e", OIDCRP.class);
+ public List<OIDCRPClientApp> findAll() {
+ TypedQuery<OIDCRPClientApp> query = entityManager().createQuery(
+ "SELECT e FROM " + JPAOIDCRPClientApp.class.getSimpleName() + " e", OIDCRPClientApp.class);
return query.getResultList();
}
@Override
- public OIDCRP save(final OIDCRP clientApp) {
+ public OIDCRPClientApp save(final OIDCRPClientApp clientApp) {
return entityManager().merge(clientApp);
}
@Override
public void delete(final String key) {
- OIDCRP rpTO = find(key);
+ OIDCRPClientApp rpTO = find(key);
if (rpTO == null) {
return;
}
@@ -93,7 +93,7 @@ public class JPAOIDCRPDAO extends AbstractDAO<OIDCRP> implements OIDCRPDAO {
@Override
public void deleteByClientId(final String clientId) {
- OIDCRP rpTO = findByClientId(clientId);
+ OIDCRPClientApp rpTO = findByClientId(clientId);
if (rpTO == null) {
return;
}
@@ -101,7 +101,7 @@ public class JPAOIDCRPDAO extends AbstractDAO<OIDCRP> implements OIDCRPDAO {
}
@Override
- public void delete(final OIDCRP clientApp) {
+ public void delete(final OIDCRPClientApp clientApp) {
entityManager().remove(clientApp);
}
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2IdPMetadataDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2IdPEntityDAO.java
similarity index 57%
rename from core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2IdPMetadataDAO.java
rename to core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2IdPEntityDAO.java
index 848679e..f713293 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2IdPMetadataDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2IdPEntityDAO.java
@@ -18,45 +18,35 @@
*/
package org.apache.syncope.core.persistence.jpa.dao.auth;
-import javax.persistence.NoResultException;
+import java.util.List;
import javax.persistence.TypedQuery;
import org.apache.syncope.core.persistence.jpa.dao.AbstractDAO;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.persistence.api.dao.auth.SAML2IdPMetadataDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPMetadata;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2IdPMetadata;
+import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2IdPEntity;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPEntity;
+import org.apache.syncope.core.persistence.api.dao.auth.SAML2IdPEntityDAO;
@Repository
-public class JPASAML2IdPMetadataDAO extends AbstractDAO<SAML2IdPMetadata> implements SAML2IdPMetadataDAO {
+public class JPASAML2IdPEntityDAO extends AbstractDAO<SAML2IdPEntity> implements SAML2IdPEntityDAO {
@Transactional(readOnly = true)
@Override
- public SAML2IdPMetadata find(final String key) {
- return entityManager().find(JPASAML2IdPMetadata.class, key);
+ public SAML2IdPEntity find(final String key) {
+ return entityManager().find(JPASAML2IdPEntity.class, key);
}
@Transactional(readOnly = true)
@Override
- public SAML2IdPMetadata findByOwner(final String appliesTo) {
- TypedQuery<SAML2IdPMetadata> query = entityManager().createQuery(
- "SELECT e FROM " + JPASAML2IdPMetadata.class.getSimpleName() + " e WHERE e.appliesTo=:appliesTo",
- SAML2IdPMetadata.class);
- query.setParameter("appliesTo", appliesTo);
-
- SAML2IdPMetadata result = null;
- try {
- result = query.getSingleResult();
- } catch (final NoResultException e) {
- LOG.debug("No SAML2 IdP Metadata found with appliesTo = {}", appliesTo);
- }
-
- return result;
+ public List<SAML2IdPEntity> findAll() {
+ TypedQuery<SAML2IdPEntity> query = entityManager().createQuery(
+ "SELECT e FROM " + JPASAML2IdPEntity.class.getSimpleName() + " e",
+ SAML2IdPEntity.class);
+ return query.getResultList();
}
@Override
- public SAML2IdPMetadata save(final SAML2IdPMetadata saml2IdPMetadata) {
- return entityManager().merge(saml2IdPMetadata);
+ public SAML2IdPEntity save(final SAML2IdPEntity saml2IdPEntity) {
+ return entityManager().merge(saml2IdPEntity);
}
-
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPDAO.java
index e8ce293..3a2a7a3 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPDAO.java
@@ -19,30 +19,30 @@
package org.apache.syncope.core.persistence.jpa.dao.auth;
import org.apache.syncope.core.persistence.jpa.dao.AbstractDAO;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2SP;
+import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2SPClientApp;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
import java.util.List;
import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SP;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPClientApp;
@Repository
-public class JPASAML2SPDAO extends AbstractDAO<SAML2SP> implements SAML2SPDAO {
+public class JPASAML2SPDAO extends AbstractDAO<SAML2SPClientApp> implements SAML2SPDAO {
@Override
- public SAML2SP find(final String key) {
- return entityManager().find(JPASAML2SP.class, key);
+ public SAML2SPClientApp find(final String key) {
+ return entityManager().find(JPASAML2SPClientApp.class, key);
}
- private SAML2SP find(final String column, final Object value) {
- TypedQuery<SAML2SP> query = entityManager().createQuery(
- "SELECT e FROM " + JPASAML2SP.class.getSimpleName() + " e WHERE e." + column + "=:value",
- SAML2SP.class);
+ private SAML2SPClientApp find(final String column, final Object value) {
+ TypedQuery<SAML2SPClientApp> query = entityManager().createQuery(
+ "SELECT e FROM " + JPASAML2SPClientApp.class.getSimpleName() + " e WHERE e." + column + "=:value",
+ SAML2SPClientApp.class);
query.setParameter("value", value);
- SAML2SP result = null;
+ SAML2SPClientApp result = null;
try {
result = query.getSingleResult();
} catch (final NoResultException e) {
@@ -53,37 +53,37 @@ public class JPASAML2SPDAO extends AbstractDAO<SAML2SP> implements SAML2SPDAO {
}
@Override
- public SAML2SP findByClientAppId(final Long clientAppId) {
+ public SAML2SPClientApp findByClientAppId(final Long clientAppId) {
return find("clientAppId", clientAppId);
}
@Override
- public SAML2SP findByName(final String name) {
+ public SAML2SPClientApp findByName(final String name) {
return find("name", name);
}
@Override
- public SAML2SP findByEntityId(final String entityId) {
+ public SAML2SPClientApp findByEntityId(final String entityId) {
return find("entityId", entityId);
}
@Transactional(readOnly = true)
@Override
- public List<SAML2SP> findAll() {
- TypedQuery<SAML2SP> query = entityManager().createQuery(
- "SELECT e FROM " + JPASAML2SP.class.getSimpleName() + " e", SAML2SP.class);
+ public List<SAML2SPClientApp> findAll() {
+ TypedQuery<SAML2SPClientApp> query = entityManager().createQuery(
+ "SELECT e FROM " + JPASAML2SPClientApp.class.getSimpleName() + " e", SAML2SPClientApp.class);
return query.getResultList();
}
@Override
- public SAML2SP save(final SAML2SP clientApp) {
+ public SAML2SPClientApp save(final SAML2SPClientApp clientApp) {
return entityManager().merge(clientApp);
}
@Override
public void delete(final String key) {
- SAML2SP policy = find(key);
+ SAML2SPClientApp policy = find(key);
if (policy == null) {
return;
}
@@ -93,7 +93,7 @@ public class JPASAML2SPDAO extends AbstractDAO<SAML2SP> implements SAML2SPDAO {
@Override
public void deleteByEntityId(final String entityId) {
- SAML2SP app = findByEntityId(entityId);
+ SAML2SPClientApp app = findByEntityId(entityId);
if (app == null) {
return;
}
@@ -101,7 +101,7 @@ public class JPASAML2SPDAO extends AbstractDAO<SAML2SP> implements SAML2SPDAO {
}
@Override
- public void delete(final SAML2SP clientApp) {
+ public void delete(final SAML2SPClientApp clientApp) {
entityManager().remove(clientApp);
}
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPMetadataDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPEntityDAO.java
similarity index 54%
rename from core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPMetadataDAO.java
rename to core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPEntityDAO.java
index 21ee9bf..bc660c1 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPMetadataDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPEntityDAO.java
@@ -18,45 +18,38 @@
*/
package org.apache.syncope.core.persistence.jpa.dao.auth;
-import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPMetadataDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPMetadata;
+import java.util.List;
+import javax.persistence.TypedQuery;
import org.apache.syncope.core.persistence.jpa.dao.AbstractDAO;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2SPMetadata;
+import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2SPEntity;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
-
-import javax.persistence.NoResultException;
-import javax.persistence.TypedQuery;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPEntity;
+import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPEntityDAO;
@Repository
-public class JPASAML2SPMetadataDAO extends AbstractDAO<SAML2SPMetadata> implements SAML2SPMetadataDAO {
+public class JPASAML2SPEntityDAO extends AbstractDAO<SAML2SPEntity> implements SAML2SPEntityDAO {
- @Transactional(readOnly = true)
@Override
- public SAML2SPMetadata find(final String key) {
- return entityManager().find(JPASAML2SPMetadata.class, key);
+ public List<SAML2SPEntity> findAll() {
+ TypedQuery<SAML2SPEntity> query = entityManager().createQuery(
+ "SELECT e FROM " + JPASAML2SPEntity.class.getSimpleName() + " e", SAML2SPEntity.class);
+ return query.getResultList();
}
@Transactional(readOnly = true)
@Override
- public SAML2SPMetadata findByOwner(final String owner) {
- TypedQuery<SAML2SPMetadata> query = entityManager().createQuery(
- "SELECT e FROM " + JPASAML2SPMetadata.class.getSimpleName() + " e WHERE e.owner=:owner",
- SAML2SPMetadata.class);
- query.setParameter("owner", owner);
-
- SAML2SPMetadata result = null;
- try {
- result = query.getSingleResult();
- } catch (final NoResultException e) {
- LOG.debug("No SAML2 SP Metadata found with appliesTo = {}", owner);
- }
- return result;
+ public SAML2SPEntity find(final String key) {
+ return entityManager().find(JPASAML2SPEntity.class, key);
}
@Override
- public SAML2SPMetadata save(final SAML2SPMetadata saml2IdPMetadata) {
- return entityManager().merge(saml2IdPMetadata);
+ public SAML2SPEntity save(final SAML2SPEntity entity) {
+ return entityManager().merge(entity);
}
+ @Override
+ public void delete(final SAML2SPEntity entity) {
+ entityManager().remove(entity);
+ }
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPKeystoreDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPKeystoreDAO.java
deleted file mode 100644
index c3b9761..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/auth/JPASAML2SPKeystoreDAO.java
+++ /dev/null
@@ -1,62 +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.persistence.jpa.dao.auth;
-
-import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPKeystoreDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPKeystore;
-import org.apache.syncope.core.persistence.jpa.dao.AbstractDAO;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2SPKeystore;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.persistence.NoResultException;
-import javax.persistence.TypedQuery;
-
-@Repository
-public class JPASAML2SPKeystoreDAO extends AbstractDAO<SAML2SPKeystore> implements SAML2SPKeystoreDAO {
-
- @Transactional(readOnly = true)
- @Override
- public SAML2SPKeystore find(final String key) {
- return entityManager().find(JPASAML2SPKeystore.class, key);
- }
-
- @Transactional(readOnly = true)
- @Override
- public SAML2SPKeystore findByOwner(final String owner) {
- TypedQuery<SAML2SPKeystore> query = entityManager().createQuery(
- "SELECT e FROM " + JPASAML2SPKeystore.class.getSimpleName() + " e WHERE e.owner=:owner",
- SAML2SPKeystore.class);
- query.setParameter("owner", owner);
-
- SAML2SPKeystore result = null;
- try {
- result = query.getSingleResult();
- } catch (final NoResultException e) {
- LOG.debug("No SAML2 SP Keystore found with appliesTo = {}", owner);
- }
- return result;
- }
-
- @Override
- public SAML2SPKeystore save(final SAML2SPKeystore saml2IdPMetadata) {
- return entityManager().merge(saml2IdPMetadata);
- }
-
-}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
index 333ba50..88f0484 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
@@ -58,13 +58,7 @@ import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
import org.apache.syncope.core.persistence.api.entity.auth.AuthModule;
import org.apache.syncope.core.persistence.api.entity.auth.AuthModuleItem;
import org.apache.syncope.core.persistence.api.entity.auth.AuthProfile;
-import org.apache.syncope.core.persistence.api.entity.auth.CASSP;
import org.apache.syncope.core.persistence.api.entity.auth.OIDCJWKS;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPMetadata;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SP;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPKeystore;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPMetadata;
import org.apache.syncope.core.persistence.api.entity.auth.WAConfigEntry;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr;
import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrUniqueValue;
@@ -116,12 +110,11 @@ import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrVal
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAARelationship;
import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAnyObject;
import org.apache.syncope.core.persistence.jpa.entity.auth.JPAAuthProfile;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPACASSP;
+import org.apache.syncope.core.persistence.jpa.entity.auth.JPACASSPClientApp;
import org.apache.syncope.core.persistence.jpa.entity.auth.JPAOIDCJWKS;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPAOIDCRP;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2SP;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2SPKeystore;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2SPMetadata;
+import org.apache.syncope.core.persistence.jpa.entity.auth.JPAOIDCRPClientApp;
+import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2SPClientApp;
+import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2SPEntity;
import org.apache.syncope.core.persistence.jpa.entity.auth.JPAWAConfigEntry;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr;
import org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue;
@@ -167,8 +160,13 @@ import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
import org.apache.syncope.core.spring.security.SecureRandomUtils;
import org.apache.syncope.core.persistence.jpa.entity.auth.JPAAuthModule;
import org.apache.syncope.core.persistence.jpa.entity.auth.JPAAuthModuleItem;
-import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2IdPMetadata;
+import org.apache.syncope.core.persistence.jpa.entity.auth.JPASAML2IdPEntity;
import org.apache.syncope.core.persistence.api.entity.SRARoute;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPEntity;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPEntity;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.CASSPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.OIDCRPClientApp;
public class JPAEntityFactory implements EntityFactory {
@@ -331,18 +329,16 @@ public class JPAEntityFactory implements EntityFactory {
result = (E) new JPAAccessPolicy();
} else if (reference.equals(AttrReleasePolicy.class)) {
result = (E) new JPAAttrReleasePolicy();
- } else if (reference.equals(OIDCRP.class)) {
- result = (E) new JPAOIDCRP();
- } else if (reference.equals(CASSP.class)) {
- result = (E) new JPACASSP();
- } else if (reference.equals(SAML2SP.class)) {
- result = (E) new JPASAML2SP();
- } else if (reference.equals(SAML2IdPMetadata.class)) {
- result = (E) new JPASAML2IdPMetadata();
- } else if (reference.equals(SAML2SPMetadata.class)) {
- result = (E) new JPASAML2SPMetadata();
- } else if (reference.equals(SAML2SPKeystore.class)) {
- result = (E) new JPASAML2SPKeystore();
+ } else if (reference.equals(OIDCRPClientApp.class)) {
+ result = (E) new JPAOIDCRPClientApp();
+ } else if (reference.equals(CASSPClientApp.class)) {
+ result = (E) new JPACASSPClientApp();
+ } else if (reference.equals(SAML2SPClientApp.class)) {
+ result = (E) new JPASAML2SPClientApp();
+ } else if (reference.equals(SAML2IdPEntity.class)) {
+ result = (E) new JPASAML2IdPEntity();
+ } else if (reference.equals(SAML2SPEntity.class)) {
+ result = (E) new JPASAML2SPEntity();
} else if (reference.equals(AuthProfile.class)) {
result = (E) new JPAAuthProfile();
} else if (reference.equals(OIDCJWKS.class)) {
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPACASSP.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPACASSPClientApp.java
similarity index 87%
rename from core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPACASSP.java
rename to core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPACASSPClientApp.java
index 9198dad..53fdd8d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPACASSP.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPACASSPClientApp.java
@@ -21,13 +21,13 @@ package org.apache.syncope.core.persistence.jpa.entity.auth;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.auth.CASSP;
+import org.apache.syncope.core.persistence.api.entity.auth.CASSPClientApp;
@Entity
-@Table(name = JPACASSP.TABLE)
-public class JPACASSP extends AbstractClientApp implements CASSP {
+@Table(name = JPACASSPClientApp.TABLE)
+public class JPACASSPClientApp extends AbstractClientApp implements CASSPClientApp {
- public static final String TABLE = "CASSP";
+ public static final String TABLE = "CASSPClientApp";
private static final long serialVersionUID = 6422422526695279794L;
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAClientAppUtils.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAClientAppUtils.java
index 3cb32b3..ff8a77f 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAClientAppUtils.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAClientAppUtils.java
@@ -19,11 +19,11 @@
package org.apache.syncope.core.persistence.jpa.entity.auth;
import org.apache.syncope.common.lib.types.ClientAppType;
-import org.apache.syncope.core.persistence.api.entity.auth.CASSP;
import org.apache.syncope.core.persistence.api.entity.auth.ClientApp;
import org.apache.syncope.core.persistence.api.entity.auth.ClientAppUtils;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SP;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.CASSPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.OIDCRPClientApp;
public class JPAClientAppUtils implements ClientAppUtils {
@@ -42,12 +42,12 @@ public class JPAClientAppUtils implements ClientAppUtils {
public Class<? extends ClientApp> clientAppClass() {
switch (type) {
case OIDCRP:
- return OIDCRP.class;
+ return OIDCRPClientApp.class;
case CASSP:
- return CASSP.class;
+ return CASSPClientApp.class;
case SAML2SP:
default:
- return SAML2SP.class;
+ return SAML2SPClientApp.class;
}
}
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAClientAppUtilsFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAClientAppUtilsFactory.java
index 6754fe6..c27c308 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAClientAppUtilsFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAClientAppUtilsFactory.java
@@ -18,18 +18,18 @@
*/
package org.apache.syncope.core.persistence.jpa.entity.auth;
-import org.apache.syncope.common.lib.to.CASSPTO;
+import org.apache.syncope.common.lib.to.CASSPClientAppTO;
import org.apache.syncope.common.lib.to.ClientAppTO;
-import org.apache.syncope.common.lib.to.OIDCRPTO;
-import org.apache.syncope.common.lib.to.SAML2SPTO;
+import org.apache.syncope.common.lib.to.OIDCRPClientAppTO;
+import org.apache.syncope.common.lib.to.SAML2SPClientAppTO;
import org.apache.syncope.common.lib.types.ClientAppType;
-import org.apache.syncope.core.persistence.api.entity.auth.CASSP;
import org.apache.syncope.core.persistence.api.entity.auth.ClientApp;
import org.apache.syncope.core.persistence.api.entity.auth.ClientAppUtils;
import org.apache.syncope.core.persistence.api.entity.auth.ClientAppUtilsFactory;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SP;
import org.springframework.stereotype.Component;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.CASSPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.OIDCRPClientApp;
@Component
public class JPAClientAppUtilsFactory implements ClientAppUtilsFactory {
@@ -42,11 +42,11 @@ public class JPAClientAppUtilsFactory implements ClientAppUtilsFactory {
@Override
public ClientAppUtils getInstance(final ClientApp clientApp) {
ClientAppType type;
- if (clientApp instanceof SAML2SP) {
+ if (clientApp instanceof SAML2SPClientApp) {
type = ClientAppType.SAML2SP;
- } else if (clientApp instanceof CASSP) {
+ } else if (clientApp instanceof CASSPClientApp) {
type = ClientAppType.CASSP;
- } else if (clientApp instanceof OIDCRP) {
+ } else if (clientApp instanceof OIDCRPClientApp) {
type = ClientAppType.OIDCRP;
} else {
throw new IllegalArgumentException("Invalid client app: " + clientApp);
@@ -58,11 +58,11 @@ public class JPAClientAppUtilsFactory implements ClientAppUtilsFactory {
@Override
public ClientAppUtils getInstance(final Class<? extends ClientAppTO> clientAppClass) {
ClientAppType type;
- if (clientAppClass == SAML2SPTO.class) {
+ if (clientAppClass == SAML2SPClientAppTO.class) {
type = ClientAppType.SAML2SP;
- } else if (clientAppClass == CASSPTO.class) {
+ } else if (clientAppClass == CASSPClientAppTO.class) {
type = ClientAppType.CASSP;
- } else if (clientAppClass == OIDCRPTO.class) {
+ } else if (clientAppClass == OIDCRPClientAppTO.class) {
type = ClientAppType.OIDCRP;
} else {
throw new IllegalArgumentException("Invalid ClientAppTO app: " + clientAppClass.getName());
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAOIDCRP.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAOIDCRPClientApp.java
similarity index 91%
rename from core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAOIDCRP.java
rename to core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAOIDCRPClientApp.java
index fdc4f98..891a097 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAOIDCRP.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPAOIDCRPClientApp.java
@@ -32,15 +32,15 @@ import javax.persistence.Enumerated;
import org.apache.syncope.common.lib.types.OIDCGrantType;
import org.apache.syncope.common.lib.types.OIDCResponseType;
import org.apache.syncope.common.lib.types.OIDCSubjectType;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
+import org.apache.syncope.core.persistence.api.entity.auth.OIDCRPClientApp;
@Entity
-@Table(name = JPAOIDCRP.TABLE)
-public class JPAOIDCRP extends AbstractClientApp implements OIDCRP {
+@Table(name = JPAOIDCRPClientApp.TABLE)
+public class JPAOIDCRPClientApp extends AbstractClientApp implements OIDCRPClientApp {
private static final long serialVersionUID = 7422422526695279794L;
- public static final String TABLE = "OIDCRP";
+ public static final String TABLE = "OIDCRPClientApp";
@Column(unique = true, nullable = false)
private String clientId;
@@ -54,7 +54,7 @@ public class JPAOIDCRP extends AbstractClientApp implements OIDCRP {
@ElementCollection(fetch = FetchType.EAGER)
@Column(name = "redirectUri")
- @CollectionTable(name = "OIDCRP_RedirectUris",
+ @CollectionTable(name = "OIDCRPClientApp_RedirectUris",
joinColumns =
@JoinColumn(name = "client_id", referencedColumnName = "id"))
private Set<String> redirectUris = new HashSet<>();
@@ -62,7 +62,7 @@ public class JPAOIDCRP extends AbstractClientApp implements OIDCRP {
@ElementCollection(fetch = FetchType.EAGER)
@Enumerated(EnumType.STRING)
@Column(name = "supportedGrantType")
- @CollectionTable(name = "OIDCRP_SupportedGrantTypes",
+ @CollectionTable(name = "OIDCRPClientApp_SupportedGrantTypes",
joinColumns =
@JoinColumn(name = "client_id", referencedColumnName = "id"))
private Set<OIDCGrantType> supportedGrantTypes = new HashSet<>();
@@ -70,7 +70,7 @@ public class JPAOIDCRP extends AbstractClientApp implements OIDCRP {
@ElementCollection(fetch = FetchType.EAGER)
@Enumerated(EnumType.STRING)
@Column(name = "supportedResponseType")
- @CollectionTable(name = "OIDCRP_SupportedResponseTypes",
+ @CollectionTable(name = "OIDCRPClientApp_SupportedResponseTypes",
joinColumns =
@JoinColumn(name = "client_id", referencedColumnName = "id"))
private Set<OIDCResponseType> supportedResponseTypes = new HashSet<>();
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2IdPMetadata.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2IdPEntity.java
similarity index 52%
rename from core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2IdPMetadata.java
rename to core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2IdPEntity.java
index 6017f9a..887deb9 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2IdPMetadata.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2IdPEntity.java
@@ -22,93 +22,81 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPMetadata;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractGeneratedKeyEntity;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractProvidedKeyEntity;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPEntity;
@Entity
-@Table(name = JPASAML2IdPMetadata.TABLE)
-public class JPASAML2IdPMetadata extends AbstractGeneratedKeyEntity implements SAML2IdPMetadata {
+@Table(name = JPASAML2IdPEntity.TABLE)
+public class JPASAML2IdPEntity extends AbstractProvidedKeyEntity implements SAML2IdPEntity {
- public static final String TABLE = "SAML2IdPMetadata";
+ public static final String TABLE = "SAML2IdPEntity";
private static final long serialVersionUID = 57352617217394093L;
- @Column(unique = true)
- private String appliesTo;
-
+ @Column(nullable = true)
@Lob
- private String metadata;
+ private byte[] metadata;
@Lob
- private String signingCertificate;
+ private byte[] signingCertificate;
@Lob
- private String signingKey;
+ private byte[] signingKey;
@Lob
- private String encryptionCertificate;
+ private byte[] encryptionCertificate;
@Lob
- private String encryptionKey;
+ private byte[] encryptionKey;
@Override
- public String getMetadata() {
+ public byte[] getMetadata() {
return metadata;
}
@Override
- public void setMetadata(final String metadata) {
- this.metadata = metadata;
+ public void setMetadata(final byte[] metadata) {
+ this.metadata = ArrayUtils.clone(metadata);
}
@Override
- public String getSigningCertificate() {
+ public byte[] getSigningCertificate() {
return signingCertificate;
}
@Override
- public void setSigningCertificate(final String signingCertificate) {
- this.signingCertificate = signingCertificate;
+ public void setSigningCertificate(final byte[] signingCertificate) {
+ this.signingCertificate = ArrayUtils.clone(signingCertificate);
}
@Override
- public String getSigningKey() {
+ public byte[] getSigningKey() {
return signingKey;
}
@Override
- public void setSigningKey(final String signingKey) {
- this.signingKey = signingKey;
+ public void setSigningKey(final byte[] signingKey) {
+ this.signingKey = ArrayUtils.clone(signingKey);
}
@Override
- public String getEncryptionCertificate() {
+ public byte[] getEncryptionCertificate() {
return encryptionCertificate;
}
@Override
- public void setEncryptionCertificate(final String encryptionCertificate) {
- this.encryptionCertificate = encryptionCertificate;
+ public void setEncryptionCertificate(final byte[] encryptionCertificate) {
+ this.encryptionCertificate = ArrayUtils.clone(encryptionCertificate);
}
@Override
- public String getEncryptionKey() {
+ public byte[] getEncryptionKey() {
return encryptionKey;
}
@Override
- public void setEncryptionKey(final String encryptionKey) {
- this.encryptionKey = encryptionKey;
- }
-
- @Override
- public String getAppliesTo() {
- return appliesTo;
+ public void setEncryptionKey(final byte[] encryptionKey) {
+ this.encryptionKey = ArrayUtils.clone(encryptionKey);
}
-
- @Override
- public void setAppliesTo(final String appliesTo) {
- this.appliesTo = appliesTo;
- }
-
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SP.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPClientApp.java
similarity index 92%
rename from core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SP.java
rename to core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPClientApp.java
index 8b02ab6..b066c5d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SP.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPClientApp.java
@@ -30,14 +30,14 @@ import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Table;
import org.apache.syncope.common.lib.types.SAML2SPNameId;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SP;
import org.apache.syncope.common.lib.types.XmlSecAlgorithm;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPClientApp;
@Entity
-@Table(name = JPASAML2SP.TABLE)
-public class JPASAML2SP extends AbstractClientApp implements SAML2SP {
+@Table(name = JPASAML2SPClientApp.TABLE)
+public class JPASAML2SPClientApp extends AbstractClientApp implements SAML2SPClientApp {
- public static final String TABLE = "SAML2SP";
+ public static final String TABLE = "SAML2SPClientApp";
private static final long serialVersionUID = 6422422526695279794L;
@@ -68,7 +68,7 @@ public class JPASAML2SP extends AbstractClientApp implements SAML2SP {
@ElementCollection(fetch = FetchType.EAGER)
@Column(name = "assertionAudience")
- @CollectionTable(name = "SAML2SP_AssertionAudiences",
+ @CollectionTable(name = "SAML2SPClientApp_AssertionAudiences",
joinColumns =
@JoinColumn(name = "client_app_id", referencedColumnName = "id"))
private Set<String> assertionAudiences = new HashSet<>();
@@ -78,42 +78,42 @@ public class JPASAML2SP extends AbstractClientApp implements SAML2SP {
@ElementCollection(fetch = FetchType.EAGER)
@Column(name = "signingSignatureAlgorithm")
- @CollectionTable(name = "SAML2SP_SigningSignatureAlgs",
+ @CollectionTable(name = "SAML2SPClientApp_SigningSignatureAlgs",
joinColumns =
@JoinColumn(name = "client_app_id", referencedColumnName = "id"))
private List<XmlSecAlgorithm> signingSignatureAlgorithms = new ArrayList<>();
@ElementCollection(fetch = FetchType.EAGER)
@Column(name = "signingSignatureReferenceDigestMethod")
- @CollectionTable(name = "SAML2SP_SigningSignatureRefDigestAlgs",
+ @CollectionTable(name = "SAML2SPClientApp_SigningSignatureRefDigestAlgs",
joinColumns =
@JoinColumn(name = "client_app_id", referencedColumnName = "id"))
private List<XmlSecAlgorithm> signingSignatureReferenceDigestMethods = new ArrayList<>();
@ElementCollection(fetch = FetchType.EAGER)
@Column(name = "encryptionDataAlgorithm")
- @CollectionTable(name = "SAML2SP_EncryptionDataAlgs",
+ @CollectionTable(name = "SAML2SPClientApp_EncryptionDataAlgs",
joinColumns =
@JoinColumn(name = "client_app_id", referencedColumnName = "id"))
private List<XmlSecAlgorithm> encryptionDataAlgorithms = new ArrayList<>();
@ElementCollection(fetch = FetchType.EAGER)
@Column(name = "encryptionKeyAlgorithm")
- @CollectionTable(name = "SAML2SP_EncryptionKeyAlgs",
+ @CollectionTable(name = "SAML2SPClientApp_EncryptionKeyAlgs",
joinColumns =
@JoinColumn(name = "client_app_id", referencedColumnName = "id"))
private List<XmlSecAlgorithm> encryptionKeyAlgorithms = new ArrayList<>();
@ElementCollection(fetch = FetchType.EAGER)
@Column(name = "signingSignatureBlackListedAlgorithm")
- @CollectionTable(name = "SAML2SP_BlacklistedSigningAlgs",
+ @CollectionTable(name = "SAML2SPClientApp_BlacklistedSigningAlgs",
joinColumns =
@JoinColumn(name = "client_app_id", referencedColumnName = "id"))
private List<XmlSecAlgorithm> signingSignatureBlackListedAlgorithms = new ArrayList<>();
@ElementCollection(fetch = FetchType.EAGER)
@Column(name = "encryptionBlackListedAlgorithm")
- @CollectionTable(name = "SAML2SP_BlacklistedEncryptionAlgs",
+ @CollectionTable(name = "SAML2SPClientApp_BlacklistedEncryptionAlgs",
joinColumns =
@JoinColumn(name = "client_app_id", referencedColumnName = "id"))
private List<XmlSecAlgorithm> encryptionBlackListedAlgorithms = new ArrayList<>();
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPMetadata.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPEntity.java
similarity index 62%
rename from core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPMetadata.java
rename to core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPEntity.java
index fa96b56..27c84ea 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPMetadata.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPEntity.java
@@ -22,40 +22,43 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPMetadata;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractGeneratedKeyEntity;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractProvidedKeyEntity;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPEntity;
@Entity
-@Table(name = JPASAML2SPMetadata.TABLE)
-public class JPASAML2SPMetadata extends AbstractGeneratedKeyEntity implements SAML2SPMetadata {
+@Table(name = JPASAML2SPEntity.TABLE)
+public class JPASAML2SPEntity extends AbstractProvidedKeyEntity implements SAML2SPEntity {
- public static final String TABLE = "SAML2SPMetadata";
+ public static final String TABLE = "SAML2SPEntity";
private static final long serialVersionUID = 12342617217394093L;
- @Column(unique = true)
- private String owner;
+ @Column(nullable = true)
+ @Lob
+ private byte[] keystore;
+ @Column(nullable = true)
@Lob
- private String metadata;
+ private byte[] metadata;
@Override
- public String getMetadata() {
- return metadata;
+ public byte[] getKeystore() {
+ return keystore;
}
@Override
- public void setMetadata(final String metadata) {
- this.metadata = metadata;
+ public void setKeystore(final byte[] keystore) {
+ this.keystore = ArrayUtils.clone(keystore);
}
@Override
- public String getOwner() {
- return owner;
+ public byte[] getMetadata() {
+ return metadata;
}
@Override
- public void setOwner(final String name) {
- this.owner = name;
+ public void setMetadata(final byte[] metadata) {
+ this.metadata = ArrayUtils.clone(metadata);
}
}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPKeystore.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPKeystore.java
deleted file mode 100644
index 5cefe7e..0000000
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/auth/JPASAML2SPKeystore.java
+++ /dev/null
@@ -1,61 +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.persistence.jpa.entity.auth;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Lob;
-import javax.persistence.Table;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPKeystore;
-import org.apache.syncope.core.persistence.jpa.entity.AbstractGeneratedKeyEntity;
-
-@Entity
-@Table(name = JPASAML2SPKeystore.TABLE)
-public class JPASAML2SPKeystore extends AbstractGeneratedKeyEntity implements SAML2SPKeystore {
-
- public static final String TABLE = "SAML2SPKeystore";
-
- private static final long serialVersionUID = 22342617217394093L;
-
- @Column(unique = true)
- private String owner;
-
- @Lob
- private String keystore;
-
- @Override
- public String getKeystore() {
- return keystore;
- }
-
- @Override
- public void setKeystore(final String keystore) {
- this.keystore = keystore;
- }
-
- @Override
- public String getOwner() {
- return owner;
- }
-
- @Override
- public void setOwner(final String name) {
- this.owner = name;
- }
-}
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthProfileTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthProfileTest.java
index df2c1dd..22e9e77 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthProfileTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AuthProfileTest.java
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
-
import org.apache.syncope.common.lib.wa.GoogleMfaAuthAccount;
import org.apache.syncope.common.lib.wa.GoogleMfaAuthToken;
import org.apache.syncope.common.lib.wa.ImpersonationAccount;
@@ -174,11 +173,8 @@ public class AuthProfileTest extends AbstractTest {
assertTrue(result.isPresent());
List<ImpersonationAccount> accounts = IntStream.range(1, 10).
- mapToObj(i -> new ImpersonationAccount.Builder()
- .owner("impersonator")
- .key("impersonatee" + i)
- .build()).
- collect(Collectors.toList());
+ mapToObj(i -> new ImpersonationAccount.Builder().impersonated("impersonatee" + i).build()).
+ collect(Collectors.toList());
authProfile.setImpersonationAccounts(accounts);
authProfile = authProfileDAO.save(authProfile);
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/CASSPTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/CASSPTest.java
index 45aa0f6..1dbf14f 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/CASSPTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/CASSPTest.java
@@ -19,7 +19,6 @@
package org.apache.syncope.core.persistence.jpa.inner;
import org.apache.syncope.core.persistence.api.dao.auth.CASSPDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.CASSP;
import org.apache.syncope.core.persistence.api.entity.policy.AccessPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.AuthPolicy;
import org.junit.jupiter.api.Test;
@@ -32,6 +31,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
+import org.apache.syncope.core.persistence.api.entity.auth.CASSPClientApp;
+
@Transactional("Master")
public class CASSPTest extends AbstractClientAppTest {
@@ -42,7 +43,7 @@ public class CASSPTest extends AbstractClientAppTest {
public void find() {
int beforeCount = casspDAO.findAll().size();
- CASSP rp = entityFactory.newEntity(CASSP.class);
+ CASSPClientApp rp = entityFactory.newEntity(CASSPClientApp.class);
rp.setName("CAS");
rp.setClientAppId(UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE);
rp.setDescription("This is a sample CAS RP");
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/OIDCRPTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/OIDCRPTest.java
index bd0c77f..6207ae3 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/OIDCRPTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/OIDCRPTest.java
@@ -27,12 +27,12 @@ import org.apache.syncope.common.lib.types.OIDCGrantType;
import org.apache.syncope.common.lib.types.OIDCResponseType;
import org.apache.syncope.common.lib.types.OIDCSubjectType;
import org.apache.syncope.core.persistence.api.dao.auth.OIDCRPDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
import org.apache.syncope.core.persistence.api.entity.policy.AccessPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.AuthPolicy;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
+import org.apache.syncope.core.persistence.api.entity.auth.OIDCRPClientApp;
@Transactional("Master")
public class OIDCRPTest extends AbstractClientAppTest {
@@ -44,7 +44,7 @@ public class OIDCRPTest extends AbstractClientAppTest {
public void find() {
int beforeCount = oidcrpDAO.findAll().size();
- OIDCRP rp = entityFactory.newEntity(OIDCRP.class);
+ OIDCRPClientApp rp = entityFactory.newEntity(OIDCRPClientApp.class);
rp.setName("OIDC");
rp.setClientAppId(UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE);
rp.setDescription("This is a sample OIDC RP");
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2IdPMetadataTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2IdPEntityTest.java
similarity index 50%
rename from core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2IdPMetadataTest.java
rename to core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2IdPEntityTest.java
index 8d47b48..48bdeab 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2IdPMetadataTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2IdPEntityTest.java
@@ -22,28 +22,29 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
+import java.nio.charset.StandardCharsets;
import java.util.UUID;
-import org.apache.syncope.core.persistence.api.dao.auth.SAML2IdPMetadataDAO;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPMetadata;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPEntity;
+import org.apache.syncope.core.persistence.api.dao.auth.SAML2IdPEntityDAO;
@Transactional("Master")
-public class SAML2IdPMetadataTest extends AbstractTest {
+public class SAML2IdPEntityTest extends AbstractTest {
@Autowired
- private SAML2IdPMetadataDAO saml2IdPMetadataDAO;
+ private SAML2IdPEntityDAO saml2IdPEntityDAO;
@Test
public void find() {
create("Syncope");
- SAML2IdPMetadata saml2IdPMetadata = saml2IdPMetadataDAO.findByOwner("Syncope");
- assertNotNull(saml2IdPMetadata);
+ SAML2IdPEntity entity = saml2IdPEntityDAO.find("Syncope");
+ assertNotNull(entity);
- saml2IdPMetadata = saml2IdPMetadataDAO.findByOwner(UUID.randomUUID().toString());
- assertNull(saml2IdPMetadata);
+ entity = saml2IdPEntityDAO.find(UUID.randomUUID().toString());
+ assertNull(entity);
}
@Test
@@ -53,32 +54,31 @@ public class SAML2IdPMetadataTest extends AbstractTest {
@Test
public void update() {
- SAML2IdPMetadata saml2IdPMetadata = create("SyncopeUpdate");
- assertNotNull(saml2IdPMetadata);
- saml2IdPMetadata.setAppliesTo("OtherSyncope");
+ SAML2IdPEntity entity = create("SyncopeUpdate");
+ assertNotNull(entity);
+ entity.setKey("OtherSyncope");
- saml2IdPMetadata = saml2IdPMetadataDAO.save(saml2IdPMetadata);
- assertNotNull(saml2IdPMetadata);
- assertNotNull(saml2IdPMetadata.getKey());
- SAML2IdPMetadata found = saml2IdPMetadataDAO.findByOwner(saml2IdPMetadata.getAppliesTo());
+ entity = saml2IdPEntityDAO.save(entity);
+ assertNotNull(entity);
+ assertNotNull(entity.getKey());
+ SAML2IdPEntity found = saml2IdPEntityDAO.find(entity.getKey());
assertNotNull(found);
- assertEquals("OtherSyncope", found.getAppliesTo());
+ assertEquals("OtherSyncope", found.getKey());
}
- private SAML2IdPMetadata create(final String appliesTo) {
- SAML2IdPMetadata saml2IdPMetadata = entityFactory.newEntity(SAML2IdPMetadata.class);
- saml2IdPMetadata.setAppliesTo(appliesTo);
- saml2IdPMetadata.setMetadata("metadata");
- saml2IdPMetadata.setEncryptionCertificate("encryptionCert");
- saml2IdPMetadata.setEncryptionKey("encryptionKey");
- saml2IdPMetadata.setSigningCertificate("signatureCert");
- saml2IdPMetadata.setSigningKey("signatureKey");
- saml2IdPMetadataDAO.save(saml2IdPMetadata);
- assertNotNull(saml2IdPMetadata);
- assertNotNull(saml2IdPMetadata.getKey());
- assertNotNull(saml2IdPMetadataDAO.findByOwner(saml2IdPMetadata.getAppliesTo()));
+ private SAML2IdPEntity create(final String owner) {
+ SAML2IdPEntity entity = entityFactory.newEntity(SAML2IdPEntity.class);
+ entity.setKey(owner);
+ entity.setMetadata("metadata".getBytes(StandardCharsets.UTF_8));
+ entity.setEncryptionCertificate("encryptionCert".getBytes(StandardCharsets.UTF_8));
+ entity.setEncryptionKey("encryptionKey".getBytes(StandardCharsets.UTF_8));
+ entity.setSigningCertificate("signatureCert".getBytes(StandardCharsets.UTF_8));
+ entity.setSigningKey("signatureKey".getBytes(StandardCharsets.UTF_8));
+ saml2IdPEntityDAO.save(entity);
+ assertNotNull(entity);
+ assertNotNull(entity.getKey());
+ assertNotNull(saml2IdPEntityDAO.find(entity.getKey()));
- return saml2IdPMetadata;
+ return entity;
}
-
}
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPKeystoreTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPEntityTest.java
similarity index 62%
rename from core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPKeystoreTest.java
rename to core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPEntityTest.java
index 9dfbcd4..9067f12 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPKeystoreTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPEntityTest.java
@@ -18,9 +18,30 @@
*/
package org.apache.syncope.core.persistence.jpa.inner;
-import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPKeystoreDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPKeystore;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.math.BigInteger;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.KeyStore;
+import java.security.Signature;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.util.Date;
+import java.util.UUID;
import org.apache.syncope.core.persistence.jpa.AbstractTest;
+import org.apache.tika.io.IOUtils;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.transaction.annotation.Transactional;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPEntity;
+import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPEntityDAO;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Encoding;
import org.bouncycastle.asn1.ASN1Integer;
@@ -34,103 +55,87 @@ import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.asn1.x509.TBSCertificate;
import org.bouncycastle.asn1.x509.Time;
import org.bouncycastle.asn1.x509.V3TBSCertificateGenerator;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.math.BigInteger;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.KeyStore;
-import java.security.Signature;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateFactory;
-import java.util.Base64;
-import java.util.Date;
-import java.util.UUID;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
@Transactional("Master")
-public class SAML2SPKeystoreTest extends AbstractTest {
-
- @Autowired
- private SAML2SPKeystoreDAO saml2SPKeystoreDAO;
+public class SAML2SPEntityTest extends AbstractTest {
private static Certificate createSelfSignedCert(final KeyPair keyPair) throws Exception {
- final X500Name dn = new X500Name("cn=Unknown");
- final V3TBSCertificateGenerator certGen = new V3TBSCertificateGenerator();
+ X500Name dn = new X500Name("cn=Unknown");
+ V3TBSCertificateGenerator certGen = new V3TBSCertificateGenerator();
certGen.setSerialNumber(new ASN1Integer(BigInteger.valueOf(1)));
certGen.setIssuer(dn);
certGen.setSubject(dn);
certGen.setStartDate(new Time(new Date(System.currentTimeMillis() - 1000L)));
- final Date expiration = new Date(System.currentTimeMillis() + 100000);
+ Date expiration = new Date(System.currentTimeMillis() + 100000);
certGen.setEndDate(new Time(expiration));
- final AlgorithmIdentifier sigAlgID = new AlgorithmIdentifier(PKCSObjectIdentifiers.sha1WithRSAEncryption, DERNull.INSTANCE);
+ AlgorithmIdentifier sigAlgID = new AlgorithmIdentifier(
+ PKCSObjectIdentifiers.sha1WithRSAEncryption, DERNull.INSTANCE);
certGen.setSignature(sigAlgID);
certGen.setSubjectPublicKeyInfo(SubjectPublicKeyInfo.getInstance(keyPair.getPublic().getEncoded()));
- final Signature sig = Signature.getInstance("SHA1WithRSA");
+ Signature sig = Signature.getInstance("SHA1WithRSA");
sig.initSign(keyPair.getPrivate());
sig.update(certGen.generateTBSCertificate().getEncoded(ASN1Encoding.DER));
- final TBSCertificate tbsCert = certGen.generateTBSCertificate();
- final ASN1EncodableVector v = new ASN1EncodableVector();
+ TBSCertificate tbsCert = certGen.generateTBSCertificate();
+ ASN1EncodableVector v = new ASN1EncodableVector();
v.add(tbsCert);
v.add(sigAlgID);
v.add(new DERBitString(sig.sign()));
- final Certificate cert = CertificateFactory.getInstance("X.509")
- .generateCertificate(new ByteArrayInputStream(new DERSequence(v).getEncoded(ASN1Encoding.DER)));
+ Certificate cert = CertificateFactory.getInstance("X.509").
+ generateCertificate(new ByteArrayInputStream(new DERSequence(v).getEncoded(ASN1Encoding.DER)));
cert.verify(keyPair.getPublic());
return cert;
}
+ @Autowired
+ private SAML2SPEntityDAO saml2SPEntityDAO;
+
@Test
public void find() throws Exception {
create("Syncope");
- SAML2SPKeystore saml2SPKeystore = saml2SPKeystoreDAO.findByOwner("Syncope");
- assertNotNull(saml2SPKeystore);
+ SAML2SPEntity entity = saml2SPEntityDAO.find("Syncope");
+ assertNotNull(entity);
- saml2SPKeystore = saml2SPKeystoreDAO.findByOwner(UUID.randomUUID().toString());
- assertNull(saml2SPKeystore);
+ entity = saml2SPEntityDAO.find(UUID.randomUUID().toString());
+ assertNull(entity);
}
@Test
public void save() throws Exception {
- final SAML2SPKeystore keystore = create("SyncopeCreate");
- final KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
+ SAML2SPEntity created = create("SyncopeCreate");
+
+ KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
char[] pwdArray = "password".toCharArray();
- ks.load(new ByteArrayInputStream(Base64.getDecoder().decode(keystore.getKeystore())), pwdArray);
+ ks.load(new ByteArrayInputStream(created.getKeystore()), pwdArray);
assertTrue(ks.size() > 0);
}
@Test
public void update() throws Exception {
- SAML2SPKeystore saml2SPKeystore = create("SyncopeUpdate");
- assertNotNull(saml2SPKeystore);
- saml2SPKeystore.setOwner("OtherSyncope");
-
- saml2SPKeystore = saml2SPKeystoreDAO.save(saml2SPKeystore);
- assertNotNull(saml2SPKeystore);
- assertNotNull(saml2SPKeystore.getKey());
- SAML2SPKeystore found = saml2SPKeystoreDAO.findByOwner(saml2SPKeystore.getOwner());
+ SAML2SPEntity entity = create("SyncopeUpdate");
+ assertNotNull(entity);
+ entity.setKey("OtherSyncope");
+
+ entity = saml2SPEntityDAO.save(entity);
+ assertNotNull(entity);
+
+ entityManager().flush();
+
+ SAML2SPEntity found = saml2SPEntityDAO.find(entity.getKey());
assertNotNull(found);
- assertEquals("OtherSyncope", found.getOwner());
+ assertEquals("OtherSyncope", found.getKey());
}
- private SAML2SPKeystore create(final String owner) throws Exception {
- final SAML2SPKeystore saml2SPKeystore = entityFactory.newEntity(SAML2SPKeystore.class);
- saml2SPKeystore.setOwner(owner);
+ private SAML2SPEntity create(final String owner) throws Exception {
+ SAML2SPEntity entity = entityFactory.newEntity(SAML2SPEntity.class);
+ entity.setKey(owner);
+ entity.setMetadata(IOUtils.toByteArray(new ClassPathResource("sp-metadata.xml").getInputStream()));
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
char[] pwdArray = "password".toCharArray();
@@ -140,18 +145,17 @@ public class SAML2SPKeystoreTest extends AbstractTest {
keyPairGenerator.initialize(4096);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
Certificate certificate = createSelfSignedCert(keyPair);
- ks.setKeyEntry("main", keyPair.getPrivate(), "password".toCharArray(), new Certificate[]{certificate});
+ ks.setKeyEntry("main", keyPair.getPrivate(), "password".toCharArray(), new Certificate[] { certificate });
try (ByteArrayOutputStream fos = new ByteArrayOutputStream()) {
ks.store(fos, pwdArray);
fos.flush();
- String keystore = Base64.getEncoder().encodeToString(fos.toByteArray());
- saml2SPKeystore.setKeystore(keystore);
+ entity.setKeystore(fos.toByteArray());
}
- saml2SPKeystoreDAO.save(saml2SPKeystore);
- assertNotNull(saml2SPKeystore);
- assertNotNull(saml2SPKeystore.getKey());
- assertNotNull(saml2SPKeystoreDAO.findByOwner(saml2SPKeystore.getOwner()));
- return saml2SPKeystore;
+ assertNotNull(entity.getKeystore());
+
+ entity = saml2SPEntityDAO.save(entity);
+ assertNotNull(saml2SPEntityDAO.find(entity.getKey()));
+ return entity;
}
}
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPMetadataTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPMetadataTest.java
deleted file mode 100644
index f6cbeae..0000000
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPMetadataTest.java
+++ /dev/null
@@ -1,83 +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.persistence.jpa.inner;
-
-import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPMetadataDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPMetadata;
-import org.apache.syncope.core.persistence.jpa.AbstractTest;
-import org.apache.tika.io.IOUtils;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.UUID;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-@Transactional("Master")
-public class SAML2SPMetadataTest extends AbstractTest {
-
- @Autowired
- private SAML2SPMetadataDAO saml2SPMetadataDAO;
-
- @Test
- public void find() throws Exception {
- create("Syncope");
- SAML2SPMetadata saml2SPMetadata = saml2SPMetadataDAO.findByOwner("Syncope");
- assertNotNull(saml2SPMetadata);
-
- saml2SPMetadata = saml2SPMetadataDAO.findByOwner(UUID.randomUUID().toString());
- assertNull(saml2SPMetadata);
- }
-
- @Test
- public void save() throws Exception {
- create("SyncopeCreate");
- }
-
- @Test
- public void update() throws Exception {
- SAML2SPMetadata saml2SPMetadata = create("SyncopeUpdate");
- assertNotNull(saml2SPMetadata);
- saml2SPMetadata.setOwner("OtherSyncope");
-
- saml2SPMetadata = saml2SPMetadataDAO.save(saml2SPMetadata);
- assertNotNull(saml2SPMetadata);
- assertNotNull(saml2SPMetadata.getKey());
- SAML2SPMetadata found = saml2SPMetadataDAO.findByOwner(saml2SPMetadata.getOwner());
- assertNotNull(found);
- assertEquals("OtherSyncope", found.getOwner());
- }
-
- private SAML2SPMetadata create(final String owner) throws Exception {
- SAML2SPMetadata saml2SPMetadata = entityFactory.newEntity(SAML2SPMetadata.class);
- saml2SPMetadata.setOwner(owner);
- String metadata = IOUtils.toString(new ClassPathResource("sp-metadata.xml").getInputStream());
- saml2SPMetadata.setMetadata(metadata);
- saml2SPMetadataDAO.save(saml2SPMetadata);
- assertNotNull(saml2SPMetadata);
- assertNotNull(saml2SPMetadata.getKey());
- assertNotNull(saml2SPMetadataDAO.findByOwner(saml2SPMetadata.getOwner()));
- return saml2SPMetadata;
- }
-
-}
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPTest.java
index e19798e..7f77bcb 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/SAML2SPTest.java
@@ -27,12 +27,12 @@ import java.util.UUID;
import org.apache.syncope.common.lib.types.XmlSecAlgorithm;
import org.apache.syncope.common.lib.types.SAML2SPNameId;
import org.apache.syncope.core.persistence.api.dao.auth.SAML2SPDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SP;
import org.apache.syncope.core.persistence.api.entity.policy.AccessPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.AuthPolicy;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPClientApp;
@Transactional("Master")
public class SAML2SPTest extends AbstractClientAppTest {
@@ -43,7 +43,7 @@ public class SAML2SPTest extends AbstractClientAppTest {
@Test
public void find() {
int beforeCount = saml2spDAO.findAll().size();
- SAML2SP sp = entityFactory.newEntity(SAML2SP.class);
+ SAML2SPClientApp sp = entityFactory.newEntity(SAML2SPClientApp.class);
sp.setName("SAML2");
sp.setClientAppId(UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE);
sp.setDescription("This is a sample SAML2 SP");
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PolicyTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PolicyTest.java
index b9e73e1..98473d6 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PolicyTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PolicyTest.java
@@ -31,13 +31,14 @@ import org.springframework.transaction.annotation.Transactional;
import javax.persistence.PersistenceException;
import java.util.UUID;
import org.apache.syncope.core.persistence.api.dao.auth.OIDCRPDAO;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import org.apache.syncope.core.persistence.api.entity.auth.OIDCRPClientApp;
+
@Transactional("Master")
public class PolicyTest extends AbstractClientAppTest {
@@ -54,7 +55,7 @@ public class PolicyTest extends AbstractClientAppTest {
AuthPolicy authPolicy = buildAndSaveAuthPolicy();
// Create new client app and assign policy
- OIDCRP rp = entityFactory.newEntity(OIDCRP.class);
+ OIDCRPClientApp rp = entityFactory.newEntity(OIDCRPClientApp.class);
rp.setName("OIDC");
rp.setClientAppId(UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE);
rp.setDescription("This is a sample OIDC RP");
@@ -82,7 +83,7 @@ public class PolicyTest extends AbstractClientAppTest {
assertNotNull(realm);
// Create new client app and assign policy
- OIDCRP rp = entityFactory.newEntity(OIDCRP.class);
+ OIDCRPClientApp rp = entityFactory.newEntity(OIDCRPClientApp.class);
rp.setName("OIDC");
rp.setClientAppId(UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE);
rp.setDescription("This is a sample OIDC RP");
diff --git a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
index 97affb1..b3fc14e 100644
--- a/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
+++ b/core/persistence-jpa/src/test/resources/domains/MasterContent.xml
@@ -72,7 +72,7 @@ under the License.
<AuthModule id="DefaultOIDCAuthModule"
description="OIDC auth module" jsonConf='{"_class":"org.apache.syncope.common.lib.auth.OIDCAuthModuleConf","discoveryUri":"https://accounts.google.com/.well-known/openid-configuration", "id":"client-id", "secret": "client-secret" }'/>
<AuthModule id="DefaultSAML2IdPAuthModule"
- description="SAML2 IdP auth module" jsonConf='{"_class":"org.apache.syncope.common.lib.auth.SAML2IdPAuthModuleConf","keystorePassword":"p@$$word","privateKeyPassword":"p@$$word","identityProviderMetadataPath":"classpath:/idp-metadata.xml", "serviceProviderEntityId":"syncope:apache:org"}'/>
+ description="SAML2 IdP auth module" jsonConf='{"_class":"org.apache.syncope.common.lib.auth.SAML2IdPAuthModuleConf","keystorePassword":"p@$$word","privateKeyPassword":"p@$$word","identityProviderMetadataPath":"http://localhost:9080/syncope-wa/idp/metadata", "serviceProviderEntityId":"syncope:apache:org"}'/>
<AuthModule id="DefaultJaasAuthModule"
description="Jaas auth module" jsonConf='{"_class":"org.apache.syncope.common.lib.auth.JaasAuthModuleConf","realm":"SYNCOPE","kerberosRealmSystemProperty":"sample-value", "loginConfigType": "JavaLoginConfig", "loginConfigurationFile": "file:/etc/jaas/login.conf"}'/>
<AuthModule id="DefaultStaticAuthModule"
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2SPKeystoreBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2IdPEntityDataBinder.java
similarity index 74%
rename from core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2SPKeystoreBinder.java
rename to core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2IdPEntityDataBinder.java
index e0cc306..4a5bddf 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2SPKeystoreBinder.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2IdPEntityDataBinder.java
@@ -18,15 +18,14 @@
*/
package org.apache.syncope.core.provisioning.api.data;
-import org.apache.syncope.common.lib.to.SAML2SPKeystoreTO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPKeystore;
+import org.apache.syncope.common.lib.to.SAML2IdPEntityTO;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPEntity;
-public interface SAML2SPKeystoreBinder {
+public interface SAML2IdPEntityDataBinder {
- SAML2SPKeystore create(SAML2SPKeystoreTO keystoreTO);
+ SAML2IdPEntity create(SAML2IdPEntityTO entityTO);
- SAML2SPKeystore update(SAML2SPKeystore keystore, SAML2SPKeystoreTO keystoreTO);
-
- SAML2SPKeystoreTO getSAML2SPKeystoreTO(SAML2SPKeystore keystore);
+ SAML2IdPEntity update(SAML2IdPEntity entity, SAML2IdPEntityTO entityTO);
+ SAML2IdPEntityTO getSAML2IdPEntityTO(SAML2IdPEntity entity);
}
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2IdPMetadataDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2IdPMetadataDataBinder.java
deleted file mode 100644
index 3cabfbb..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2IdPMetadataDataBinder.java
+++ /dev/null
@@ -1,32 +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.provisioning.api.data;
-
-import org.apache.syncope.common.lib.to.SAML2IdPMetadataTO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPMetadata;
-
-public interface SAML2IdPMetadataDataBinder {
-
- SAML2IdPMetadata create(SAML2IdPMetadataTO saml2IdPMetadataTO);
-
- SAML2IdPMetadata update(SAML2IdPMetadata saml2IdPMetadata, SAML2IdPMetadataTO saml2IdPMetadataTO);
-
- SAML2IdPMetadataTO getSAML2IdPMetadataTO(SAML2IdPMetadata saml2IdPMetadata);
-
-}
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2SPMetadataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2SPEntityDataBinder.java
similarity index 74%
rename from core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2SPMetadataBinder.java
rename to core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2SPEntityDataBinder.java
index c49d64f..450acb5 100644
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2SPMetadataBinder.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/SAML2SPEntityDataBinder.java
@@ -18,15 +18,14 @@
*/
package org.apache.syncope.core.provisioning.api.data;
-import org.apache.syncope.common.lib.to.SAML2SPMetadataTO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPMetadata;
+import org.apache.syncope.common.lib.to.SAML2SPEntityTO;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPEntity;
-public interface SAML2SPMetadataBinder {
+public interface SAML2SPEntityDataBinder {
- SAML2SPMetadata create(SAML2SPMetadataTO metadataTO);
+ SAML2SPEntity create(SAML2SPEntityTO entityTO);
- SAML2SPMetadata update(SAML2SPMetadata metadata, SAML2SPMetadataTO metadataTO);
-
- SAML2SPMetadataTO getSAML2SPMetadataTO(SAML2SPMetadata metadata);
+ SAML2SPEntity update(SAML2SPEntity entity, SAML2SPEntityTO entityTO);
+ SAML2SPEntityTO getSAML2SPEntityTO(SAML2SPEntity entity);
}
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ClientAppDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ClientAppDataBinderImpl.java
index ee766e3..9ccbf91 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ClientAppDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ClientAppDataBinderImpl.java
@@ -19,17 +19,14 @@
package org.apache.syncope.core.provisioning.java.data;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.CASSPTO;
+import org.apache.syncope.common.lib.to.CASSPClientAppTO;
import org.apache.syncope.common.lib.to.ClientAppTO;
-import org.apache.syncope.common.lib.to.OIDCRPTO;
-import org.apache.syncope.common.lib.to.SAML2SPTO;
+import org.apache.syncope.common.lib.to.OIDCRPClientAppTO;
+import org.apache.syncope.common.lib.to.SAML2SPClientAppTO;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
-import org.apache.syncope.core.persistence.api.entity.auth.CASSP;
import org.apache.syncope.core.persistence.api.entity.auth.ClientApp;
-import org.apache.syncope.core.persistence.api.entity.auth.OIDCRP;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SP;
import org.apache.syncope.core.persistence.api.entity.policy.AccessPolicy;
import org.apache.syncope.core.persistence.api.entity.policy.AttrReleasePolicy;
import org.apache.syncope.core.persistence.api.entity.policy.AuthPolicy;
@@ -37,6 +34,9 @@ import org.apache.syncope.core.persistence.api.entity.policy.Policy;
import org.apache.syncope.core.provisioning.api.data.ClientAppDataBinder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.CASSPClientApp;
+import org.apache.syncope.core.persistence.api.entity.auth.OIDCRPClientApp;
@Component
public class ClientAppDataBinderImpl implements ClientAppDataBinder {
@@ -50,12 +50,12 @@ public class ClientAppDataBinderImpl implements ClientAppDataBinder {
@Override
@SuppressWarnings("unchecked")
public <T extends ClientApp> T create(final ClientAppTO clientAppTO) {
- if (clientAppTO instanceof SAML2SPTO) {
- return (T) doCreate((SAML2SPTO) clientAppTO);
- } else if (clientAppTO instanceof OIDCRPTO) {
- return (T) doCreate((OIDCRPTO) clientAppTO);
- } else if (clientAppTO instanceof CASSPTO) {
- return (T) doCreate((CASSPTO) clientAppTO);
+ if (clientAppTO instanceof SAML2SPClientAppTO) {
+ return (T) doCreate((SAML2SPClientAppTO) clientAppTO);
+ } else if (clientAppTO instanceof OIDCRPClientAppTO) {
+ return (T) doCreate((OIDCRPClientAppTO) clientAppTO);
+ } else if (clientAppTO instanceof CASSPClientAppTO) {
+ return (T) doCreate((CASSPClientAppTO) clientAppTO);
} else {
throw new IllegalArgumentException("Unsupported client app: " + clientAppTO.getClass().getName());
}
@@ -63,12 +63,12 @@ public class ClientAppDataBinderImpl implements ClientAppDataBinder {
@Override
public <T extends ClientApp> void update(final T clientApp, final ClientAppTO clientAppTO) {
- if (clientAppTO instanceof SAML2SPTO) {
- doUpdate((SAML2SP) clientApp, (SAML2SPTO) clientAppTO);
- } else if (clientAppTO instanceof OIDCRPTO) {
- doUpdate((OIDCRP) clientApp, (OIDCRPTO) clientAppTO);
- } else if (clientAppTO instanceof CASSPTO) {
- doUpdate((CASSP) clientApp, (CASSPTO) clientAppTO);
+ if (clientAppTO instanceof SAML2SPClientAppTO) {
+ doUpdate((SAML2SPClientApp) clientApp, (SAML2SPClientAppTO) clientAppTO);
+ } else if (clientAppTO instanceof OIDCRPClientAppTO) {
+ doUpdate((OIDCRPClientApp) clientApp, (OIDCRPClientAppTO) clientAppTO);
+ } else if (clientAppTO instanceof CASSPClientAppTO) {
+ doUpdate((CASSPClientApp) clientApp, (CASSPClientAppTO) clientAppTO);
} else {
throw new IllegalArgumentException("Unsupported client app: " + clientAppTO.getClass().getName());
}
@@ -77,31 +77,31 @@ public class ClientAppDataBinderImpl implements ClientAppDataBinder {
@Override
@SuppressWarnings("unchecked")
public <T extends ClientAppTO> T getClientAppTO(final ClientApp clientApp) {
- if (clientApp instanceof SAML2SP) {
- return (T) getSAMLClientAppTO((SAML2SP) clientApp);
+ if (clientApp instanceof SAML2SPClientApp) {
+ return (T) getSAMLClientAppTO((SAML2SPClientApp) clientApp);
}
- if (clientApp instanceof OIDCRP) {
- return (T) getOIDCClientAppTO((OIDCRP) clientApp);
+ if (clientApp instanceof OIDCRPClientApp) {
+ return (T) getOIDCClientAppTO((OIDCRPClientApp) clientApp);
}
- if (clientApp instanceof CASSP) {
- return (T) getCASClientAppTO((CASSP) clientApp);
+ if (clientApp instanceof CASSPClientApp) {
+ return (T) getCASClientAppTO((CASSPClientApp) clientApp);
}
throw new IllegalArgumentException("Unsupported client app: " + clientApp.getClass().getName());
}
- private SAML2SP doCreate(final SAML2SPTO clientAppTO) {
- SAML2SP saml2sp = entityFactory.newEntity(SAML2SP.class);
+ private SAML2SPClientApp doCreate(final SAML2SPClientAppTO clientAppTO) {
+ SAML2SPClientApp saml2sp = entityFactory.newEntity(SAML2SPClientApp.class);
update(saml2sp, clientAppTO);
return saml2sp;
}
- private CASSP doCreate(final CASSPTO clientAppTO) {
- CASSP saml2sp = entityFactory.newEntity(CASSP.class);
+ private CASSPClientApp doCreate(final CASSPClientAppTO clientAppTO) {
+ CASSPClientApp saml2sp = entityFactory.newEntity(CASSPClientApp.class);
update(saml2sp, clientAppTO);
return saml2sp;
}
- private void doUpdate(final SAML2SP clientApp, final SAML2SPTO clientAppTO) {
+ private void doUpdate(final SAML2SPClientApp clientApp, final SAML2SPClientAppTO clientAppTO) {
copyToEntity(clientApp, clientAppTO);
clientApp.setEntityId(clientAppTO.getEntityId());
@@ -160,8 +160,8 @@ public class ClientAppDataBinderImpl implements ClientAppDataBinder {
clientAppTO.getProperties().addAll(clientApp.getProperties());
}
- private static SAML2SPTO getSAMLClientAppTO(final SAML2SP clientApp) {
- SAML2SPTO clientAppTO = new SAML2SPTO();
+ private static SAML2SPClientAppTO getSAMLClientAppTO(final SAML2SPClientApp clientApp) {
+ SAML2SPClientAppTO clientAppTO = new SAML2SPClientAppTO();
copyToTO(clientApp, clientAppTO);
clientAppTO.setEntityId(clientApp.getEntityId());
@@ -195,13 +195,13 @@ public class ClientAppDataBinderImpl implements ClientAppDataBinder {
return clientAppTO;
}
- private OIDCRP doCreate(final OIDCRPTO clientAppTO) {
- OIDCRP oidcrp = entityFactory.newEntity(OIDCRP.class);
+ private OIDCRPClientApp doCreate(final OIDCRPClientAppTO clientAppTO) {
+ OIDCRPClientApp oidcrp = entityFactory.newEntity(OIDCRPClientApp.class);
update(oidcrp, clientAppTO);
return oidcrp;
}
- private void doUpdate(final OIDCRP clientApp, final OIDCRPTO clientAppTO) {
+ private void doUpdate(final OIDCRPClientApp clientApp, final OIDCRPClientAppTO clientAppTO) {
copyToEntity(clientApp, clientAppTO);
clientApp.setClientSecret(clientAppTO.getClientSecret());
@@ -218,8 +218,8 @@ public class ClientAppDataBinderImpl implements ClientAppDataBinder {
clientApp.setLogoutUri(clientAppTO.getLogoutUri());
}
- private static OIDCRPTO getOIDCClientAppTO(final OIDCRP clientApp) {
- OIDCRPTO clientAppTO = new OIDCRPTO();
+ private static OIDCRPClientAppTO getOIDCClientAppTO(final OIDCRPClientApp clientApp) {
+ OIDCRPClientAppTO clientAppTO = new OIDCRPClientAppTO();
copyToTO(clientApp, clientAppTO);
clientAppTO.setClientId(clientApp.getClientId());
@@ -234,14 +234,14 @@ public class ClientAppDataBinderImpl implements ClientAppDataBinder {
return clientAppTO;
}
- private void doUpdate(final CASSP clientApp, final CASSPTO clientAppTO) {
+ private void doUpdate(final CASSPClientApp clientApp, final CASSPClientAppTO clientAppTO) {
copyToEntity(clientApp, clientAppTO);
clientApp.setServiceId(clientAppTO.getServiceId());
}
- private static CASSPTO getCASClientAppTO(final CASSP clientApp) {
- CASSPTO clientAppTO = new CASSPTO();
+ private static CASSPClientAppTO getCASClientAppTO(final CASSPClientApp clientApp) {
+ CASSPClientAppTO clientAppTO = new CASSPClientAppTO();
copyToTO(clientApp, clientAppTO);
clientAppTO.setServiceId(clientApp.getServiceId());
return clientAppTO;
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPEntityDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPEntityDataBinderImpl.java
new file mode 100644
index 0000000..abdbec2
--- /dev/null
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPEntityDataBinderImpl.java
@@ -0,0 +1,84 @@
+/*
+ * 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.provisioning.java.data;
+
+import java.util.Base64;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.apache.syncope.common.lib.to.SAML2IdPEntityTO;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPEntity;
+import org.apache.syncope.core.provisioning.api.data.SAML2IdPEntityDataBinder;
+
+@Component
+public class SAML2IdPEntityDataBinderImpl implements SAML2IdPEntityDataBinder {
+
+ @Autowired
+ private EntityFactory entityFactory;
+
+ @Override
+ public SAML2IdPEntity create(final SAML2IdPEntityTO entityTO) {
+ SAML2IdPEntity entity = entityFactory.newEntity(SAML2IdPEntity.class);
+ entity.setKey(entityTO.getKey());
+ return update(entity, entityTO);
+ }
+
+ @Override
+ public SAML2IdPEntity update(final SAML2IdPEntity entity, final SAML2IdPEntityTO entityTO) {
+ entity.setEncryptionCertificate(entityTO.getEncryptionCertificate() == null
+ ? null
+ : Base64.getDecoder().decode(entityTO.getEncryptionCertificate()));
+ entity.setEncryptionKey(entityTO.getEncryptionKey() == null
+ ? null
+ : Base64.getDecoder().decode(entityTO.getEncryptionKey()));
+ entity.setMetadata(entityTO.getMetadata() == null
+ ? null
+ : Base64.getDecoder().decode(entityTO.getMetadata()));
+ entity.setSigningCertificate(entityTO.getSigningCertificate() == null
+ ? null
+ : Base64.getDecoder().decode(entityTO.getSigningCertificate()));
+ entity.setSigningKey(entityTO.getSigningKey() == null
+ ? null
+ : Base64.getDecoder().decode(entityTO.getSigningKey()));
+ return entity;
+ }
+
+ @Override
+ public SAML2IdPEntityTO getSAML2IdPEntityTO(final SAML2IdPEntity entity) {
+ SAML2IdPEntityTO entityTO = new SAML2IdPEntityTO();
+ entityTO.setKey(entity.getKey());
+ entityTO.setMetadata(Base64.getEncoder().encodeToString(entity.getMetadata()));
+ if (entity.getEncryptionCertificate() != null) {
+ entityTO.setEncryptionCertificate(
+ Base64.getEncoder().encodeToString(entity.getEncryptionCertificate()));
+ }
+ if (entity.getEncryptionKey() != null) {
+ entityTO.setEncryptionKey(
+ Base64.getEncoder().encodeToString(entity.getEncryptionKey()));
+ }
+ if (entity.getSigningCertificate() != null) {
+ entityTO.setSigningCertificate(
+ Base64.getEncoder().encodeToString(entity.getSigningCertificate()));
+ }
+ if (entity.getSigningKey() != null) {
+ entityTO.setSigningKey(Base64.getEncoder().encodeToString(entity.getSigningKey()));
+ }
+ return entityTO;
+ }
+}
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPMetadataDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPMetadataDataBinderImpl.java
deleted file mode 100644
index 2d17168..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPMetadataDataBinderImpl.java
+++ /dev/null
@@ -1,80 +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.provisioning.java.data;
-
-import org.apache.syncope.core.persistence.api.entity.EntityFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.apache.syncope.common.lib.to.SAML2IdPMetadataTO;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2IdPMetadata;
-import org.apache.syncope.core.provisioning.api.data.SAML2IdPMetadataDataBinder;
-
-@Component
-public class SAML2IdPMetadataDataBinderImpl implements SAML2IdPMetadataDataBinder {
-
- @Autowired
- private EntityFactory entityFactory;
-
- private SAML2IdPMetadata getSAML2IdPMetadata(
- final SAML2IdPMetadata saml2IdPMetadata,
- final SAML2IdPMetadataTO saml2IdPMetadataTO) {
-
- SAML2IdPMetadata saml2IdPMetadataResult = saml2IdPMetadata;
- if (saml2IdPMetadataResult == null) {
- saml2IdPMetadataResult = entityFactory.newEntity(SAML2IdPMetadata.class);
- }
-
- saml2IdPMetadataResult.setEncryptionCertificate(saml2IdPMetadataTO.getEncryptionCertificate());
- saml2IdPMetadataResult.setEncryptionKey(saml2IdPMetadataTO.getEncryptionKey());
- saml2IdPMetadataResult.setMetadata(saml2IdPMetadataTO.getMetadata());
- saml2IdPMetadataResult.setSigningCertificate(saml2IdPMetadataTO.getSigningCertificate());
- saml2IdPMetadataResult.setSigningKey(saml2IdPMetadataTO.getSigningKey());
- saml2IdPMetadataResult.setAppliesTo(saml2IdPMetadataTO.getAppliesTo());
-
- return saml2IdPMetadataResult;
- }
-
- @Override
- public SAML2IdPMetadata create(final SAML2IdPMetadataTO saml2IdPMetadataTO) {
- return update(entityFactory.newEntity(SAML2IdPMetadata.class), saml2IdPMetadataTO);
- }
-
- @Override
- public SAML2IdPMetadata update(
- final SAML2IdPMetadata saml2IdPMetadata,
- final SAML2IdPMetadataTO saml2IdPMetadataTO) {
-
- return getSAML2IdPMetadata(saml2IdPMetadata, saml2IdPMetadataTO);
- }
-
- @Override
- public SAML2IdPMetadataTO getSAML2IdPMetadataTO(final SAML2IdPMetadata saml2IdPMetadata) {
- SAML2IdPMetadataTO saml2IdPMetadataTO = new SAML2IdPMetadataTO();
-
- saml2IdPMetadataTO.setKey(saml2IdPMetadata.getKey());
- saml2IdPMetadataTO.setMetadata(saml2IdPMetadata.getMetadata());
- saml2IdPMetadataTO.setEncryptionCertificate(saml2IdPMetadata.getEncryptionCertificate());
- saml2IdPMetadataTO.setEncryptionKey(saml2IdPMetadata.getEncryptionKey());
- saml2IdPMetadataTO.setSigningCertificate(saml2IdPMetadata.getSigningCertificate());
- saml2IdPMetadataTO.setSigningKey(saml2IdPMetadata.getSigningKey());
- saml2IdPMetadataTO.setAppliesTo(saml2IdPMetadata.getAppliesTo());
-
- return saml2IdPMetadataTO;
- }
-}
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2SPEntityDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2SPEntityDataBinderImpl.java
new file mode 100644
index 0000000..4d92591
--- /dev/null
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2SPEntityDataBinderImpl.java
@@ -0,0 +1,65 @@
+/*
+ * 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.provisioning.java.data;
+
+import java.util.Base64;
+import org.apache.syncope.common.lib.to.SAML2SPEntityTO;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPEntity;
+import org.apache.syncope.core.provisioning.api.data.SAML2SPEntityDataBinder;
+
+@Component
+public class SAML2SPEntityDataBinderImpl implements SAML2SPEntityDataBinder {
+
+ @Autowired
+ private EntityFactory entityFactory;
+
+ @Override
+ public SAML2SPEntity create(final SAML2SPEntityTO entityTO) {
+ SAML2SPEntity entity = entityFactory.newEntity(SAML2SPEntity.class);
+ entity.setKey(entityTO.getKey());
+ return update(entity, entityTO);
+ }
+
+ @Override
+ public SAML2SPEntity update(final SAML2SPEntity entity, final SAML2SPEntityTO entityTO) {
+ entity.setKeystore(entityTO.getKeystore() == null
+ ? null
+ : Base64.getDecoder().decode(entityTO.getKeystore()));
+ entity.setMetadata(entityTO.getMetadata() == null
+ ? null
+ : Base64.getDecoder().decode(entityTO.getMetadata()));
+ return entity;
+ }
+
+ @Override
+ public SAML2SPEntityTO getSAML2SPEntityTO(final SAML2SPEntity entity) {
+ SAML2SPEntityTO entityTO = new SAML2SPEntityTO();
+ entityTO.setKey(entity.getKey());
+ if (entity.getKeystore() != null) {
+ entityTO.setKeystore(Base64.getEncoder().encodeToString(entity.getKeystore()));
+ }
+ if (entity.getMetadata() != null) {
+ entityTO.setMetadata(Base64.getEncoder().encodeToString(entity.getMetadata()));
+ }
+ return entityTO;
+ }
+}
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2SPKeystoreBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2SPKeystoreBinderImpl.java
deleted file mode 100644
index 02fd805..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2SPKeystoreBinderImpl.java
+++ /dev/null
@@ -1,71 +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.provisioning.java.data;
-
-import org.apache.syncope.common.lib.to.SAML2SPKeystoreTO;
-import org.apache.syncope.core.persistence.api.entity.EntityFactory;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPKeystore;
-import org.apache.syncope.core.provisioning.api.data.SAML2SPKeystoreBinder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class SAML2SPKeystoreBinderImpl implements SAML2SPKeystoreBinder {
-
- @Autowired
- private EntityFactory entityFactory;
-
- private SAML2SPKeystore getSAML2SPKeystore(
- final SAML2SPKeystore keystore,
- final SAML2SPKeystoreTO keystoreTO) {
-
- SAML2SPKeystore result = keystore;
- if (result == null) {
- result = entityFactory.newEntity(SAML2SPKeystore.class);
- }
- result.setKeystore(keystoreTO.getKeystore());
- result.setOwner(keystoreTO.getOwner());
-
- return result;
- }
-
- @Override
- public SAML2SPKeystore create(final SAML2SPKeystoreTO keystoreTO) {
- return update(entityFactory.newEntity(SAML2SPKeystore.class), keystoreTO);
- }
-
- @Override
- public SAML2SPKeystore update(
- final SAML2SPKeystore keystore,
- final SAML2SPKeystoreTO keystoreTO) {
-
- return getSAML2SPKeystore(keystore, keystoreTO);
- }
-
- @Override
- public SAML2SPKeystoreTO getSAML2SPKeystoreTO(final SAML2SPKeystore keystore) {
- SAML2SPKeystoreTO keystoreTO = new SAML2SPKeystoreTO();
-
- keystoreTO.setKey(keystore.getKey());
- keystoreTO.setKeystore(keystore.getKeystore());
- keystoreTO.setOwner(keystore.getOwner());
-
- return keystoreTO;
- }
-}
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2SPMetadataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2SPMetadataBinderImpl.java
deleted file mode 100644
index 3e4e62b..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2SPMetadataBinderImpl.java
+++ /dev/null
@@ -1,72 +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.provisioning.java.data;
-
-import org.apache.syncope.common.lib.to.SAML2SPMetadataTO;
-import org.apache.syncope.core.persistence.api.entity.EntityFactory;
-import org.apache.syncope.core.persistence.api.entity.auth.SAML2SPMetadata;
-import org.apache.syncope.core.provisioning.api.data.SAML2SPMetadataBinder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class SAML2SPMetadataBinderImpl implements SAML2SPMetadataBinder {
-
- @Autowired
- private EntityFactory entityFactory;
-
- private SAML2SPMetadata getSAML2SPMetadata(
- final SAML2SPMetadata metadata,
- final SAML2SPMetadataTO metadataTO) {
-
- SAML2SPMetadata result = metadata;
- if (result == null) {
- result = entityFactory.newEntity(SAML2SPMetadata.class);
- }
-
- result.setMetadata(metadataTO.getMetadata());
- result.setOwner(metadataTO.getOwner());
-
- return result;
- }
-
- @Override
- public SAML2SPMetadata create(final SAML2SPMetadataTO metadataTO) {
- return update(entityFactory.newEntity(SAML2SPMetadata.class), metadataTO);
- }
-
- @Override
- public SAML2SPMetadata update(
- final SAML2SPMetadata metadata,
- final SAML2SPMetadataTO metadataTO) {
-
- return getSAML2SPMetadata(metadata, metadataTO);
- }
-
- @Override
- public SAML2SPMetadataTO getSAML2SPMetadataTO(final SAML2SPMetadata saml2IdPMetadata) {
- SAML2SPMetadataTO metadataTO = new SAML2SPMetadataTO();
-
- metadataTO.setKey(saml2IdPMetadata.getKey());
- metadataTO.setMetadata(saml2IdPMetadata.getMetadata());
- metadataTO.setOwner(saml2IdPMetadata.getOwner());
-
- return metadataTO;
- }
-}
diff --git a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDirectoryPanel.java b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDirectoryPanel.java
index a0f2de3..5137116 100644
--- a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDirectoryPanel.java
+++ b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutesDirectoryPanel.java
@@ -26,7 +26,6 @@ import java.util.List;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.ui.commons.DirectoryDataProvider;
import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
-import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.panels.CamelRoutesDirectoryPanel.CamelRoutesProvider;
import org.apache.syncope.client.console.rest.CamelRoutesRestClient;
import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
@@ -35,6 +34,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
import org.apache.syncope.client.ui.commons.Constants;
+import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
import org.apache.syncope.common.lib.to.CamelRouteTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.CamelEntitlement;
@@ -132,7 +132,7 @@ public class CamelRoutesDirectoryPanel extends DirectoryPanel<
LOG.error("While creating or updating CamelRouteTO", e);
error(getString(Constants.ERROR) + ": " + e.getMessage());
}
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ ((BaseWebPage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
});
diff --git a/ext/flowable/client-console/src/main/java/org/apache/syncope/client/console/panels/BpmnProcessDirectoryPanel.java b/ext/flowable/client-console/src/main/java/org/apache/syncope/client/console/panels/BpmnProcessDirectoryPanel.java
index 904fd7b..0357f13 100644
--- a/ext/flowable/client-console/src/main/java/org/apache/syncope/client/console/panels/BpmnProcessDirectoryPanel.java
+++ b/ext/flowable/client-console/src/main/java/org/apache/syncope/client/console/panels/BpmnProcessDirectoryPanel.java
@@ -46,6 +46,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.ImageModalPanel;
import org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel;
import org.apache.syncope.client.console.wizards.WizardMgtPanel;
+import org.apache.syncope.client.ui.commons.pages.BaseWebPage;
import org.apache.syncope.client.ui.commons.wizards.AjaxWizardBuilder;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.BpmnProcess;
@@ -206,7 +207,7 @@ public class BpmnProcessDirectoryPanel extends DirectoryPanel<
} catch (SyncopeClientException e) {
SyncopeConsoleSession.get().onException(e);
}
- ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+ ((BaseWebPage) pageRef.getPage()).getNotificationPanel().refresh(target);
}
}
});
diff --git a/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html b/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html
index 7bd3fbd..d8372ea 100644
--- a/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html
+++ b/ext/saml2sp4ui/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2SPPanel.html
@@ -20,7 +20,7 @@ under the License.
<wicket:panel>
<div class="logviewer-btn">
<a class="btn btn-success" wicket:id="downloadMetadata">
- <span class="fa fa-download"></span> Metadata
+ <span class="fas fa-download"></span> Metadata
</a>
</div>
</wicket:panel>
diff --git a/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIIdP.java b/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIIdP.java
index fbcd4af..c6647db 100644
--- a/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIIdP.java
+++ b/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIIdP.java
@@ -53,7 +53,7 @@ public class JPASAML2SP4UIIdP extends AbstractGeneratedKeyEntity implements SAML
private static final long serialVersionUID = -392372595500355552L;
- public static final String TABLE = "SAML2IdP";
+ public static final String TABLE = "SAML2SP4UIIdP";
@Column(unique = true, nullable = false)
private String entityID;
diff --git a/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIIdPItem.java b/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIIdPItem.java
index 62db851..b76b95e 100644
--- a/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIIdPItem.java
+++ b/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIIdPItem.java
@@ -40,10 +40,10 @@ import org.apache.syncope.core.persistence.api.entity.SAML2SP4UIIdP;
@Cacheable
public class JPASAML2SP4UIIdPItem extends AbstractItem implements SAML2SP4UIIdPItem {
- public static final String TABLE = "SAML2IdPItem";
-
private static final long serialVersionUID = -597417734910639991L;
+ public static final String TABLE = "SAML2SP4UIIdPItem";
+
@ManyToOne
private JPASAML2SP4UIIdP idp;
diff --git a/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIUserTemplate.java b/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIUserTemplate.java
index e5f79ed..154bfdf 100644
--- a/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIUserTemplate.java
+++ b/ext/saml2sp4ui/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2SP4UIUserTemplate.java
@@ -33,7 +33,7 @@ public class JPASAML2SP4UIUserTemplate extends AbstractAnyTemplate implements SA
private static final long serialVersionUID = -4575039890434426856L;
- public static final String TABLE = "SAML2UserTemplate";
+ public static final String TABLE = "SAML2SP4UIUserTemplate";
@ManyToOne
private JPASAML2SP4UIIdP idp;
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 4b4e86e..90d9ad4 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
@@ -86,8 +86,8 @@ import org.apache.syncope.common.lib.to.UserTO;
import org.apache.syncope.common.lib.to.AuthModuleTO;
import org.apache.syncope.common.lib.policy.AuthPolicyTO;
import org.apache.syncope.common.lib.to.ClientAppTO;
-import org.apache.syncope.common.lib.to.OIDCRPTO;
-import org.apache.syncope.common.lib.to.SAML2SPTO;
+import org.apache.syncope.common.lib.to.OIDCRPClientAppTO;
+import org.apache.syncope.common.lib.to.SAML2SPClientAppTO;
import org.apache.syncope.common.lib.types.AnyTypeKind;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.syncope.common.lib.types.OIDCGrantType;
@@ -136,12 +136,13 @@ import org.apache.syncope.common.rest.api.service.UserSelfService;
import org.apache.syncope.common.rest.api.service.UserService;
import org.apache.syncope.common.rest.api.service.UserRequestService;
import org.apache.syncope.common.rest.api.service.BpmnProcessService;
+import org.apache.syncope.common.rest.api.service.OIDCC4UIProviderService;
+import org.apache.syncope.common.rest.api.service.OIDCC4UIService;
import org.apache.syncope.common.rest.api.service.OIDCJWKSService;
-import org.apache.syncope.common.rest.api.service.SAML2IdPMetadataService;
+import org.apache.syncope.common.rest.api.service.SAML2IdPEntityService;
import org.apache.syncope.common.rest.api.service.SAML2SP4UIIdPService;
import org.apache.syncope.common.rest.api.service.SAML2SP4UIService;
-import org.apache.syncope.common.rest.api.service.SAML2SPKeystoreService;
-import org.apache.syncope.common.rest.api.service.SAML2SPMetadataService;
+import org.apache.syncope.common.rest.api.service.SAML2SPEntityService;
import org.apache.syncope.common.rest.api.service.SRARouteService;
import org.apache.syncope.common.rest.api.service.UserWorkflowTaskService;
import org.apache.syncope.common.rest.api.service.wa.ImpersonationService;
@@ -156,8 +157,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
-import org.apache.syncope.common.rest.api.service.OIDCC4UIService;
-import org.apache.syncope.common.rest.api.service.OIDCC4UIProviderService;
@SpringJUnitConfig({ CoreITContext.class, SelfKeymasterClientContext.class, ZookeeperKeymasterClientContext.class })
public abstract class AbstractITCase {
@@ -234,8 +233,6 @@ public abstract class AbstractITCase {
protected static final String PRINTER = "PRINTER";
- protected static final String OWNER = "Syncope";
-
protected static final int MAX_WAIT_SECONDS = 50;
protected static String ANONYMOUS_UNAME;
@@ -334,11 +331,9 @@ public abstract class AbstractITCase {
protected static AuthProfileService authProfileService;
- protected static SAML2SPMetadataService saml2SPMetadataService;
-
- protected static SAML2SPKeystoreService saml2SPKeystoreService;
+ protected static SAML2SPEntityService saml2SPEntityService;
- protected static SAML2IdPMetadataService saml2IdPMetadataService;
+ protected static SAML2IdPEntityService saml2IdPEntityService;
protected static OIDCJWKSService oidcJWKSService;
@@ -349,7 +344,7 @@ public abstract class AbstractITCase {
protected static WebAuthnRegistrationService webAuthnRegistrationService;
protected static ImpersonationService impersonationService;
-
+
@BeforeAll
public static void securitySetup() {
try (InputStream propStream = AbstractITCase.class.getResourceAsStream("/security.properties")) {
@@ -421,9 +416,8 @@ public abstract class AbstractITCase {
scimConfService = adminClient.getService(SCIMConfService.class);
clientAppService = adminClient.getService(ClientAppService.class);
authModuleService = adminClient.getService(AuthModuleService.class);
- saml2SPMetadataService = adminClient.getService(SAML2SPMetadataService.class);
- saml2IdPMetadataService = adminClient.getService(SAML2IdPMetadataService.class);
- saml2SPKeystoreService = adminClient.getService(SAML2SPKeystoreService.class);
+ saml2SPEntityService = adminClient.getService(SAML2SPEntityService.class);
+ saml2IdPEntityService = adminClient.getService(SAML2IdPEntityService.class);
googleMfaAuthTokenService = adminClient.getService(GoogleMfaAuthTokenService.class);
googleMfaAuthAccountService = adminClient.getService(GoogleMfaAuthAccountService.class);
authProfileService = adminClient.getService(AuthProfileService.class);
@@ -770,7 +764,7 @@ public abstract class AbstractITCase {
return object.get();
}
- protected static OIDCRPTO buildOIDCRP() {
+ protected static OIDCRPClientAppTO buildOIDCRP() {
AuthPolicyTO authPolicyTO = new AuthPolicyTO();
authPolicyTO.setKey("AuthPolicyTest_" + getUUIDString());
authPolicyTO.setName("Authentication Policy");
@@ -783,7 +777,7 @@ public abstract class AbstractITCase {
accessPolicyTO = createPolicy(PolicyType.ACCESS, accessPolicyTO);
assertNotNull(accessPolicyTO);
- OIDCRPTO oidcrpTO = new OIDCRPTO();
+ OIDCRPClientAppTO oidcrpTO = new OIDCRPClientAppTO();
oidcrpTO.setName("ExampleRP_" + getUUIDString());
oidcrpTO.setClientAppId(UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE);
oidcrpTO.setDescription("Example OIDC RP application");
@@ -799,7 +793,7 @@ public abstract class AbstractITCase {
return oidcrpTO;
}
- protected static SAML2SPTO buildSAML2SP() {
+ protected static SAML2SPClientAppTO buildSAML2SP() {
AuthPolicyTO authPolicyTO = new AuthPolicyTO();
authPolicyTO.setKey("AuthPolicyTest_" + getUUIDString());
authPolicyTO.setName("Authentication Policy");
@@ -812,7 +806,7 @@ public abstract class AbstractITCase {
accessPolicyTO = createPolicy(PolicyType.ACCESS, accessPolicyTO);
assertNotNull(accessPolicyTO);
- SAML2SPTO saml2spto = new SAML2SPTO();
+ SAML2SPClientAppTO saml2spto = new SAML2SPClientAppTO();
saml2spto.setName("ExampleSAML2SP_" + getUUIDString());
saml2spto.setClientAppId(UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE);
saml2spto.setDescription("Example SAML 2.0 service provider");
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ClientAppITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ClientAppITCase.java
index 63fac13..36ab31d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ClientAppITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ClientAppITCase.java
@@ -29,9 +29,9 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.policy.AccessPolicyTO;
import org.apache.syncope.common.lib.policy.AuthPolicyTO;
-import org.apache.syncope.common.lib.to.CASSPTO;
-import org.apache.syncope.common.lib.to.OIDCRPTO;
-import org.apache.syncope.common.lib.to.SAML2SPTO;
+import org.apache.syncope.common.lib.to.CASSPClientAppTO;
+import org.apache.syncope.common.lib.to.OIDCRPClientAppTO;
+import org.apache.syncope.common.lib.to.SAML2SPClientAppTO;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.syncope.common.lib.types.PolicyType;
import org.apache.syncope.fit.AbstractITCase;
@@ -46,10 +46,10 @@ public class ClientAppITCase extends AbstractITCase {
@Test
public void readSAML2SP() {
- SAML2SPTO samlSpTO = buildSAML2SP();
+ SAML2SPClientAppTO samlSpTO = buildSAML2SP();
samlSpTO = createClientApp(ClientAppType.SAML2SP, samlSpTO);
- SAML2SPTO found = clientAppService.read(ClientAppType.SAML2SP, samlSpTO.getKey());
+ SAML2SPClientAppTO found = clientAppService.read(ClientAppType.SAML2SP, samlSpTO.getKey());
assertNotNull(found);
assertFalse(StringUtils.isBlank(found.getEntityId()));
assertFalse(StringUtils.isBlank(found.getMetadataLocation()));
@@ -62,7 +62,7 @@ public class ClientAppITCase extends AbstractITCase {
@Test
public void updateSAML2SP() {
- SAML2SPTO samlSpTO = buildSAML2SP();
+ SAML2SPClientAppTO samlSpTO = buildSAML2SP();
samlSpTO = createClientApp(ClientAppType.SAML2SP, samlSpTO);
AccessPolicyTO accessPolicyTO = new AccessPolicyTO();
@@ -75,7 +75,7 @@ public class ClientAppITCase extends AbstractITCase {
samlSpTO.setAccessPolicy(accessPolicyTO.getKey());
clientAppService.update(ClientAppType.SAML2SP, samlSpTO);
- SAML2SPTO updated = clientAppService.read(ClientAppType.SAML2SP, samlSpTO.getKey());
+ SAML2SPClientAppTO updated = clientAppService.read(ClientAppType.SAML2SP, samlSpTO.getKey());
assertNotNull(updated);
assertEquals("newEntityId", updated.getEntityId());
@@ -84,7 +84,7 @@ public class ClientAppITCase extends AbstractITCase {
@Test
public void deleteSAML2SP() {
- SAML2SPTO samlSpTO = buildSAML2SP();
+ SAML2SPClientAppTO samlSpTO = buildSAML2SP();
samlSpTO = createClientApp(ClientAppType.SAML2SP, samlSpTO);
clientAppService.delete(ClientAppType.SAML2SP, samlSpTO.getKey());
@@ -109,10 +109,10 @@ public class ClientAppITCase extends AbstractITCase {
@Test
public void readOIDCRP() {
- OIDCRPTO oidcrpTO = buildOIDCRP();
+ OIDCRPClientAppTO oidcrpTO = buildOIDCRP();
oidcrpTO = createClientApp(ClientAppType.OIDCRP, oidcrpTO);
- OIDCRPTO found = clientAppService.read(ClientAppType.OIDCRP, oidcrpTO.getKey());
+ OIDCRPClientAppTO found = clientAppService.read(ClientAppType.OIDCRP, oidcrpTO.getKey());
assertNotNull(found);
assertFalse(StringUtils.isBlank(found.getClientId()));
assertFalse(StringUtils.isBlank(found.getClientSecret()));
@@ -125,9 +125,9 @@ public class ClientAppITCase extends AbstractITCase {
@Test
public void readCASSP() {
- CASSPTO casspTO = buildCASSP();
+ CASSPClientAppTO casspTO = buildCASSP();
casspTO = createClientApp(ClientAppType.CASSP, casspTO);
- CASSPTO found = clientAppService.read(ClientAppType.CASSP, casspTO.getKey());
+ CASSPClientAppTO found = clientAppService.read(ClientAppType.CASSP, casspTO.getKey());
assertNotNull(found);
assertNotNull(found.getServiceId());
assertNotNull(found.getAccessPolicy());
@@ -136,7 +136,7 @@ public class ClientAppITCase extends AbstractITCase {
@Test
public void updateOIDCRP() {
- OIDCRPTO oidcrpTO = buildOIDCRP();
+ OIDCRPClientAppTO oidcrpTO = buildOIDCRP();
oidcrpTO = createClientApp(ClientAppType.OIDCRP, oidcrpTO);
AccessPolicyTO accessPolicyTO = new AccessPolicyTO();
@@ -149,7 +149,7 @@ public class ClientAppITCase extends AbstractITCase {
oidcrpTO.setAccessPolicy(accessPolicyTO.getKey());
clientAppService.update(ClientAppType.OIDCRP, oidcrpTO);
- OIDCRPTO updated = clientAppService.read(ClientAppType.OIDCRP, oidcrpTO.getKey());
+ OIDCRPClientAppTO updated = clientAppService.read(ClientAppType.OIDCRP, oidcrpTO.getKey());
assertNotNull(updated);
assertEquals("newClientId", updated.getClientId());
@@ -158,7 +158,7 @@ public class ClientAppITCase extends AbstractITCase {
@Test
public void deleteOIDCRP() {
- OIDCRPTO oidcrpTO = buildOIDCRP();
+ OIDCRPClientAppTO oidcrpTO = buildOIDCRP();
oidcrpTO = createClientApp(ClientAppType.OIDCRP, oidcrpTO);
clientAppService.delete(ClientAppType.OIDCRP, oidcrpTO.getKey());
@@ -173,7 +173,7 @@ public class ClientAppITCase extends AbstractITCase {
@Test
public void deleteCASSP() {
- CASSPTO casspTO = buildCASSP();
+ CASSPClientAppTO casspTO = buildCASSP();
casspTO = createClientApp(ClientAppType.CASSP, casspTO);
clientAppService.delete(ClientAppType.CASSP, casspTO.getKey());
@@ -186,7 +186,7 @@ public class ClientAppITCase extends AbstractITCase {
}
}
- private static CASSPTO buildCASSP() {
+ private static CASSPClientAppTO buildCASSP() {
AuthPolicyTO authPolicyTO = new AuthPolicyTO();
authPolicyTO.setKey("AuthPolicyTest_" + getUUIDString());
authPolicyTO.setName("Authentication Policy");
@@ -199,7 +199,7 @@ public class ClientAppITCase extends AbstractITCase {
accessPolicyTO = createPolicy(PolicyType.ACCESS, accessPolicyTO);
assertNotNull(accessPolicyTO);
- CASSPTO casspTO = new CASSPTO();
+ CASSPClientAppTO casspTO = new CASSPClientAppTO();
casspTO.setName("ExampleRP_" + getUUIDString());
casspTO.setClientAppId(UUID.randomUUID().getMostSignificantBits() & Long.MAX_VALUE);
casspTO.setDescription("Example OIDC RP application");
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OIDCJWKSITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OIDCJWKSITCase.java
index 9f800df..0e7c96b 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OIDCJWKSITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OIDCJWKSITCase.java
@@ -53,7 +53,7 @@ public class OIDCJWKSITCase extends AbstractITCase {
try {
oidcJWKSService.delete();
- waOIDCJWKSService.get();
+ waOIDCJWKSService.read();
fail("Should not locate an OIDC JWKS");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.NotFound, e.getType());
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2IdPEntityITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2IdPEntityITCase.java
new file mode 100644
index 0000000..0b019b5
--- /dev/null
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2IdPEntityITCase.java
@@ -0,0 +1,100 @@
+/*
+ * 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.fit.core;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+import org.apache.syncope.client.lib.AnonymousAuthenticationHandler;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.fit.AbstractITCase;
+import org.junit.jupiter.api.Test;
+import org.apache.syncope.common.lib.to.SAML2IdPEntityTO;
+import org.junit.jupiter.api.BeforeAll;
+import org.apache.syncope.common.rest.api.service.SAML2IdPEntityService;
+
+public class SAML2IdPEntityITCase extends AbstractITCase {
+
+ private static SAML2IdPEntityService waSAML2IdPEntityService;
+
+ @BeforeAll
+ public static void setup() {
+ assumeTrue(clientFactory.getContentType() == SyncopeClientFactoryBean.ContentType.JSON);
+
+ SyncopeClient anonymous = clientFactory.create(
+ new AnonymousAuthenticationHandler(ANONYMOUS_UNAME, ANONYMOUS_KEY));
+ waSAML2IdPEntityService = anonymous.getService(SAML2IdPEntityService.class);
+ }
+
+ private static SAML2IdPEntityTO set() {
+ SAML2IdPEntityTO entityTO = new SAML2IdPEntityTO.Builder().
+ key(SAML2IdPEntityService.DEFAULT_OWNER).
+ metadata(Base64.getEncoder().encodeToString(
+ "testMetadata".getBytes(StandardCharsets.UTF_8))).
+ encryptionCertificate(Base64.getEncoder().encodeToString(
+ "testEncryptionCert".getBytes(StandardCharsets.UTF_8))).
+ encryptionKey(Base64.getEncoder().encodeToString(
+ "testEncryptionKey".getBytes(StandardCharsets.UTF_8))).
+ signingCertificate(Base64.getEncoder().encodeToString(
+ "testSigningCert".getBytes(StandardCharsets.UTF_8))).
+ signingKey(Base64.getEncoder().encodeToString(
+ "testSigningKey".getBytes(StandardCharsets.UTF_8))).
+ build();
+ waSAML2IdPEntityService.set(entityTO);
+
+ return entityTO;
+ }
+
+ @Test
+ public void get() {
+ SAML2IdPEntityTO entityTO;
+ try {
+ entityTO = waSAML2IdPEntityService.get(SAML2IdPEntityService.DEFAULT_OWNER);
+ } catch (SyncopeClientException e) {
+ entityTO = set();
+ }
+ assertNotNull(entityTO);
+
+ assertEquals(SAML2IdPEntityService.DEFAULT_OWNER, entityTO.getKey());
+ }
+
+ @Test
+ public void getAndSet() {
+ SAML2IdPEntityTO entityTO;
+ try {
+ entityTO = waSAML2IdPEntityService.get(SAML2IdPEntityService.DEFAULT_OWNER);
+ } catch (SyncopeClientException e) {
+ entityTO = set();
+ }
+ assertNotNull(entityTO);
+
+ entityTO.setMetadata(Base64.getEncoder().encodeToString("new metadata".getBytes(StandardCharsets.UTF_8)));
+ waSAML2IdPEntityService.set(entityTO);
+
+ entityTO = waSAML2IdPEntityService.get(entityTO.getKey());
+ assertEquals(
+ "new metadata",
+ new String(Base64.getDecoder().decode(entityTO.getMetadata()), StandardCharsets.UTF_8));
+ }
+}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2IdPMetadataITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2IdPMetadataITCase.java
deleted file mode 100644
index 8ce1688..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2IdPMetadataITCase.java
+++ /dev/null
@@ -1,120 +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.fit.core;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.fail;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
-
-import javax.ws.rs.core.Response;
-import org.apache.syncope.client.lib.AnonymousAuthenticationHandler;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.fit.AbstractITCase;
-import org.junit.jupiter.api.Test;
-import org.apache.syncope.common.lib.to.SAML2IdPMetadataTO;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.rest.api.service.SAML2IdPMetadataService;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.platform.commons.util.StringUtils;
-
-public class SAML2IdPMetadataITCase extends AbstractITCase {
-
- private static SAML2IdPMetadataService waSAML2IdPMetadataService;
-
- @BeforeAll
- public static void setup() {
- assumeTrue(clientFactory.getContentType() == SyncopeClientFactoryBean.ContentType.JSON);
-
- SyncopeClient anonymous = clientFactory.create(
- new AnonymousAuthenticationHandler(ANONYMOUS_UNAME, ANONYMOUS_KEY));
- waSAML2IdPMetadataService = anonymous.getService(SAML2IdPMetadataService.class);
- }
-
- private static void testIsValid(final SAML2IdPMetadataTO saml2IdPMetadataTO) {
- assertFalse(StringUtils.isBlank(saml2IdPMetadataTO.getAppliesTo()));
- assertFalse(StringUtils.isBlank(saml2IdPMetadataTO.getMetadata()));
- assertFalse(StringUtils.isBlank(saml2IdPMetadataTO.getEncryptionKey()));
- assertFalse(StringUtils.isBlank(saml2IdPMetadataTO.getEncryptionCertificate()));
- assertFalse(StringUtils.isBlank(saml2IdPMetadataTO.getSigningCertificate()));
- assertFalse(StringUtils.isBlank(saml2IdPMetadataTO.getSigningKey()));
- }
-
- private SAML2IdPMetadataTO createSAML2IdPMetadata(final SAML2IdPMetadataTO saml2IdPMetadata) {
- Response response = waSAML2IdPMetadataService.set(saml2IdPMetadata);
- if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
- Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
- if (ex != null) {
- throw (RuntimeException) ex;
- }
- }
- return getObject(response.getLocation(), SAML2IdPMetadataService.class, saml2IdPMetadata.getClass());
- }
-
- private SAML2IdPMetadataTO createSAML2IdPMetadata() {
- SAML2IdPMetadataTO result = createSAML2IdPMetadata(new SAML2IdPMetadataTO.Builder().
- appliesTo(OWNER).
- metadata("testMetadata").
- encryptionCertificate("testEncryptionCert").
- encryptionKey("testEncryptionKey").
- signingCertificate("testSigningCert").
- signingKey("testSigningKey").
- build());
- assertNotNull(result);
- testIsValid(result);
-
- return result;
- }
-
- @Test
- public void read() {
- SAML2IdPMetadataTO saml2IdPMetadataTO;
- try {
- saml2IdPMetadataTO = waSAML2IdPMetadataService.readFor(OWNER);
- } catch (SyncopeClientException e) {
- saml2IdPMetadataTO = createSAML2IdPMetadata();
- }
-
- assertNotNull(saml2IdPMetadataTO);
- assertEquals(OWNER, saml2IdPMetadataTO.getAppliesTo());
- testIsValid(saml2IdPMetadataTO);
- }
-
- @Test
- public void create() {
- try {
- waSAML2IdPMetadataService.readFor(OWNER);
- } catch (SyncopeClientException e) {
- createSAML2IdPMetadata();
- }
-
- try {
- createSAML2IdPMetadata(new SAML2IdPMetadataTO.Builder().
- appliesTo(OWNER).
- metadata("testMetadata").
- build());
- fail("This should not happen");
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.EntityExists, e.getType());
- }
- }
-}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OIDCJWKSITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2SPEntityITCase.java
similarity index 51%
copy from fit/core-reference/src/test/java/org/apache/syncope/fit/core/OIDCJWKSITCase.java
copy to fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2SPEntityITCase.java
index 9f800df..e05d403 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/OIDCJWKSITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2SPEntityITCase.java
@@ -19,25 +19,26 @@
package org.apache.syncope.fit.core;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
-import javax.ws.rs.core.Response;
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
import org.apache.syncope.client.lib.AnonymousAuthenticationHandler;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.lib.types.JWSAlgorithm;
-import org.apache.syncope.common.rest.api.service.OIDCJWKSService;
+import org.apache.syncope.common.lib.to.SAML2SPEntityTO;
import org.apache.syncope.fit.AbstractITCase;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.springframework.http.HttpStatus;
+import org.apache.syncope.common.rest.api.service.SAML2SPEntityService;
-public class OIDCJWKSITCase extends AbstractITCase {
+public class SAML2SPEntityITCase extends AbstractITCase {
- private static OIDCJWKSService waOIDCJWKSService;
+ private static final String OWNER = "owner";
+
+ private static SAML2SPEntityService waSAML2SPEntityService;
@BeforeAll
public static void setup() {
@@ -45,27 +46,48 @@ public class OIDCJWKSITCase extends AbstractITCase {
SyncopeClient anonymous = clientFactory.create(
new AnonymousAuthenticationHandler(ANONYMOUS_UNAME, ANONYMOUS_KEY));
- waOIDCJWKSService = anonymous.getService(OIDCJWKSService.class);
+ waSAML2SPEntityService = anonymous.getService(SAML2SPEntityService.class);
+ }
+
+ private static SAML2SPEntityTO set() {
+ SAML2SPEntityTO entityTO = new SAML2SPEntityTO.Builder().
+ key(OWNER).
+ metadata(Base64.getEncoder().encodeToString("testMetadata".getBytes(StandardCharsets.UTF_8))).
+ build();
+ waSAML2SPEntityService.set(entityTO);
+
+ return entityTO;
}
@Test
- public void deleteGetSet() {
+ public void get() {
+ SAML2SPEntityTO entityTO;
try {
- oidcJWKSService.delete();
-
- waOIDCJWKSService.get();
- fail("Should not locate an OIDC JWKS");
+ entityTO = waSAML2SPEntityService.get(OWNER);
} catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.NotFound, e.getType());
+ entityTO = set();
}
+ assertNotNull(entityTO);
- Response response = waOIDCJWKSService.generate(2048, JWSAlgorithm.RS256);
- assertEquals(HttpStatus.CREATED.value(), response.getStatus());
+ assertEquals(OWNER, entityTO.getKey());
+ }
+
+ @Test
+ public void getAndSet() {
+ SAML2SPEntityTO entityTO;
try {
- waOIDCJWKSService.generate(2048, JWSAlgorithm.RS512);
- fail("Should not recreate an OIDC JWKS");
+ entityTO = waSAML2SPEntityService.get(OWNER);
} catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.EntityExists, e.getType());
+ entityTO = set();
}
+ assertNotNull(entityTO);
+
+ entityTO.setMetadata(Base64.getEncoder().encodeToString("new metadata".getBytes(StandardCharsets.UTF_8)));
+ waSAML2SPEntityService.set(entityTO);
+
+ entityTO = waSAML2SPEntityService.get(entityTO.getKey());
+ assertEquals(
+ "new metadata",
+ new String(Base64.getDecoder().decode(entityTO.getMetadata()), StandardCharsets.UTF_8));
}
}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2SPKeystoreITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2SPKeystoreITCase.java
deleted file mode 100644
index 2bc92fc..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2SPKeystoreITCase.java
+++ /dev/null
@@ -1,114 +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.fit.core;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.fail;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
-
-import javax.ws.rs.core.Response;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.lib.AnonymousAuthenticationHandler;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.SAML2SPKeystoreTO;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.rest.api.service.SAML2SPKeystoreService;
-import org.apache.syncope.common.rest.api.service.SAML2SPMetadataService;
-import org.apache.syncope.fit.AbstractITCase;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-public class SAML2SPKeystoreITCase extends AbstractITCase {
-
- private static SAML2SPKeystoreService waSAML2SPKeystoreService;
-
- private static SAML2SPMetadataService waSAML2SPMetadataService;
-
- @BeforeAll
- public static void setup() {
- assumeTrue(clientFactory.getContentType() == SyncopeClientFactoryBean.ContentType.JSON);
-
- SyncopeClient anonymous = clientFactory.create(
- new AnonymousAuthenticationHandler(ANONYMOUS_UNAME, ANONYMOUS_KEY));
- waSAML2SPKeystoreService = anonymous.getService(SAML2SPKeystoreService.class);
- waSAML2SPMetadataService = anonymous.getService(SAML2SPMetadataService.class);
- }
-
- private static void testIsValid(final SAML2SPKeystoreTO keystoreTO) {
- assertFalse(StringUtils.isBlank(keystoreTO.getOwner()));
- assertFalse(StringUtils.isBlank(keystoreTO.getKeystore()));
- }
-
- private SAML2SPKeystoreTO createSAML2SPKeystore(final SAML2SPKeystoreTO keystoreTO) {
- Response response = waSAML2SPKeystoreService.set(keystoreTO);
- if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
- Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
- if (ex != null) {
- throw (RuntimeException) ex;
- }
- }
- return getObject(response.getLocation(), SAML2SPKeystoreService.class, keystoreTO.getClass());
- }
-
- private SAML2SPKeystoreTO createSAML2SPKeystore() {
- SAML2SPKeystoreTO result = createSAML2SPKeystore(new SAML2SPKeystoreTO.Builder().
- owner(OWNER).
- keystore("testkyStore").
- build());
- assertNotNull(result);
- testIsValid(result);
- return result;
- }
-
- @Test
- public void read() {
- SAML2SPKeystoreTO keystoreTO;
- try {
- keystoreTO = waSAML2SPKeystoreService.readFor(OWNER);
- } catch (SyncopeClientException e) {
- keystoreTO = createSAML2SPKeystore();
- }
- assertNotNull(keystoreTO);
- assertEquals(OWNER, keystoreTO.getOwner());
- testIsValid(keystoreTO);
- }
-
- @Test
- public void create() {
- try {
- waSAML2SPMetadataService.readFor(OWNER);
- } catch (SyncopeClientException e) {
- createSAML2SPKeystore();
- }
-
- try {
- createSAML2SPKeystore(new SAML2SPKeystoreTO.Builder().
- owner(OWNER).
- keystore("testMetadata").
- build());
- fail("This should not happen");
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.EntityExists, e.getType());
- }
- }
-}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2SPMetadataITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2SPMetadataITCase.java
deleted file mode 100644
index a7b5e44..0000000
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SAML2SPMetadataITCase.java
+++ /dev/null
@@ -1,110 +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.fit.core;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.fail;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
-
-import javax.ws.rs.core.Response;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.lib.AnonymousAuthenticationHandler;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.SAML2SPMetadataTO;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
-import org.apache.syncope.common.rest.api.service.SAML2SPMetadataService;
-import org.apache.syncope.fit.AbstractITCase;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-public class SAML2SPMetadataITCase extends AbstractITCase {
-
- private static SAML2SPMetadataService waSAML2SPMetadataService;
-
- @BeforeAll
- public static void setup() {
- assumeTrue(clientFactory.getContentType() == SyncopeClientFactoryBean.ContentType.JSON);
-
- SyncopeClient anonymous = clientFactory.create(
- new AnonymousAuthenticationHandler(ANONYMOUS_UNAME, ANONYMOUS_KEY));
- waSAML2SPMetadataService = anonymous.getService(SAML2SPMetadataService.class);
- }
-
- private SAML2SPMetadataTO createSAML2SPMetadata(final SAML2SPMetadataTO metadata) {
- Response response = waSAML2SPMetadataService.set(metadata);
- if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
- Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
- if (ex != null) {
- throw (RuntimeException) ex;
- }
- }
- return getObject(response.getLocation(), SAML2SPMetadataService.class, metadata.getClass());
- }
-
- private static void testIsValid(final SAML2SPMetadataTO metadataTO) {
- assertFalse(StringUtils.isBlank(metadataTO.getOwner()));
- assertFalse(StringUtils.isBlank(metadataTO.getMetadata()));
- }
-
- private SAML2SPMetadataTO createSAML2SPMetadata() {
- SAML2SPMetadataTO result = createSAML2SPMetadata(new SAML2SPMetadataTO.Builder().
- owner(OWNER).
- metadata("testMetadata").
- build());
- assertNotNull(result);
- testIsValid(result);
- return result;
- }
-
- @Test
- public void read() {
- SAML2SPMetadataTO metadataTO;
- try {
- metadataTO = waSAML2SPMetadataService.readFor(OWNER);
- } catch (SyncopeClientException e) {
- metadataTO = createSAML2SPMetadata();
- }
- assertNotNull(metadataTO);
- assertEquals(OWNER, metadataTO.getOwner());
- testIsValid(metadataTO);
- }
-
- @Test
- public void create() {
- try {
- waSAML2SPMetadataService.readFor(OWNER);
- } catch (SyncopeClientException e) {
- createSAML2SPMetadata();
- }
-
- try {
- createSAML2SPMetadata(new SAML2SPMetadataTO.Builder().
- owner(OWNER).
- metadata("testMetadata").
- build());
- fail("This should not happen");
- } catch (SyncopeClientException e) {
- assertEquals(ClientExceptionType.EntityExists, e.getType());
- }
- }
-}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/GoogleMfaAuthAccountITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/GoogleMfaAuthAccountITCase.java
index 2efb4e8..ad04cab 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/GoogleMfaAuthAccountITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/GoogleMfaAuthAccountITCase.java
@@ -48,7 +48,7 @@ public class GoogleMfaAuthAccountITCase extends AbstractITCase {
@BeforeEach
public void setup() {
- googleMfaAuthAccountService.delete();
+ googleMfaAuthAccountService.deleteAll();
}
@Test
@@ -66,18 +66,18 @@ public class GoogleMfaAuthAccountITCase extends AbstractITCase {
assertFalse(list.getResult().isEmpty());
assertEquals(1, list.getTotalCount());
- PagedResult<GoogleMfaAuthAccount> read = googleMfaAuthAccountService.readFor(owner);
+ PagedResult<GoogleMfaAuthAccount> read = googleMfaAuthAccountService.read(owner);
assertEquals(1, read.getTotalCount());
assertFalse(read.getResult().isEmpty());
}
@Test
- public void deleteFor() {
+ public void delete() {
String owner = UUID.randomUUID().toString();
GoogleMfaAuthAccount acct = createGoogleMfaAuthAccount();
googleMfaAuthAccountService.create(owner, acct);
- googleMfaAuthAccountService.deleteFor(owner);
- assertThrows(SyncopeClientException.class, () -> googleMfaAuthAccountService.readFor(owner));
+ googleMfaAuthAccountService.delete(owner);
+ assertThrows(SyncopeClientException.class, () -> googleMfaAuthAccountService.read(owner));
}
@Test
@@ -90,8 +90,8 @@ public class GoogleMfaAuthAccountITCase extends AbstractITCase {
acct.setScratchCodes(List.of(9, 8, 7, 6, 5));
googleMfaAuthAccountService.update(owner, acct);
assertEquals(1, googleMfaAuthAccountService.list().getTotalCount());
- acct = googleMfaAuthAccountService.readFor(owner).getResult().get(0);
+ acct = googleMfaAuthAccountService.read(owner).getResult().get(0);
assertEquals(acct.getSecretKey(), acct.getSecretKey());
- googleMfaAuthAccountService.delete(acct.getKey());
+ googleMfaAuthAccountService.delete(owner);
}
}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/GoogleMfaAuthTokenITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/GoogleMfaAuthTokenITCase.java
index 95f6290..7dcca15 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/GoogleMfaAuthTokenITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/GoogleMfaAuthTokenITCase.java
@@ -49,7 +49,7 @@ public class GoogleMfaAuthTokenITCase extends AbstractITCase {
@BeforeEach
public void setup() {
- googleMfaAuthTokenService.delete(null);
+ googleMfaAuthTokenService.delete((Date) null);
}
@Test
@@ -64,7 +64,7 @@ public class GoogleMfaAuthTokenITCase extends AbstractITCase {
GoogleMfaAuthToken token = createGoogleMfaAuthToken();
googleMfaAuthTokenService.store(owner, token);
assertEquals(1, googleMfaAuthTokenService.list().getTotalCount());
- assertEquals(1, googleMfaAuthTokenService.readFor(owner).getTotalCount());
+ assertEquals(1, googleMfaAuthTokenService.read(owner).getTotalCount());
}
@Test
@@ -87,16 +87,16 @@ public class GoogleMfaAuthTokenITCase extends AbstractITCase {
GoogleMfaAuthToken token = createGoogleMfaAuthToken();
googleMfaAuthTokenService.store(owner, token);
googleMfaAuthTokenService.delete(token.getOtp());
- assertTrue(googleMfaAuthTokenService.readFor(owner).getResult().isEmpty());
+ assertTrue(googleMfaAuthTokenService.read(owner).getResult().isEmpty());
}
@Test
- public void deleteByOwner() {
+ public void delete() {
String owner = UUID.randomUUID().toString();
GoogleMfaAuthToken token = createGoogleMfaAuthToken();
googleMfaAuthTokenService.store(owner, token);
- googleMfaAuthTokenService.deleteFor(owner);
- assertTrue(googleMfaAuthTokenService.readFor(owner).getResult().isEmpty());
+ googleMfaAuthTokenService.delete(owner);
+ assertTrue(googleMfaAuthTokenService.read(owner).getResult().isEmpty());
}
@Test
@@ -105,7 +105,7 @@ public class GoogleMfaAuthTokenITCase extends AbstractITCase {
GoogleMfaAuthToken token = createGoogleMfaAuthToken();
googleMfaAuthTokenService.store(owner, token);
googleMfaAuthTokenService.delete(owner, token.getOtp());
- assertTrue(googleMfaAuthTokenService.readFor(owner).getResult().isEmpty());
+ assertTrue(googleMfaAuthTokenService.read(owner).getResult().isEmpty());
}
@Test
@@ -114,7 +114,7 @@ public class GoogleMfaAuthTokenITCase extends AbstractITCase {
Date dateTime = Date.from(LocalDateTime.now().minusDays(1).atZone(ZoneId.systemDefault()).toInstant());
createGoogleMfaAuthToken();
googleMfaAuthTokenService.delete(dateTime);
- assertTrue(googleMfaAuthTokenService.readFor(owner).getResult().isEmpty());
- assertEquals(0, googleMfaAuthTokenService.readFor(owner).getTotalCount());
+ assertTrue(googleMfaAuthTokenService.read(owner).getResult().isEmpty());
+ assertEquals(0, googleMfaAuthTokenService.read(owner).getTotalCount());
}
}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/ImpersonationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/ImpersonationITCase.java
index 752a390..cb21e56 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/ImpersonationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/ImpersonationITCase.java
@@ -16,49 +16,27 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.apache.syncope.fit.core.wa;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.ClientExceptionType;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import org.apache.syncope.common.lib.wa.ImpersonationAccount;
import org.apache.syncope.fit.AbstractITCase;
import org.junit.jupiter.api.Test;
-import javax.ws.rs.core.Response;
-
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
-
public class ImpersonationITCase extends AbstractITCase {
+
@Test
public void createAndFind() {
- ImpersonationAccount account = new ImpersonationAccount.Builder()
- .owner(getUUIDString())
- .key(getUUIDString())
- .build();
+ String owner = getUUIDString();
+ ImpersonationAccount account = new ImpersonationAccount.Builder().impersonated(getUUIDString()).build();
- Response response = impersonationService.create(account);
- assertNotNull(response);
+ impersonationService.create(owner, account);
- assertFalse(impersonationService.findByOwner(account.getOwner()).isEmpty());
- account = impersonationService.find(account.getOwner(), account.getKey());
- assertNotNull(account);
+ assertTrue(impersonationService.read(owner).contains(account));
- impersonationService.update(account);
- account = impersonationService.find(account.getOwner(), account.getKey());
- assertNotNull(account);
+ impersonationService.delete(owner, account.getImpersonated());
- response = impersonationService.delete(account.getOwner(), account.getKey());
- assertNotNull(response);
-
- try {
- impersonationService.find(account.getOwner(), account.getKey());
- fail("Should not happen");
- } catch (final SyncopeClientException e) {
- assertEquals(ClientExceptionType.DelegatedAdministration, e.getType());
- }
+ assertTrue(impersonationService.read(owner).isEmpty());
}
}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/U2FRegistrationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/U2FRegistrationITCase.java
index 1d82680..99b132f 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/U2FRegistrationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/U2FRegistrationITCase.java
@@ -20,8 +20,6 @@ package org.apache.syncope.fit.core.wa;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.LocalDate;
@@ -29,9 +27,7 @@ import java.time.ZoneId;
import java.util.Date;
import java.util.List;
import java.util.UUID;
-import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.wa.U2FDevice;
-import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.beans.U2FDeviceQuery;
import org.apache.syncope.fit.AbstractITCase;
import org.junit.jupiter.api.BeforeEach;
@@ -66,9 +62,7 @@ public class U2FRegistrationITCase extends AbstractITCase {
public void count() {
String owner = UUID.randomUUID().toString();
U2FDevice device = createDeviceRegistration();
- Response response = u2FRegistrationService.create(owner, device);
- String key = response.getHeaderString(RESTHeaders.RESOURCE_KEY);
- assertNotNull(u2FRegistrationService.read(key));
+ u2FRegistrationService.create(owner, device);
List<U2FDevice> devices = u2FRegistrationService.search(
new U2FDeviceQuery.Builder().owner(owner).expirationDate(
@@ -85,12 +79,12 @@ public class U2FRegistrationITCase extends AbstractITCase {
@Test
public void delete() {
U2FDevice device = createDeviceRegistration();
- Response response = u2FRegistrationService.create(UUID.randomUUID().toString(), device);
- String key = response.getHeaderString(RESTHeaders.RESOURCE_KEY);
- assertNotNull(u2FRegistrationService.read(key));
+ String owner = UUID.randomUUID().toString();
+ u2FRegistrationService.create(owner, device);
- u2FRegistrationService.delete(new U2FDeviceQuery.Builder().entityKey(key).build());
- assertNull(u2FRegistrationService.read(key));
+ u2FRegistrationService.delete(new U2FDeviceQuery.Builder().owner(owner).build());
+ assertTrue(u2FRegistrationService.search(
+ new U2FDeviceQuery.Builder().owner(owner).build()).getResult().isEmpty());
Date date = Date.from(LocalDate.now().plusDays(1)
.atStartOfDay(ZoneId.systemDefault()).toInstant());
@@ -100,19 +94,4 @@ public class U2FRegistrationITCase extends AbstractITCase {
assertTrue(u2FRegistrationService.search(
new U2FDeviceQuery.Builder().expirationDate(date).build()).getResult().isEmpty());
}
-
- @Test
- public void update() {
- U2FDevice device = createDeviceRegistration();
- Response response = u2FRegistrationService.create(UUID.randomUUID().toString(), device);
- String key = response.getHeaderString(RESTHeaders.RESOURCE_KEY);
- device = u2FRegistrationService.read(key);
- assertNotNull(device);
-
- device.setRecord("newRecord");
- u2FRegistrationService.update(device);
-
- device = u2FRegistrationService.read(key);
- assertEquals("newRecord", device.getRecord());
- }
}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/WAClientAppITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/WAClientAppITCase.java
index 87a96bf..43677ad 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/WAClientAppITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/WAClientAppITCase.java
@@ -34,8 +34,8 @@ import org.apache.syncope.common.lib.policy.AuthPolicyTO;
import org.apache.syncope.common.lib.to.AuthModuleTO;
import org.apache.syncope.common.lib.to.ItemTO;
import org.apache.syncope.common.lib.wa.WAClientApp;
-import org.apache.syncope.common.lib.to.OIDCRPTO;
-import org.apache.syncope.common.lib.to.SAML2SPTO;
+import org.apache.syncope.common.lib.to.OIDCRPClientAppTO;
+import org.apache.syncope.common.lib.to.SAML2SPClientAppTO;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.syncope.common.lib.types.PolicyType;
import org.apache.syncope.fit.AbstractITCase;
@@ -68,7 +68,7 @@ public class WAClientAppITCase extends AbstractITCase {
@Test
public void read() {
- OIDCRPTO oidcrpto = createClientApp(ClientAppType.OIDCRP, buildOIDCRP());
+ OIDCRPClientAppTO oidcrpto = createClientApp(ClientAppType.OIDCRP, buildOIDCRP());
WAClientApp waClientApp = waClientAppService.read(oidcrpto.getClientAppId(), null);
assertNotNull(waClientApp);
@@ -81,7 +81,7 @@ public class WAClientAppITCase extends AbstractITCase {
waClientApp = waClientAppService.read(oidcrpto.getName(), ClientAppType.OIDCRP);
assertNotNull(waClientApp);
- SAML2SPTO samlspto = createClientApp(ClientAppType.SAML2SP, buildSAML2SP());
+ SAML2SPClientAppTO samlspto = createClientApp(ClientAppType.SAML2SP, buildSAML2SP());
WAClientApp registeredSamlClientApp = waClientAppService.read(samlspto.getClientAppId(), null);
assertNotNull(registeredSamlClientApp);
@@ -97,7 +97,7 @@ public class WAClientAppITCase extends AbstractITCase {
@Test
public void readWithPolicies() {
- OIDCRPTO oidcrpto = buildOIDCRP();
+ OIDCRPClientAppTO oidcrpto = buildOIDCRP();
AuthPolicyTO authPolicyTO = createPolicy(PolicyType.AUTH, buildAuthPolicyTO(AUTH_MODULE));
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/WebAuthnAccountITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/WebAuthnAccountITCase.java
index 81e5419..a9a8c3d 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/WebAuthnAccountITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/wa/WebAuthnAccountITCase.java
@@ -59,7 +59,7 @@ public class WebAuthnAccountITCase extends AbstractITCase {
WebAuthnAccount acct = createWebAuthnRegisteredAccount();
webAuthnRegistrationService.create(owner, acct);
assertFalse(webAuthnRegistrationService.list().isEmpty());
- assertNotNull(webAuthnRegistrationService.readFor(owner));
+ assertNotNull(webAuthnRegistrationService.read(owner));
}
@Test
@@ -67,8 +67,8 @@ public class WebAuthnAccountITCase extends AbstractITCase {
String owner = UUID.randomUUID().toString();
WebAuthnAccount acct = createWebAuthnRegisteredAccount();
webAuthnRegistrationService.create(owner, acct);
- assertNotNull(webAuthnRegistrationService.delete(owner));
- assertThrows(SyncopeClientException.class, () -> webAuthnRegistrationService.readFor(owner));
+ webAuthnRegistrationService.delete(owner);
+ assertThrows(SyncopeClientException.class, () -> webAuthnRegistrationService.read(owner));
}
@Test
@@ -76,8 +76,8 @@ public class WebAuthnAccountITCase extends AbstractITCase {
String owner = UUID.randomUUID().toString();
WebAuthnAccount acct = createWebAuthnRegisteredAccount();
webAuthnRegistrationService.create(owner, acct);
- assertNotNull(webAuthnRegistrationService.delete(owner, acct.getCredentials().get(0).getIdentifier()));
- acct = webAuthnRegistrationService.readFor(owner);
+ webAuthnRegistrationService.delete(owner, acct.getCredentials().get(0).getIdentifier());
+ acct = webAuthnRegistrationService.read(owner);
assertTrue(acct.getCredentials().isEmpty());
}
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
index 38a7dc9..ce42c1b 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
@@ -41,16 +41,16 @@ import org.apache.http.message.BasicNameValuePair;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
import org.apache.syncope.common.rest.api.service.ClientAppService;
+import org.apache.syncope.common.rest.api.service.OIDCC4UIProviderService;
import org.apache.syncope.common.rest.api.service.PolicyService;
+import org.apache.syncope.common.rest.api.service.SAML2IdPEntityService;
+import org.apache.syncope.common.rest.api.service.SAML2SP4UIIdPService;
import org.apache.syncope.common.rest.api.service.SRARouteService;
+import org.apache.syncope.common.rest.api.service.UserService;
import org.apache.syncope.fit.sra.AbstractSRAITCase;
import org.junit.jupiter.api.BeforeAll;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.syncope.common.rest.api.service.SAML2SP4UIIdPService;
-import org.apache.syncope.common.rest.api.service.UserService;
-import org.apache.syncope.common.rest.api.service.OIDCC4UIProviderService;
-import org.apache.syncope.common.rest.api.service.SAML2IdPMetadataService;
public class AbstractITCase {
@@ -101,12 +101,12 @@ public class AbstractITCase {
@BeforeAll
public static void waitForWARefresh() {
- SAML2IdPMetadataService samlIdPMetadataService = adminClient.getService(SAML2IdPMetadataService.class);
+ SAML2IdPEntityService samlIdPEntityService = adminClient.getService(SAML2IdPEntityService.class);
await().atMost(50, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(() -> {
boolean refreshed = false;
try {
- samlIdPMetadataService.readFor(SAML2IdPMetadataService.DEFAULT_OWNER);
+ samlIdPEntityService.get(SAML2IdPEntityService.DEFAULT_OWNER);
refreshed = true;
} catch (Exception e) {
// ignore
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/CASSRAITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/CASSRAITCase.java
index e72b144..7c6c8b4 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/CASSRAITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/CASSRAITCase.java
@@ -45,7 +45,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
-import org.apache.syncope.common.lib.to.CASSPTO;
+import org.apache.syncope.common.lib.to.CASSPClientAppTO;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.syncope.common.rest.api.RESTHeaders;
import org.junit.jupiter.api.BeforeAll;
@@ -63,12 +63,12 @@ public class CASSRAITCase extends AbstractSRAITCase {
@BeforeAll
public static void clientAppSetup() {
String appName = CASSRAITCase.class.getName();
- CASSPTO clientApp = clientAppService.list(ClientAppType.CASSP).stream().
+ CASSPClientAppTO clientApp = clientAppService.list(ClientAppType.CASSP).stream().
filter(app -> appName.equals(app.getName())).
- map(CASSPTO.class::cast).
+ map(CASSPClientAppTO.class::cast).
findFirst().
orElseGet(() -> {
- CASSPTO app = new CASSPTO();
+ CASSPClientAppTO app = new CASSPClientAppTO();
app.setName(appName);
app.setClientAppId(4L);
app.setServiceId("http://localhost:8080/.*");
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
index db4fb8b..6369ad4 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
@@ -57,7 +57,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
-import org.apache.syncope.common.lib.to.OIDCRPTO;
+import org.apache.syncope.common.lib.to.OIDCRPClientAppTO;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.syncope.common.lib.types.OIDCSubjectType;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -86,12 +86,12 @@ public class OIDCSRAITCase extends AbstractSRAITCase {
final String clientId,
final String clientSecret) {
- OIDCRPTO clientApp = clientAppService.list(ClientAppType.OIDCRP).stream().
+ OIDCRPClientAppTO clientApp = clientAppService.list(ClientAppType.OIDCRP).stream().
filter(app -> appName.equals(app.getName())).
- map(OIDCRPTO.class::cast).
+ map(OIDCRPClientAppTO.class::cast).
findFirst().
orElseGet(() -> {
- OIDCRPTO app = new OIDCRPTO();
+ OIDCRPClientAppTO app = new OIDCRPClientAppTO();
app.setName(appName);
app.setClientAppId(clientAppId);
app.setClientId(clientId);
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/SAML2SRAITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/SAML2SRAITCase.java
index b39d35b..0cd2e5c 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/SAML2SRAITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/SAML2SRAITCase.java
@@ -46,7 +46,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
-import org.apache.syncope.common.lib.to.SAML2SPTO;
+import org.apache.syncope.common.lib.to.SAML2SPClientAppTO;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.syncope.common.lib.types.SAML2SPNameId;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -65,12 +65,12 @@ public class SAML2SRAITCase extends AbstractSRAITCase {
@BeforeAll
public static void clientAppSetup() {
String appName = SAML2SRAITCase.class.getName();
- SAML2SPTO clientApp = clientAppService.list(ClientAppType.SAML2SP).stream().
+ SAML2SPClientAppTO clientApp = clientAppService.list(ClientAppType.SAML2SP).stream().
filter(app -> appName.equals(app.getName())).
- map(SAML2SPTO.class::cast).
+ map(SAML2SPClientAppTO.class::cast).
findFirst().
orElseGet(() -> {
- SAML2SPTO app = new SAML2SPTO();
+ SAML2SPClientAppTO app = new SAML2SPClientAppTO();
app.setName(appName);
app.setClientAppId(3L);
app.setEntityId(SRA_ADDRESS);
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/OIDC4UIITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/OIDC4UIITCase.java
index 7430dcb..020677d 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/OIDC4UIITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/OIDC4UIITCase.java
@@ -47,7 +47,7 @@ import org.apache.http.util.EntityUtils;
import org.apache.syncope.client.ui.commons.panels.OIDCC4UIConstants;
import org.apache.syncope.common.lib.to.ItemTO;
import org.apache.syncope.common.lib.to.OIDCC4UIProviderTO;
-import org.apache.syncope.common.lib.to.OIDCRPTO;
+import org.apache.syncope.common.lib.to.OIDCRPClientAppTO;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.syncope.common.lib.types.OIDCSubjectType;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -56,12 +56,12 @@ import org.junit.jupiter.api.BeforeAll;
public class OIDC4UIITCase extends AbstractUIITCase {
private static void clientAppSetup(final String appName, final String baseAddress, final long appId) {
- OIDCRPTO clientApp = clientAppService.list(ClientAppType.OIDCRP).stream().
+ OIDCRPClientAppTO clientApp = clientAppService.list(ClientAppType.OIDCRP).stream().
filter(app -> appName.equals(app.getName())).
- map(OIDCRPTO.class::cast).
+ map(OIDCRPClientAppTO.class::cast).
findFirst().
orElseGet(() -> {
- OIDCRPTO app = new OIDCRPTO();
+ OIDCRPClientAppTO app = new OIDCRPClientAppTO();
app.setName(appName);
app.setClientAppId(appId);
app.setClientId(appName);
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/SAML2SP4UIITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/SAML2SP4UIITCase.java
index 803f0f5..9f76428 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/SAML2SP4UIITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/ui/SAML2SP4UIITCase.java
@@ -49,7 +49,7 @@ import org.apache.syncope.client.ui.commons.SAML2SP4UIConstants;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.ItemTO;
import org.apache.syncope.common.lib.to.SAML2SP4UIIdPTO;
-import org.apache.syncope.common.lib.to.SAML2SPTO;
+import org.apache.syncope.common.lib.to.SAML2SPClientAppTO;
import org.apache.syncope.common.lib.types.ClientAppType;
import org.apache.syncope.common.lib.types.SAML2SPNameId;
import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -58,12 +58,12 @@ import org.junit.jupiter.api.BeforeAll;
public class SAML2SP4UIITCase extends AbstractUIITCase {
private static void clientAppSetup(final String appName, final String entityId, final long appId) {
- SAML2SPTO clientApp = clientAppService.list(ClientAppType.SAML2SP).stream().
+ SAML2SPClientAppTO clientApp = clientAppService.list(ClientAppType.SAML2SP).stream().
filter(app -> appName.equals(app.getName())).
- map(SAML2SPTO.class::cast).
+ map(SAML2SPClientAppTO.class::cast).
findFirst().
orElseGet(() -> {
- SAML2SPTO app = new SAML2SPTO();
+ SAML2SPClientAppTO app = new SAML2SPClientAppTO();
app.setName(appName);
app.setClientAppId(appId);
app.setEntityId(entityId);
diff --git a/pom.xml b/pom.xml
index 23dd468..81e6d7e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -406,7 +406,7 @@ under the License.
<cxf.version>3.4.3</cxf.version>
<bouncycastle.version>1.68</bouncycastle.version>
- <nimbus-jose-jwt.version>9.8</nimbus-jose-jwt.version>
+ <nimbus-jose-jwt.version>9.8.1</nimbus-jose-jwt.version>
<jackson.version>2.12.2</jackson.version>
@@ -475,8 +475,8 @@ under the License.
<wicket.version>9.3.0</wicket.version>
<wicketstuff.version>9.3.0</wicketstuff.version>
- <wicket-jqueryui.version>9.2.1</wicket-jqueryui.version>
- <wicket-bootstrap.version>5.0.3</wicket-bootstrap.version>
+ <wicket-jqueryui.version>9.3.1</wicket-jqueryui.version>
+ <wicket-bootstrap.version>5.0.4</wicket-bootstrap.version>
<wicket-spring-boot.version>3.0.4</wicket-spring-boot.version>
<ianal-maven-plugin-version>1.0-alpha-1</ianal-maven-plugin-version>
@@ -511,7 +511,7 @@ under the License.
<cargo.log>${log.directory}/cargo.log</cargo.log>
<cargo.output>${log.directory}/cargo-output.log</cargo.output>
- <tomcat.version>9.0.44</tomcat.version>
+ <tomcat.version>9.0.45</tomcat.version>
<wildfly.version>21.0.1.Final</wildfly.version>
<payara.version>5.2021.2</payara.version>
<javax.faces.version>2.3.14</javax.faces.version>
diff --git a/src/site/site.xml b/src/site/site.xml
index efd3533..a2cfdcb 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -100,8 +100,11 @@ Apache, Syncope, Apache Syncope, the Apache feather logo and the Apache Syncope
<a href="https://travis-ci.com/github/apache/syncope">
<img src="https://api.travis-ci.com/apache/syncope.png" style="vertical-align: top"/>
</a>
- <a href="https://ci.appveyor.com/project/ApacheSoftwareFoundation/syncope">
- <img src="https://ci.appveyor.com/api/projects/status/k3moao48iilrq2pw?svg=true" style="vertical-align: top"/>
+ <a href="https://github.com/apache/syncope/actions/workflows/crosschecks.yml">
+ <img src="https://github.com/apache/syncope/actions/workflows/crosschecks.yml/badge.svg" style="max-width:100%;vertical-align: top">
+ </a>
+ <a href="https://github.com/apache/syncope/actions/workflows/codeql-analysis.yml">
+ <img src="https://github.com/apache/syncope/actions/workflows/codeql-analysis.yml/badge.svg" style="max-width:100%;vertical-align: top">
</a>
</div>
]]>
diff --git a/src/site/xdoc/integration.xml b/src/site/xdoc/integration.xml
index 87f60c0..f434f77 100644
--- a/src/site/xdoc/integration.xml
+++ b/src/site/xdoc/integration.xml
@@ -40,10 +40,13 @@ under the License.
</p>
</section>
- <section name="AppVeyor">
+ <section name="GitHub Actions">
<p>
- <a href="https://ci.appveyor.com/project/ApacheSoftwareFoundation/syncope">
- <img src="https://ci.appveyor.com/api/projects/status/k3moao48iilrq2pw?svg=true"/>
+ <a href="https://github.com/apache/syncope/actions/workflows/crosschecks.yml">
+ <img src="https://github.com/apache/syncope/actions/workflows/crosschecks.yml/badge.svg" style="max-width:100%;">
+ </a>
+ <a href="https://github.com/apache/syncope/actions/workflows/codeql-analysis.yml">
+ <img src="https://github.com/apache/syncope/actions/workflows/codeql-analysis.yml/badge.svg" style="max-width:100%;">
</a>
</p>
</section>
diff --git a/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWAConfiguration.java b/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWAConfiguration.java
index 41a333d..39066d9 100644
--- a/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWAConfiguration.java
+++ b/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWAConfiguration.java
@@ -40,14 +40,14 @@ import org.apache.syncope.wa.starter.mapping.AttrReleaseMapFor;
import org.apache.syncope.wa.starter.mapping.AttrReleaseMapper;
import org.apache.syncope.wa.starter.mapping.AuthMapFor;
import org.apache.syncope.wa.starter.mapping.AuthMapper;
-import org.apache.syncope.wa.starter.mapping.CASSPTOMapper;
+import org.apache.syncope.wa.starter.mapping.CASSPClientAppTOMapper;
import org.apache.syncope.wa.starter.mapping.ClientAppMapFor;
import org.apache.syncope.wa.starter.mapping.ClientAppMapper;
import org.apache.syncope.wa.starter.mapping.DefaultAccessMapper;
import org.apache.syncope.wa.starter.mapping.DefaultAuthMapper;
-import org.apache.syncope.wa.starter.mapping.OIDCRPTOMapper;
+import org.apache.syncope.wa.starter.mapping.OIDCRPClientAppTOMapper;
import org.apache.syncope.wa.starter.mapping.RegisteredServiceMapper;
-import org.apache.syncope.wa.starter.mapping.SAML2SPTOMapper;
+import org.apache.syncope.wa.starter.mapping.SAML2SPClientAppTOMapper;
import org.apache.syncope.wa.starter.oidc.SyncopeWAOIDCJWKSGeneratorService;
import org.apache.syncope.wa.starter.pac4j.saml.SyncopeWASAML2ClientCustomizer;
import org.apache.syncope.wa.starter.saml.idp.metadata.RestfulSamlIdPMetadataGenerator;
@@ -132,34 +132,40 @@ public class SyncopeWAConfiguration {
new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT"));
}
+ @ConditionalOnMissingBean(name = "accessMapper")
@Bean
- public AttrReleaseMapper allowedAttrReleaseMapper() {
- return new DefaultAttrReleaseMapper();
+ public AccessMapper accessMapper() {
+ return new DefaultAccessMapper();
}
+ @ConditionalOnMissingBean(name = "attrReleaseMapper")
@Bean
- public ClientAppMapper casSPTOMapper() {
- return new CASSPTOMapper();
+ public AttrReleaseMapper attrReleaseMapper() {
+ return new DefaultAttrReleaseMapper();
}
+ @ConditionalOnMissingBean(name = "authMapper")
@Bean
- public AccessMapper defaultAccessMapper() {
- return new DefaultAccessMapper();
+ public AuthMapper authMapper() {
+ return new DefaultAuthMapper();
}
+ @ConditionalOnMissingBean(name = "casSPClientAppTOMapper")
@Bean
- public AuthMapper defaultAuthMapper() {
- return new DefaultAuthMapper();
+ public ClientAppMapper casSPClientAppTOMapper() {
+ return new CASSPClientAppTOMapper();
}
+ @ConditionalOnMissingBean(name = "oidcRPClientAppTOMapper")
@Bean
- public ClientAppMapper oidcRPTOMapper() {
- return new OIDCRPTOMapper();
+ public ClientAppMapper oidcRPClientAppTOMapper() {
+ return new OIDCRPClientAppTOMapper();
}
+ @ConditionalOnMissingBean(name = "saml2SPClientAppTOMapper")
@Bean
- public ClientAppMapper saml2SPTOMapper() {
- return new SAML2SPTOMapper();
+ public ClientAppMapper saml2SPClientAppTOMapper() {
+ return new SAML2SPClientAppTOMapper();
}
@ConditionalOnMissingBean
@@ -233,7 +239,7 @@ public class SyncopeWAConfiguration {
@Bean
public SamlIdPMetadataLocator samlIdPMetadataLocator(final WARestClient restClient) {
return new RestfulSamlIdPMetadataLocator(CipherExecutor.noOpOfStringToString(),
- Caffeine.newBuilder().build(), restClient);
+ Caffeine.newBuilder().build(), restClient);
}
@Autowired
@@ -310,7 +316,7 @@ public class SyncopeWAConfiguration {
public SurrogateAuthenticationService surrogateAuthenticationService(final WARestClient restClient) {
return new SyncopeWASurrogateAuthenticationService(restClient);
}
-
+
@Bean
public KeymasterStart keymasterStart() {
return new KeymasterStart(NetworkService.Type.WA);
diff --git a/wa/starter/src/main/java/org/apache/syncope/wa/starter/gauth/SyncopeWAGoogleMfaAuthCredentialRepository.java b/wa/starter/src/main/java/org/apache/syncope/wa/starter/gauth/SyncopeWAGoogleMfaAuthCredentialRepository.java
index c7cfdc0..3b8b102 100644
--- a/wa/starter/src/main/java/org/apache/syncope/wa/starter/gauth/SyncopeWAGoogleMfaAuthCredentialRepository.java
+++ b/wa/starter/src/main/java/org/apache/syncope/wa/starter/gauth/SyncopeWAGoogleMfaAuthCredentialRepository.java
@@ -23,11 +23,9 @@ import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
-import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.types.ClientExceptionType;
import org.apache.syncope.common.lib.wa.GoogleMfaAuthAccount;
-import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.wa.GoogleMfaAuthAccountService;
import org.apache.syncope.wa.bootstrap.WARestClient;
import org.apereo.cas.authentication.OneTimeTokenAccount;
@@ -73,9 +71,8 @@ public class SyncopeWAGoogleMfaAuthCredentialRepository extends BaseGoogleAuthen
@Override
public OneTimeTokenAccount get(final long id) {
try {
- GoogleMfaAuthAccountService googleService = waRestClient.getSyncopeClient().
- getService(GoogleMfaAuthAccountService.class);
- GoogleMfaAuthAccount account = googleService.read(id);
+ GoogleMfaAuthAccount account =
+ waRestClient.getSyncopeClient().getService(GoogleMfaAuthAccountService.class).read(id);
if (account != null) {
return mapGoogleMfaAuthAccount(account);
}
@@ -92,9 +89,8 @@ public class SyncopeWAGoogleMfaAuthCredentialRepository extends BaseGoogleAuthen
@Override
public OneTimeTokenAccount get(final String username, final long id) {
try {
- GoogleMfaAuthAccountService googleService = waRestClient.getSyncopeClient().
- getService(GoogleMfaAuthAccountService.class);
- googleService.readFor(username).getResult().stream().
+ waRestClient.getSyncopeClient().getService(GoogleMfaAuthAccountService.class).read(username).
+ getResult().stream().
filter(account -> account.getId() == id).
map(SyncopeWAGoogleMfaAuthCredentialRepository::mapGoogleMfaAuthAccount).
collect(Collectors.toList());
@@ -111,9 +107,8 @@ public class SyncopeWAGoogleMfaAuthCredentialRepository extends BaseGoogleAuthen
@Override
public Collection<? extends OneTimeTokenAccount> get(final String username) {
try {
- GoogleMfaAuthAccountService googleService = waRestClient.getSyncopeClient().
- getService(GoogleMfaAuthAccountService.class);
- googleService.readFor(username).getResult().stream().
+ waRestClient.getSyncopeClient().getService(GoogleMfaAuthAccountService.class).read(username).
+ getResult().stream().
map(SyncopeWAGoogleMfaAuthCredentialRepository::mapGoogleMfaAuthAccount).
collect(Collectors.toList());
} catch (final SyncopeClientException e) {
@@ -128,17 +123,14 @@ public class SyncopeWAGoogleMfaAuthCredentialRepository extends BaseGoogleAuthen
@Override
public Collection<? extends OneTimeTokenAccount> load() {
- GoogleMfaAuthAccountService googleService = waRestClient.getSyncopeClient().
- getService(GoogleMfaAuthAccountService.class);
- return googleService.list().getResult().stream().
+ return waRestClient.getSyncopeClient().getService(GoogleMfaAuthAccountService.class).list().
+ getResult().stream().
map(SyncopeWAGoogleMfaAuthCredentialRepository::mapGoogleMfaAuthAccount).
collect(Collectors.toList());
}
@Override
public OneTimeTokenAccount save(final OneTimeTokenAccount tokenAccount) {
- GoogleMfaAuthAccountService googleService = waRestClient.getSyncopeClient().
- getService(GoogleMfaAuthAccountService.class);
GoogleMfaAuthAccount account = new GoogleMfaAuthAccount.Builder()
.registrationDate(new Date())
.scratchCodes(tokenAccount.getScratchCodes())
@@ -147,46 +139,37 @@ public class SyncopeWAGoogleMfaAuthCredentialRepository extends BaseGoogleAuthen
.name(tokenAccount.getName())
.id(tokenAccount.getId())
.build();
- Response response = googleService.create(tokenAccount.getUsername(), account);
- String key = response.getHeaderString(RESTHeaders.RESOURCE_KEY);
- account.setKey(key);
+ waRestClient.getSyncopeClient().
+ getService(GoogleMfaAuthAccountService.class).create(tokenAccount.getUsername(), account);
return mapGoogleMfaAuthAccount(account);
}
@Override
public OneTimeTokenAccount update(final OneTimeTokenAccount tokenAccount) {
- GoogleMfaAuthAccountService googleService = waRestClient.getSyncopeClient().
- getService(GoogleMfaAuthAccountService.class);
GoogleMfaAuthAccount acct = mapGoogleMfaAuthAccount(tokenAccount);
- googleService.update(tokenAccount.getUsername(), acct);
+ waRestClient.getSyncopeClient().getService(GoogleMfaAuthAccountService.class).
+ update(tokenAccount.getUsername(), acct);
return tokenAccount;
}
@Override
public void deleteAll() {
- GoogleMfaAuthAccountService googleService = waRestClient.getSyncopeClient().
- getService(GoogleMfaAuthAccountService.class);
- googleService.delete();
+ waRestClient.getSyncopeClient().getService(GoogleMfaAuthAccountService.class).deleteAll();
}
@Override
public void delete(final String username) {
- GoogleMfaAuthAccountService googleService = waRestClient.getSyncopeClient().
- getService(GoogleMfaAuthAccountService.class);
- googleService.deleteFor(username);
+ waRestClient.getSyncopeClient().getService(GoogleMfaAuthAccountService.class).delete(username);
}
@Override
public long count() {
- GoogleMfaAuthAccountService googleService = waRestClient.getSyncopeClient().
- getService(GoogleMfaAuthAccountService.class);
- return googleService.list().getTotalCount();
+ return waRestClient.getSyncopeClient().getService(GoogleMfaAuthAccountService.class).list().getTotalCount();
}
@Override
public long count(final String username) {
- GoogleMfaAuthAccountService googleService = waRestClient.getSyncopeClient().
- getService(GoogleMfaAuthAccountService.class);
- return googleService.readFor(username).getTotalCount();
+ return waRestClient.getSyncopeClient().getService(GoogleMfaAuthAccountService.class).
+ read(username).getTotalCount();
}
}
diff --git a/wa/starter/src/main/java/org/apache/syncope/wa/starter/gauth/SyncopeWAGoogleMfaAuthTokenRepository.java b/wa/starter/src/main/java/org/apache/syncope/wa/starter/gauth/SyncopeWAGoogleMfaAuthTokenRepository.java
index ac2563d..35c612c 100644
--- a/wa/starter/src/main/java/org/apache/syncope/wa/starter/gauth/SyncopeWAGoogleMfaAuthTokenRepository.java
+++ b/wa/starter/src/main/java/org/apache/syncope/wa/starter/gauth/SyncopeWAGoogleMfaAuthTokenRepository.java
@@ -73,7 +73,7 @@ public class SyncopeWAGoogleMfaAuthTokenRepository extends BaseOneTimeTokenRepos
try {
GoogleMfaAuthTokenService tokenService = waRestClient.getSyncopeClient().
getService(GoogleMfaAuthTokenService.class);
- GoogleMfaAuthToken tokenTO = tokenService.readFor(username, otp);
+ GoogleMfaAuthToken tokenTO = tokenService.read(username, otp);
GoogleAuthenticatorToken token = new GoogleAuthenticatorToken(tokenTO.getOtp(), username);
LocalDateTime dateTime = tokenTO.getIssueDate().toInstant().atZone(ZoneOffset.UTC).toLocalDateTime();
token.setIssuedDateTime(dateTime);
@@ -95,7 +95,7 @@ public class SyncopeWAGoogleMfaAuthTokenRepository extends BaseOneTimeTokenRepos
public void remove(final String username) {
GoogleMfaAuthTokenService tokenService = waRestClient.getSyncopeClient().
getService(GoogleMfaAuthTokenService.class);
- tokenService.deleteFor(username);
+ tokenService.delete(username);
}
@Override
@@ -109,14 +109,14 @@ public class SyncopeWAGoogleMfaAuthTokenRepository extends BaseOneTimeTokenRepos
public void removeAll() {
GoogleMfaAuthTokenService tokenService = waRestClient.getSyncopeClient().
getService(GoogleMfaAuthTokenService.class);
- tokenService.delete(null);
+ tokenService.delete((Date) null);
}
@Override
public long count(final String username) {
GoogleMfaAuthTokenService tokenService = waRestClient.getSyncopeClient().
getService(GoogleMfaAuthTokenService.class);
- return tokenService.readFor(username).getTotalCount();
+ return tokenService.read(username).getTotalCount();
}
@Override
diff --git a/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/CASSPTOMapper.java b/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/CASSPClientAppTOMapper.java
similarity index 86%
rename from wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/CASSPTOMapper.java
rename to wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/CASSPClientAppTOMapper.java
index 74c41a8..5c7baf9 100644
--- a/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/CASSPTOMapper.java
+++ b/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/CASSPClientAppTOMapper.java
@@ -18,7 +18,7 @@
*/
package org.apache.syncope.wa.starter.mapping;
-import org.apache.syncope.common.lib.to.CASSPTO;
+import org.apache.syncope.common.lib.to.CASSPClientAppTO;
import org.apache.syncope.common.lib.wa.WAClientApp;
import org.apereo.cas.services.RegexRegisteredService;
import org.apereo.cas.services.RegisteredService;
@@ -26,8 +26,8 @@ import org.apereo.cas.services.RegisteredServiceAccessStrategy;
import org.apereo.cas.services.RegisteredServiceAttributeReleasePolicy;
import org.apereo.cas.services.RegisteredServiceAuthenticationPolicy;
-@ClientAppMapFor(clientAppClass = CASSPTO.class)
-public class CASSPTOMapper extends AbstractClientAppMapper {
+@ClientAppMapFor(clientAppClass = CASSPClientAppTO.class)
+public class CASSPClientAppTOMapper extends AbstractClientAppMapper {
@Override
public RegisteredService map(
@@ -36,7 +36,7 @@ public class CASSPTOMapper extends AbstractClientAppMapper {
final RegisteredServiceAccessStrategy accessStrategy,
final RegisteredServiceAttributeReleasePolicy attributeReleasePolicy) {
- CASSPTO cas = CASSPTO.class.cast(clientApp.getClientAppTO());
+ CASSPClientAppTO cas = CASSPClientAppTO.class.cast(clientApp.getClientAppTO());
RegexRegisteredService service = new RegexRegisteredService();
service.setServiceId(cas.getServiceId());
diff --git a/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/OIDCRPTOMapper.java b/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/OIDCRPClientAppTOMapper.java
similarity index 95%
rename from wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/OIDCRPTOMapper.java
rename to wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/OIDCRPClientAppTOMapper.java
index 1b8a1a4..f714377 100644
--- a/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/OIDCRPTOMapper.java
+++ b/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/OIDCRPClientAppTOMapper.java
@@ -24,7 +24,7 @@ import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.apache.syncope.common.lib.to.OIDCRPTO;
+import org.apache.syncope.common.lib.to.OIDCRPClientAppTO;
import org.apache.syncope.common.lib.types.OIDCGrantType;
import org.apache.syncope.common.lib.types.OIDCResponseType;
import org.apache.syncope.common.lib.wa.WAClientApp;
@@ -46,10 +46,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
-@ClientAppMapFor(clientAppClass = OIDCRPTO.class)
-public class OIDCRPTOMapper extends AbstractClientAppMapper {
+@ClientAppMapFor(clientAppClass = OIDCRPClientAppTO.class)
+public class OIDCRPClientAppTOMapper extends AbstractClientAppMapper {
- private static final Logger LOG = LoggerFactory.getLogger(OIDCRPTOMapper.class);
+ private static final Logger LOG = LoggerFactory.getLogger(OIDCRPClientAppTOMapper.class);
private static final String CUSTOM_SCOPE = "syncope";
@@ -60,7 +60,7 @@ public class OIDCRPTOMapper extends AbstractClientAppMapper {
final RegisteredServiceAccessStrategy accessStrategy,
final RegisteredServiceAttributeReleasePolicy attributeReleasePolicy) {
- OIDCRPTO rp = OIDCRPTO.class.cast(clientApp.getClientAppTO());
+ OIDCRPClientAppTO rp = OIDCRPClientAppTO.class.cast(clientApp.getClientAppTO());
OidcRegisteredService service = new OidcRegisteredService();
setCommon(service, rp);
... 1209 lines suppressed ...