diff --git a/Backend/services/core/src/main/java/org/edu_sharing/service/handleservicedoi/DOIService.java b/Backend/services/core/src/main/java/org/edu_sharing/service/handleservicedoi/DOIService.java index 1af3e6a42..31c3386f1 100644 --- a/Backend/services/core/src/main/java/org/edu_sharing/service/handleservicedoi/DOIService.java +++ b/Backend/services/core/src/main/java/org/edu_sharing/service/handleservicedoi/DOIService.java @@ -175,7 +175,7 @@ public DOI getBasicMapping(String nodeId, Map properties, b List author = (List) properties.get(QName.createQName(CCConstants.CCM_PROP_IO_REPL_LIFECYCLECONTRIBUTER_AUTHOR)); List authorFreetext = (List) properties.get(QName.createQName(CCConstants.CCM_PROP_AUTHOR_FREETEXT)); if(author == null || author.isEmpty()){ - if((authorFreetext == null || authorFreetext.isEmpty()) && failOnMissing){ + if((authorFreetext == null || authorFreetext.isEmpty() || authorFreetext.stream().filter(StringUtils::isNotBlank).findAny().isEmpty()) && failOnMissing){ throw new DOIServiceMissingAttributeException(CCConstants.getValidLocalName(CCConstants.CCM_PROP_IO_REPL_LIFECYCLECONTRIBUTER_AUTHOR),"Creator"); } } @@ -184,7 +184,7 @@ public DOI getBasicMapping(String nodeId, Map properties, b .add(Data.Creator.builder().name(VCardConverter.getNameForVCardString(a)).build())); } if(authorFreetext != null && !authorFreetext.isEmpty()){ - authorFreetext.stream().forEach(a -> doi.getData().getAttributes().getCreators() + authorFreetext.stream().filter(StringUtils::isNotBlank).forEach(a -> doi.getData().getAttributes().getCreators() .add(Data.Creator.builder().name(a).build())); } diff --git a/Backend/services/core/src/main/java/org/edu_sharing/spring/security/saml2/SecurityConfigurationSaml.java b/Backend/services/core/src/main/java/org/edu_sharing/spring/security/saml2/SecurityConfigurationSaml.java index a60e139af..17ca8d26f 100644 --- a/Backend/services/core/src/main/java/org/edu_sharing/spring/security/saml2/SecurityConfigurationSaml.java +++ b/Backend/services/core/src/main/java/org/edu_sharing/spring/security/saml2/SecurityConfigurationSaml.java @@ -4,6 +4,7 @@ import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.log4j.Logger; import org.edu_sharing.alfresco.lightbend.LightbendConfigLoader; @@ -42,6 +43,7 @@ import org.springframework.security.web.util.matcher.RequestMatcher; import org.springframework.util.StringUtils; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Constructor; @@ -51,6 +53,7 @@ import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.security.interfaces.RSAPrivateKey; +import java.util.Collection; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; @@ -198,8 +201,25 @@ RelyingPartyRegistrationRepository relyingPartyRegistrationRepository() { RSAPrivateKey privateKey = converter.convert(pkInputStream); String globalSPRegistrationId = "one"; - List relyingPartyRegistration = RelyingPartyRegistrations - .collectionFromMetadataLocation(config.getString("security.sso.saml.idp.metadata.url")) + + + Collection b = null; + String cfgMetadataPath = "security.sso.saml.idp.metadata"; + if(config.hasPath(cfgMetadataPath +".content")){ + b = RelyingPartyRegistrations.collectionFromMetadata(IOUtils.toInputStream(config.getString(cfgMetadataPath +".content"))); + }else if(config.hasPath(cfgMetadataPath +".filePath")){ + File f = new File(config.getString(cfgMetadataPath +".filePath")); + b = RelyingPartyRegistrations.collectionFromMetadata(FileUtils.openInputStream(f)); + }else if(config.hasPath(cfgMetadataPath + ".url")){ + b = RelyingPartyRegistrations + .collectionFromMetadataLocation(config.getString(cfgMetadataPath + ".url")); + } + + if(b == null){ + throw new RuntimeException("no IDP metadata configured"); + } + + List relyingPartyRegistration = b .stream().map((builder) -> { String relyingPartyId = getRelyingPartyId(builder); return builder.registrationId(relyingPartyId) diff --git a/Frontend/src/app/features/dialogs/dialog-modules/license-dialog/license-dialog-content.component.ts b/Frontend/src/app/features/dialogs/dialog-modules/license-dialog/license-dialog-content.component.ts index bf26ddcbe..02c3282be 100644 --- a/Frontend/src/app/features/dialogs/dialog-modules/license-dialog/license-dialog-content.component.ts +++ b/Frontend/src/app/features/dialogs/dialog-modules/license-dialog/license-dialog-content.component.ts @@ -175,7 +175,7 @@ export class LicenseDialogContentComponent implements OnInit { } } else { // if no version is selected select 4.0 by default - if (!this.ccVersion) this.ccVersion = '4.0'; + if (!['2.0', '3.0', '4.0'].includes(this.ccVersion)) this.ccVersion = '4.0'; } this._primaryType = primaryType; this.updateCanSave(); @@ -682,6 +682,7 @@ export class LicenseDialogContentComponent implements OnInit { if (this.ccProfileUrl) { prop[RestConstants.CCM_PROP_LICENSE_PROFILE_URL] = [this.ccProfileUrl]; } + if (this.ccVersion) { prop[RestConstants.CCM_PROP_LICENSE_CC_VERSION] = [this.ccVersion]; // make sure v4.0 has no locale diff --git a/Frontend/src/app/modules/workspace/workspace.component.ts b/Frontend/src/app/modules/workspace/workspace.component.ts index 29bdbf22c..8ab4dadea 100644 --- a/Frontend/src/app/modules/workspace/workspace.component.ts +++ b/Frontend/src/app/modules/workspace/workspace.component.ts @@ -473,6 +473,7 @@ export class WorkspaceMainComponent implements EventListener, OnInit, OnDestroy await this.prepareActionbar(); await this.initUser(); this.loadFolders(this.user); + this.initMainNav(); this.connector.scope = this.isSafe ? RestConstants.SAFE_SCOPE : null; this.isLoggedIn = true; @@ -521,8 +522,6 @@ export class WorkspaceMainComponent implements EventListener, OnInit, OnDestroy } this.mainnav = params.mainnav === 'false' ? false : true; - this.initMainNav(); - if (params.file && params.file !== this.oldParams?.file) { void this.showNodeInCurrentFolder(params.file); } diff --git a/config/defaults/src/main/resources/edu-sharing.reference.conf b/config/defaults/src/main/resources/edu-sharing.reference.conf index 5defb04a5..8e0d9ac4d 100644 --- a/config/defaults/src/main/resources/edu-sharing.reference.conf +++ b/config/defaults/src/main/resources/edu-sharing.reference.conf @@ -110,7 +110,9 @@ security { useHomeApplicationKeys: false idp: { metadata: { - url: "http://idp/metadata.xml" + url: "http://idp/metadata.xml" +// content: """...""" +// filePath: /tmp/metadata.xml } } } diff --git a/config/defaults/src/main/resources/metadatasets/xml/mds.xml b/config/defaults/src/main/resources/metadatasets/xml/mds.xml index 6d4f2b649..8b2d699ff 100644 --- a/config/defaults/src/main/resources/metadatasets/xml/mds.xml +++ b/config/defaults/src/main/resources/metadatasets/xml/mds.xml @@ -1321,6 +1321,9 @@ {"bool":{ "must":[ {"term":{"nodeRef.storeRef.protocol":"workspace"}} + ], + "must_not":[ + {"exists":{"field": "properties.ccm:published_original"}} ] }}