From 6135564655fc07ecc6907d3861bf40003c3cbafa Mon Sep 17 00:00:00 2001 From: pujavs Date: Fri, 24 Jan 2025 13:59:16 +0530 Subject: [PATCH] fix(config-api): asset upload config and saml document store changes Signed-off-by: pujavs --- .../customization/customize-web-pages.md | 4 +-- .../docs/jans-config-api-swagger.yaml | 16 ++++----- .../plugin/saml/service/SamlIdpService.java | 36 +++++++++---------- .../configapi/service/auth/AssetService.java | 6 ---- .../jans-config-api/dynamic-conf.json | 15 ++------ 5 files changed, 29 insertions(+), 48 deletions(-) diff --git a/docs/janssen-server/developer/customization/customize-web-pages.md b/docs/janssen-server/developer/customization/customize-web-pages.md index a6598e08801..a0ddad6c271 100644 --- a/docs/janssen-server/developer/customization/customize-web-pages.md +++ b/docs/janssen-server/developer/customization/customize-web-pages.md @@ -81,7 +81,7 @@ Listing of custom asset types that each Janssen Server module accepts: | Path | Asset Type | |----------------|-------------| -| /opt/jans/jetty/jans-lock/custom-libs | *.jar +| /opt/jans/jetty/jans-lock/custom/libs | *.jar ### KeyCloak-link @@ -96,7 +96,7 @@ Listing of custom asset types that each Janssen Server module accepts: | Path | Asset Type | |----------------|-------------| -| /opt/jans/jetty/jans-link/custom-libs | *.jar +| /opt/jans/jetty/jans-link/custom/libs | *.jar | /var/jans/link-snapshots/ | *.txt diff --git a/jans-config-api/docs/jans-config-api-swagger.yaml b/jans-config-api/docs/jans-config-api-swagger.yaml index 5d9c8373cf1..c38befde24a 100644 --- a/jans-config-api/docs/jans-config-api-swagger.yaml +++ b/jans-config-api/docs/jans-config-api-swagger.yaml @@ -9339,16 +9339,16 @@ components: type: boolean adminCanView: type: boolean - userCanView: + adminCanEdit: type: boolean userCanEdit: type: boolean - adminCanEdit: - type: boolean - adminCanAccess: + userCanView: type: boolean userCanAccess: type: boolean + adminCanAccess: + type: boolean whitePagesCanView: type: boolean baseDn: @@ -11331,14 +11331,14 @@ components: type: boolean internal: type: boolean + locationPath: + type: string locationType: type: string enum: - ldap - db - file - locationPath: - type: string baseDn: type: string ScriptError: @@ -11767,10 +11767,10 @@ components: ttl: type: integer format: int32 - opbrowserState: - type: string persisted: type: boolean + opbrowserState: + type: string SessionIdAccessMap: type: object properties: diff --git a/jans-config-api/plugins/kc-saml-plugin/src/main/java/io/jans/configapi/plugin/saml/service/SamlIdpService.java b/jans-config-api/plugins/kc-saml-plugin/src/main/java/io/jans/configapi/plugin/saml/service/SamlIdpService.java index 0b7a16077c5..b0b33b2c532 100644 --- a/jans-config-api/plugins/kc-saml-plugin/src/main/java/io/jans/configapi/plugin/saml/service/SamlIdpService.java +++ b/jans-config-api/plugins/kc-saml-plugin/src/main/java/io/jans/configapi/plugin/saml/service/SamlIdpService.java @@ -6,7 +6,6 @@ package io.jans.configapi.plugin.saml.service; -import io.jans.service.document.store.service.DocumentStoreService; import io.jans.service.document.store.conf.DocumentStoreType; import io.jans.service.document.store.service.LocalDocumentStoreService; import io.jans.util.exception.InvalidConfigurationException; @@ -38,8 +37,6 @@ public class SamlIdpService { @Inject Logger logger; - @Inject - private DocumentStoreService documentStoreService; @Inject private LocalDocumentStoreService localDocumentStoreService; @@ -58,7 +55,7 @@ public void create() { } public boolean isLocalDocumentStoreType() { - return documentStoreService.getProviderType() == DocumentStoreType.LOCAL; + return localDocumentStoreService.getProviderType() == DocumentStoreType.LOCAL; } public String saveMetadataFile(String metadataDir, String metadataFileName, String documentStoreModuleName, @@ -83,14 +80,13 @@ public String saveMetadataFile(String metadataDir, String metadataFileName, Stri } String metadataFile = metadataDir + File.separator + metadataFileName; - logger.info("documentStoreService:{}, metadataFile:{}, localDocumentStoreService:{} ", documentStoreService, - metadataFile, localDocumentStoreService); + logger.info("metadataFile:{}, localDocumentStoreService:{} ", metadataFile, localDocumentStoreService); try { - String result = documentStoreService.saveDocumentStream(metadataFile, null, - stream, documentStoreModuleName); + String result = localDocumentStoreService.saveDocumentStream(metadataFile, null, stream, + documentStoreModuleName); logger.info("SAML file saving result:{}", result); - InputStream newFile = documentStoreService.readDocumentAsStream(metadataFile); + InputStream newFile = localDocumentStoreService.readDocumentAsStream(metadataFile); logger.info("SAML file read newFile:{}", newFile); if (result != null) { @@ -114,16 +110,16 @@ public GluuErrorHandler validateMetadata(String metadataPath) return new GluuErrorHandler(false, true, validationLog); } - try (InputStream stream = documentStoreService.readDocumentAsStream(metadataPath)) { + try (InputStream stream = localDocumentStoreService.readDocumentAsStream(metadataPath)) { return XMLValidator.validateMetadata(stream, samlSchema); } } public boolean renameMetadata(String metadataPath, String destinationMetadataPath) { logger.debug("Rename metadata file documentStoreService:{},metadataPath:{}, destinationMetadataPath:{}", - documentStoreService, metadataPath, destinationMetadataPath); + localDocumentStoreService, metadataPath, destinationMetadataPath); try { - return documentStoreService.renameDocument(metadataPath, destinationMetadataPath) != null; + return localDocumentStoreService.renameDocument(metadataPath, destinationMetadataPath) != null; } catch (Exception ex) { logger.error("Failed to rename metadata '{}' to '{}'", metadataPath, destinationMetadataPath, ex); } @@ -133,24 +129,24 @@ public boolean renameMetadata(String metadataPath, String destinationMetadataPat public InputStream getFileFromDocumentStore(String path) { - logger.debug("Get file from DocumentStore. Path: {}",path); + logger.debug("Get file from DocumentStore. Path: {}", path); try { - return documentStoreService.readDocumentAsStream(path); - }catch(Exception e) { - logger.error("Failed to get file '{}' from DocumentStore",path); + return localDocumentStoreService.readDocumentAsStream(path); + } catch (Exception e) { + logger.error("Failed to get file '{}' from DocumentStore", path); return null; } } - private String getTempMetadataFilename(String metadataFolder, String fileName) { - logger.info("documentStoreService:{}, localDocumentStoreService:{}, metadataFolder:{}, fileName:{}", - documentStoreService, localDocumentStoreService, metadataFolder, fileName); + public String getTempMetadataFilename(String metadataFolder, String fileName) { + logger.info("localDocumentStoreService:{}, metadataFolder:{}, fileName:{}", localDocumentStoreService, + metadataFolder, fileName); synchronized (SamlIdpService.class) { String possibleTemp; do { possibleTemp = fileName + INumGenerator.generate(2); logger.debug("possibleTemp:{}", possibleTemp); - } while (documentStoreService.hasDocument(metadataFolder + possibleTemp)); + } while (localDocumentStoreService.hasDocument(metadataFolder + possibleTemp)); return possibleTemp; } } diff --git a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AssetService.java b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AssetService.java index e3c552242f0..aa566f97737 100644 --- a/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AssetService.java +++ b/jans-config-api/server/src/main/java/io/jans/configapi/service/auth/AssetService.java @@ -19,7 +19,6 @@ import io.jans.orm.search.filter.Filter; import io.jans.orm.PersistenceEntryManager; import io.jans.service.document.store.model.Document; -import io.jans.service.document.store.provider.DBDocumentStoreProvider; import io.jans.service.document.store.service.DBDocumentService; import io.jans.util.exception.InvalidAttributeException; @@ -33,11 +32,9 @@ import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.stream.*; import jakarta.enterprise.context.ApplicationScoped; @@ -66,9 +63,6 @@ public class AssetService { @Inject AuthUtil authUtil; - @Inject - DBDocumentStoreProvider dBDocumentStoreProvider; - @Inject DocumentStoreService documentStoreService; diff --git a/jans-linux-setup/jans_setup/templates/jans-config-api/dynamic-conf.json b/jans-linux-setup/jans_setup/templates/jans-config-api/dynamic-conf.json index 22919ca6e8a..16917a57127 100644 --- a/jans-linux-setup/jans_setup/templates/jans-config-api/dynamic-conf.json +++ b/jans-linux-setup/jans_setup/templates/jans-config-api/dynamic-conf.json @@ -112,7 +112,9 @@ "jans-auth", "jans-config-api", "jans-keycloak-link", - "jans-scim" + "jans-scim", + "jans-lock", + "jans-link" ], "description": "java archive library." }, @@ -261,17 +263,6 @@ ], "description": " FIDO Server Metadata." }, - { - "directory": "/opt/jans/jetty/%s/custom-libs", - "type": [ - "jar" - ], - "jansServiceModule": [ - "jans-lock", - "jans-link" - ], - "description": "java archive library." - }, { "directory": "/var/jans/keycloak-link-snapshots", "type": [