Skip to content

Commit

Permalink
SHIBUI-2614
Browse files Browse the repository at this point in the history
Undid some previous changes - root cause was hibernate sequences...
  • Loading branch information
chasegawa committed Oct 2, 2023
1 parent 3ac7ea2 commit c0bb485
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<AbstractXMLObject> attributeValues = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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();
Expand All @@ -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());
Expand All @@ -420,7 +422,7 @@ public EntityDescriptorRepresentation createRepresentationFromDescriptor(org.ope
// we have entity attributes (hopefully), so should have overrides
Map<String, Object> 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)) {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
##<!-- ensure backward compatibility -->
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
Expand Down

0 comments on commit c0bb485

Please sign in to comment.