diff --git a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/domain/Attribute.java b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/domain/Attribute.java index 835a9aeda..06335c94a 100644 --- a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/domain/Attribute.java +++ b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/domain/Attribute.java @@ -25,7 +25,7 @@ public class Attribute extends AbstractAttributeExtensibleXMLObject implements o private String friendlyName; - @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST}) + @OneToMany(cascade = {CascadeType.ALL}) @OrderColumn @Audited private List attributeValues = new ArrayList<>(); diff --git a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/JPAEntityDescriptorServiceImpl.java b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/JPAEntityDescriptorServiceImpl.java index fe5760583..ab40e84fc 100644 --- a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/JPAEntityDescriptorServiceImpl.java +++ b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/JPAEntityDescriptorServiceImpl.java @@ -322,7 +322,9 @@ public EntityDescriptorRepresentation createRepresentationFromDescriptor(org.ope if (ed.getSPSSODescriptor("") != null && ed.getSPSSODescriptor("").getNameIDFormats().size() > 0) { ServiceProviderSsoDescriptorRepresentation serviceProviderSsoDescriptorRepresentation = representation.getServiceProviderSsoDescriptor(true); - serviceProviderSsoDescriptorRepresentation.setNameIdFormats(ed.getSPSSODescriptor("").getNameIDFormats().stream().filter(str -> str != null).map(p -> p.getURI()).collect(Collectors.toList())); + serviceProviderSsoDescriptorRepresentation.setNameIdFormats( + ed.getSPSSODescriptor("").getNameIDFormats().stream().map(p -> p.getURI()).collect(Collectors.toList()) + ); } if (ed.isOidcProtocol()) { @@ -389,11 +391,11 @@ public EntityDescriptorRepresentation createRepresentationFromDescriptor(org.ope setupSecurityRepresentationFromEntityDescriptor(ed, representation); // set up ACSs - if (ed.getSPSSODescriptor("") != null && ed.getSPSSODescriptor("").getAssertionConsumerServices().stream().filter(val -> val != null).toList().size() > 0) { + if (ed.getSPSSODescriptor("") != null && ed.getSPSSODescriptor("").getAssertionConsumerServices().size() > 0) { if (representation.getAssertionConsumerServices() == null) { representation.setAssertionConsumerServices(new ArrayList<>()); } - for (org.opensaml.saml.saml2.metadata.AssertionConsumerService assertionConsumerService : ed.getSPSSODescriptor("").getAssertionConsumerServices().stream().filter(val -> val != null).toList()) { + for (org.opensaml.saml.saml2.metadata.AssertionConsumerService assertionConsumerService : ed.getSPSSODescriptor("").getAssertionConsumerServices()) { AssertionConsumerServiceRepresentation assertionConsumerServiceRepresentation = new AssertionConsumerServiceRepresentation(); Boolean isDefault = assertionConsumerService.isDefault(); @@ -406,8 +408,8 @@ public EntityDescriptorRepresentation createRepresentationFromDescriptor(org.ope } // set up logout endpoints - if (ed.getSPSSODescriptor("") != null && !ed.getSPSSODescriptor("").getSingleLogoutServices().stream().filter(val -> val != null).toList().isEmpty()) { - for (org.opensaml.saml.saml2.metadata.SingleLogoutService singleLogoutService : ed.getSPSSODescriptor("").getSingleLogoutServices().stream().filter(val -> val != null).toList()) { + if (ed.getSPSSODescriptor("") != null && !ed.getSPSSODescriptor("").getSingleLogoutServices().isEmpty()) { + for (org.opensaml.saml.saml2.metadata.SingleLogoutService singleLogoutService : ed.getSPSSODescriptor("").getSingleLogoutServices()) { LogoutEndpointRepresentation logoutEndpointRepresentation = new LogoutEndpointRepresentation(); logoutEndpointRepresentation.setBindingType(singleLogoutService.getBinding()); logoutEndpointRepresentation.setUrl(singleLogoutService.getLocation()); @@ -420,7 +422,7 @@ public EntityDescriptorRepresentation createRepresentationFromDescriptor(org.ope // we have entity attributes (hopefully), so should have overrides Map relyingPartyOverrides = new HashMap<>(); - for (org.opensaml.saml.saml2.core.Attribute attribute : ((EntityAttributes) ed.getExtensions().getUnknownXMLObjects(EntityAttributes.DEFAULT_ELEMENT_NAME).get(0)).getAttributes().stream().filter(val -> val != null).toList()) { + for (org.opensaml.saml.saml2.core.Attribute attribute : ((EntityAttributes) ed.getExtensions().getUnknownXMLObjects(EntityAttributes.DEFAULT_ELEMENT_NAME).get(0)).getAttributes()) { Attribute jpaAttribute = (Attribute) attribute; if (jpaAttribute.getName().equals(MDDCConstants.RELEASE_ATTRIBUTES)) { @@ -607,7 +609,7 @@ private void setupSecurityRepresentationFromEntityDescriptor(EntityDescriptor ed representation.setSecurityInfo(securityInfoRepresentation); } - for (org.opensaml.saml.saml2.metadata.KeyDescriptor keyDescriptor : ed.getSPSSODescriptor("").getKeyDescriptors().stream().filter(val -> val != null).toList()) { + for (org.opensaml.saml.saml2.metadata.KeyDescriptor keyDescriptor : ed.getSPSSODescriptor("").getKeyDescriptors()) { KeyDescriptorRepresentation keyDescriptorRep = new KeyDescriptorRepresentation(); String name = keyDescriptor.getKeyInfo().getKeyNames().size() > 0 ? keyDescriptor.getKeyInfo().getKeyNames().get(0).getValue() : null; name = name == null ? ((KeyDescriptor)keyDescriptor).getName() : name; diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index b8bc0b840..4d34e2032 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -53,6 +53,10 @@ spring.jpa.properties.hibernate.format_sql=true spring.jpa.properties.hibernate.check_nullability=true spring.jpa.hibernate.use-new-id-generator-mappings=true spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true +## +hibernate.id.db_structure_naming_strategy=legacy +spring.jpa.hibernate.id.db_structure_naming_strategy=legacy +spring.jpa.properties.hibernate.id.db_structure_naming_strategy=legacy #Envers versioning spring.jpa.properties.org.hibernate.envers.store_data_at_delete=true