Skip to content

Commit

Permalink
SHIBUI-2581
Browse files Browse the repository at this point in the history
Remove validUntil from the EntityDescriptor (by default) XML uploads
  • Loading branch information
chasegawa committed Jul 11, 2023
1 parent 1a665d4 commit 7257510
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.opensaml.xmlsec.signature.KeyName;
import org.opensaml.xmlsec.signature.KeyValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
Expand Down Expand Up @@ -90,6 +91,9 @@ public class JPAEntityDescriptorServiceImpl implements EntityDescriptorService {
@Autowired
private UserService userService;

@Value("${shibui.remove.EntityDescriptor.validUntil:true}")
private Boolean removeValidUntil;

private EntityDescriptor buildDescriptorFromRepresentation(final EntityDescriptor ed, final EntityDescriptorRepresentation representation) {
ed.setEntityID(representation.getEntityId());
ed.setIdOfOwner(representation.getIdOfOwner());
Expand Down Expand Up @@ -273,6 +277,11 @@ public EntityDescriptorRepresentation createNewEntityDescriptorFromXMLOrigin(Ent
userService.getCurrentUserGroup().getApproversList().isEmpty()) {
ed.setApproved(true);
}

if (removeValidUntil) {
ed.setValidUntil(null);
}

EntityDescriptor savedEntity = entityDescriptorRepository.save(ed);
return createRepresentationFromDescriptor(savedEntity);
}
Expand Down
5 changes: 4 additions & 1 deletion backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,7 @@ management.endpoints.web.cors.allowed-origins=*
management.endpoints.web.cors.allowed-headers=*

### Lucene temp dir location to use
shibui.lucene.dir=/var/tmp/shibui-cache
shibui.lucene.dir=/var/tmp/shibui-cache

# When true, this will remove the validUntil attribute for an EntityDescriptor uploaded from XML source, only set to false if you want the XML uploaded as is
# shibui.remove.EntityDescriptor.validUntil=true

0 comments on commit 7257510

Please sign in to comment.