Commit e14cb641 authored by Brian Major's avatar Brian Major
Browse files

s1849 - changed availability check to use VOSI availability standardURI

parent f8561636
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;
......@@ -231,23 +230,11 @@ public class ACIdentityManager implements IdentityManager
* @return
*/
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");
URL availURL = regClient.getServiceURL(serviceURI, Standards.VOSI_AVAILABILITY, AuthMethod.ANON);
return new CheckWebService(availURL.toExternalForm());
}
catch (MalformedURLException e)
{
throw new RuntimeException(e);
}
}
}
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;
......@@ -69,23 +68,11 @@ 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");
URL availURL = regClient.getServiceURL(serviceURI, Standards.VOSI_AVAILABILITY, AuthMethod.ANON);
return new CheckWebService(availURL.toExternalForm());
}
catch (MalformedURLException e)
{
throw new RuntimeException(e);
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment