diff --git a/cadc-access-control-server/build.gradle b/cadc-access-control-server/build.gradle index 15df99d2..c8bc364c 100644 --- a/cadc-access-control-server/build.gradle +++ b/cadc-access-control-server/build.gradle @@ -13,7 +13,7 @@ sourceCompatibility = 1.8 group = 'org.opencadc' -version = '1.3.34' +version = '1.3.33' description = 'OpenCADC User+Group server library' def git_url = 'https://github.com/opencadc/ac' diff --git a/cadc-access-control-server/src/main/java/ca/nrc/cadc/ac/server/oidc/OIDCUtil.java b/cadc-access-control-server/src/main/java/ca/nrc/cadc/ac/server/oidc/OIDCUtil.java index 15bca1b6..b5d9d904 100644 --- a/cadc-access-control-server/src/main/java/ca/nrc/cadc/ac/server/oidc/OIDCUtil.java +++ b/cadc-access-control-server/src/main/java/ca/nrc/cadc/ac/server/oidc/OIDCUtil.java @@ -81,6 +81,7 @@ import ca.nrc.cadc.auth.NumericPrincipal; import ca.nrc.cadc.auth.SignedToken; import ca.nrc.cadc.net.TransientException; +import ca.nrc.cadc.util.FileUtil; import ca.nrc.cadc.util.MultiValuedProperties; import ca.nrc.cadc.util.PropertiesReader; import ca.nrc.cadc.util.RsaSignatureGenerator; @@ -334,7 +335,6 @@ private static Map buildTokenClaimsSet(RelyParty rp, String requ if (rp.getClaims().contains(RelyParty.Claim.NAME)) { claimsMap.put(RelyParty.Claim.NAME.getValue(), useridPrincipal.getName()); - claimsMap.put(RelyParty.Claim.PREFERRED_USERNAME.getValue(), useridPrincipal.getName()); } if (rp.getClaims().contains(RelyParty.Claim.EMAIL)) { claimsMap.put(RelyParty.Claim.EMAIL.getValue(), email); diff --git a/cadc-access-control-server/src/main/java/ca/nrc/cadc/ac/server/oidc/RelyParty.java b/cadc-access-control-server/src/main/java/ca/nrc/cadc/ac/server/oidc/RelyParty.java index ada3ef81..30433ec0 100644 --- a/cadc-access-control-server/src/main/java/ca/nrc/cadc/ac/server/oidc/RelyParty.java +++ b/cadc-access-control-server/src/main/java/ca/nrc/cadc/ac/server/oidc/RelyParty.java @@ -138,7 +138,6 @@ public boolean equals(Object o) { public enum Claim { NAME("name", "Name"), - PREFERRED_USERNAME("preferred_username", "Username"), EMAIL("email", "Email Address"), GROUPS("memberOf", "Group Memberships"); diff --git a/cadc-gms/build.gradle b/cadc-gms/build.gradle index 4b5000b6..240a5d5b 100644 --- a/cadc-gms/build.gradle +++ b/cadc-gms/build.gradle @@ -16,7 +16,7 @@ sourceCompatibility = 1.8 group = 'org.opencadc' -version = '1.0.9' +version = '1.0.10' description = 'OpenCADC GMS API library' def git_url = 'https://github.com/opencadc/ac' diff --git a/cadc-gms/src/main/java/org/opencadc/auth/PosixMapperClient.java b/cadc-gms/src/main/java/org/opencadc/auth/PosixMapperClient.java index 42652d4d..8de1285f 100644 --- a/cadc-gms/src/main/java/org/opencadc/auth/PosixMapperClient.java +++ b/cadc-gms/src/main/java/org/opencadc/auth/PosixMapperClient.java @@ -71,6 +71,7 @@ import ca.nrc.cadc.auth.AuthenticationUtil; import ca.nrc.cadc.auth.HttpPrincipal; import ca.nrc.cadc.auth.PosixPrincipal; +import ca.nrc.cadc.io.ResourceIterator; import ca.nrc.cadc.net.HttpGet; import ca.nrc.cadc.net.ResourceAlreadyExistsException; import ca.nrc.cadc.net.ResourceNotFoundException; @@ -88,7 +89,6 @@ import java.security.Principal; import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Set; import javax.security.auth.Subject; @@ -234,14 +234,14 @@ public List getURI(List groups) * @throws ResourceAlreadyExistsException Not used. * @throws InterruptedException Should not ever happen. */ - public Iterator getUserMap() throws IOException, ResourceNotFoundException, - ResourceAlreadyExistsException, InterruptedException { + public ResourceIterator getUserMap() throws IOException, ResourceNotFoundException, + ResourceAlreadyExistsException, InterruptedException { final URL userMapURL = getServiceURL(Standards.POSIX_USERMAP); final HttpGet get = new HttpGet(userMapURL, true); get.setRequestProperty("accept", "text/tab-separated-values"); get.prepare(); - return new Iterator() { + return new ResourceIterator() { private final BufferedReader reader = new BufferedReader(new InputStreamReader(get.getInputStream())); private String line; @@ -260,6 +260,11 @@ public PosixPrincipal next() { line = null; return nextPrincipal; } + + @Override + public void close() throws IOException { + reader.close(); + } }; } @@ -275,14 +280,14 @@ public PosixPrincipal next() { * @throws ResourceAlreadyExistsException Not used. * @throws InterruptedException Should not ever happen. */ - public Iterator getGroupMap() throws IOException, ResourceNotFoundException, + public ResourceIterator getGroupMap() throws IOException, ResourceNotFoundException, ResourceAlreadyExistsException, InterruptedException { final URL userMapURL = getServiceURL(Standards.POSIX_GROUPMAP); final HttpGet get = new HttpGet(userMapURL, true); get.setRequestProperty("accept", "text/tab-separated-values"); get.prepare(); - return new Iterator() { + return new ResourceIterator() { private final BufferedReader reader = new BufferedReader(new InputStreamReader(get.getInputStream())); private String line; @Override @@ -300,6 +305,11 @@ public PosixGroup next() { line = null; return posixGroup; } + + @Override + public void close() throws IOException { + reader.close(); + } }; }