diff --git a/cadcAccessControl-Identity/src/ca/nrc/cadc/auth/ACIdentityManager.java b/cadcAccessControl-Identity/src/ca/nrc/cadc/auth/ACIdentityManager.java index b71fa1a918a4a1389bd58d5569b8a70656002d8e..cb0adaf1ba7ba4cab8db04a7a94d39d44588a72f 100644 --- a/cadcAccessControl-Identity/src/ca/nrc/cadc/auth/ACIdentityManager.java +++ b/cadcAccessControl-Identity/src/ca/nrc/cadc/auth/ACIdentityManager.java @@ -1,7 +1,6 @@ package ca.nrc.cadc.auth; import java.io.File; -import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.security.Principal; @@ -15,12 +14,12 @@ import java.util.UUID; import javax.security.auth.Subject; import javax.security.auth.x500.X500Principal; -import ca.nrc.cadc.reg.Standards; import org.apache.log4j.Logger; import ca.nrc.cadc.ac.User; import ca.nrc.cadc.ac.client.UserClient; import ca.nrc.cadc.profiler.Profiler; +import ca.nrc.cadc.reg.Standards; import ca.nrc.cadc.reg.client.LocalAuthority; import ca.nrc.cadc.reg.client.RegistryClient; import ca.nrc.cadc.vosi.avail.CheckResource; @@ -232,22 +231,10 @@ public class ACIdentityManager implements IdentityManager */ public static CheckResource getAvailabilityCheck() { - try - { - RegistryClient regClient = new RegistryClient(); - LocalAuthority localAuth = new LocalAuthority(); - URI serviceURI = localAuth.getServiceURI(Standards.GMS_GROUPS_01.toString()); - URL serviceURL = regClient.getServiceURL(serviceURI, Standards.GMS_GROUPS_01, AuthMethod.ANON); - - // Hack to strip off the groups endpoint to get the base url of the service. - String serviceUrl = serviceURL.toExternalForm(); - int index = serviceUrl.lastIndexOf('/'); - URL availURL = new URL(serviceUrl.substring(0, index)+ "/availability"); - return new CheckWebService(availURL.toExternalForm()); - } - catch (MalformedURLException e) - { - throw new RuntimeException(e); - } + RegistryClient regClient = new RegistryClient(); + LocalAuthority localAuth = new LocalAuthority(); + URI serviceURI = localAuth.getServiceURI(Standards.GMS_GROUPS_01.toString()); + URL availURL = regClient.getServiceURL(serviceURI, Standards.VOSI_AVAILABILITY, AuthMethod.ANON); + return new CheckWebService(availURL.toExternalForm()); } } diff --git a/cadcAccessControl-Identity/src/ca/nrc/cadc/auth/AuthenticatorImpl.java b/cadcAccessControl-Identity/src/ca/nrc/cadc/auth/AuthenticatorImpl.java index 190ee08700d2f68219b61a9615c2c8862528b29b..1b2ffce71a24b33c8f4a7b5bb0f1104eced13713 100644 --- a/cadcAccessControl-Identity/src/ca/nrc/cadc/auth/AuthenticatorImpl.java +++ b/cadcAccessControl-Identity/src/ca/nrc/cadc/auth/AuthenticatorImpl.java @@ -1,16 +1,15 @@ package ca.nrc.cadc.auth; -import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import javax.security.auth.Subject; import javax.security.auth.x500.X500Principal; -import ca.nrc.cadc.reg.Standards; import org.apache.log4j.Logger; import ca.nrc.cadc.profiler.Profiler; +import ca.nrc.cadc.reg.Standards; import ca.nrc.cadc.reg.client.LocalAuthority; import ca.nrc.cadc.reg.client.RegistryClient; import ca.nrc.cadc.vosi.avail.CheckResource; @@ -70,22 +69,10 @@ public class AuthenticatorImpl implements Authenticator public static CheckResource getAvailabilityCheck() { - try - { - RegistryClient regClient = new RegistryClient(); - LocalAuthority localAuth = new LocalAuthority(); - URI serviceURI = localAuth.getServiceURI(Standards.GMS_GROUPS_01.toString()); - URL serviceURL = regClient.getServiceURL(serviceURI, Standards.GMS_GROUPS_01, AuthMethod.ANON); - - // Hack to strip off the groups endpoint to get the base url of the service. - String serviceUrl = serviceURL.toExternalForm(); - int index = serviceUrl.lastIndexOf('/'); - URL availURL = new URL(serviceUrl.substring(0, index)+ "/availability"); - return new CheckWebService(availURL.toExternalForm()); - } - catch (MalformedURLException e) - { - throw new RuntimeException(e); - } + RegistryClient regClient = new RegistryClient(); + LocalAuthority localAuth = new LocalAuthority(); + URI serviceURI = localAuth.getServiceURI(Standards.GMS_GROUPS_01.toString()); + URL availURL = regClient.getServiceURL(serviceURI, Standards.VOSI_AVAILABILITY, AuthMethod.ANON); + return new CheckWebService(availURL.toExternalForm()); } }