Skip to content

Commit

Permalink
Merge pull request #187 from pdowler/main
Browse files Browse the repository at this point in the history
cadc-vosi: capabilities transform remove unsupported security methods
  • Loading branch information
pdowler authored Aug 29, 2024
2 parents 367708c + 6e11deb commit 46fe54a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cadc-vosi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sourceCompatibility = 1.8

group = 'org.opencadc'

version = '1.4.6'
version = '1.4.7'

description = 'OpenCADC VOSI server library'
def git_url = 'https://github.com/opencadc/reg'
Expand Down
15 changes: 15 additions & 0 deletions cadc-vosi/src/main/java/ca/nrc/cadc/vosi/CapGetAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@

import ca.nrc.cadc.auth.AuthMethod;
import ca.nrc.cadc.auth.AuthenticationUtil;
import ca.nrc.cadc.auth.IdentityManager;
import ca.nrc.cadc.auth.NotAuthenticatedException;
import ca.nrc.cadc.net.HttpTransfer;
import ca.nrc.cadc.net.ResourceNotFoundException;
Expand All @@ -87,6 +88,7 @@
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.ListIterator;
import java.util.Set;
import java.util.TreeSet;
import org.apache.log4j.Logger;
Expand Down Expand Up @@ -173,6 +175,19 @@ private void transform(Capabilities caps) throws MalformedURLException {
URL nurl = new URL(url.getProtocol(), hostname, npath);
u.setURL(nurl);
log.debug("transform: " + url + " -> " + nurl);

IdentityManager im = AuthenticationUtil.getIdentityManager();
log.debug("IM: " + im.getClass().getName());
ListIterator<URI> iter = i.getSecurityMethods().listIterator();
while (iter.hasNext()) {
URI sm = iter.next();
if (!im.getSecurityMethods().contains(sm)) {
log.debug("unsupported securityMethod: " + sm + " - REMOVE");
iter.remove();
} else {
log.debug("supported securityMethod: " + sm + " - KEEP");
}
}
}
}
}
Expand Down

0 comments on commit 46fe54a

Please sign in to comment.