Commit 439b9bfb authored by Jeff Burke's avatar Jeff Burke
Browse files

s1849: updates for latest cadcRegistry changes.

parent 0b2d274e
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -237,8 +237,12 @@ public class ACIdentityManager implements IdentityManager
            RegistryClient regClient = new RegistryClient();
            LocalAuthority localAuth = new LocalAuthority();
            URI serviceURI = localAuth.getServiceURI("gms");
            URL serviceURL = regClient.getServiceURL(serviceURI, Standards.GMS_01_URI, AuthMethod.ANON);
            URL availURL = new URL(serviceURL.toExternalForm() + "/availability");
            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)
+6 −2
Original line number Diff line number Diff line
@@ -75,8 +75,12 @@ public class AuthenticatorImpl implements Authenticator
            RegistryClient regClient = new RegistryClient();
            LocalAuthority localAuth = new LocalAuthority();
            URI serviceURI = localAuth.getServiceURI("gms");
            URL serviceURL = regClient.getServiceURL(serviceURI, Standards.GMS_01_URI, AuthMethod.ANON);
            URL availURL = new URL(serviceURL.toExternalForm() + "/availability");
            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)
+11 −11
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ public class GMSClient implements TransferListener
               UserNotFoundException, WriterException, IOException
    {
        URL createGroupURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01, AuthMethod.CERT);
        log.debug("createGroupURL request to " + createGroupURL.toString());

        // reset the state of the cache
@@ -255,7 +255,7 @@ public class GMSClient implements TransferListener
        throws GroupNotFoundException, AccessControlException, IOException
    {
        URL groupsURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01, AuthMethod.CERT);
        URL getGroupURL = new URL(groupsURL.toExternalForm() + "/" + groupName);
        log.debug("getGroup request to " + getGroupURL.toString());

@@ -311,7 +311,7 @@ public class GMSClient implements TransferListener
        throws AccessControlException, IOException
    {
        URL getGroupNamesURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01, AuthMethod.CERT);

        log.debug("getGroupNames request to " + getGroupNamesURL.toString());

@@ -389,7 +389,7 @@ public class GMSClient implements TransferListener
               AccessControlException, WriterException, IOException
    {
        URL groupsURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01, AuthMethod.CERT);
        URL updateGroupURL = new URL(groupsURL.toExternalForm() + "/" + group.getID());
        log.debug("updateGroup request to " + updateGroupURL.toString());

@@ -458,7 +458,7 @@ public class GMSClient implements TransferListener
        throws GroupNotFoundException, AccessControlException, IOException
    {
        URL groupsURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01, AuthMethod.CERT);
        URL deleteGroupURL = new URL(groupsURL.toExternalForm() + "/" + groupName);
        log.debug("deleteGroup request to " + deleteGroupURL.toString());

@@ -527,7 +527,7 @@ public class GMSClient implements TransferListener

        String path = targetGroupName + "/groupMembers/" + groupMemberName;
        URL groupsURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01, AuthMethod.CERT);
        URL addGroupMemberURL = new URL(groupsURL.toExternalForm() + "/" +  path);
        log.debug("addGroupMember request to " + addGroupMemberURL.toString());

@@ -588,7 +588,7 @@ public class GMSClient implements TransferListener
        String userIDType = AuthenticationUtil.getPrincipalType(userID);
        String path = targetGroupName + "/userMembers/" + NetUtil.encode(userID.getName()) + "?idType=" + userIDType;
        URL groupsURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01, AuthMethod.CERT);
        URL addUserMemberURL = new URL(groupsURL.toExternalForm() + "/" + path);

        log.debug("addUserMember request to " + addUserMemberURL.toString());
@@ -645,7 +645,7 @@ public class GMSClient implements TransferListener

        String path = targetGroupName + "/groupMembers/" + groupMemberName;
        URL groupsURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01, AuthMethod.CERT);
        URL removeGroupMemberURL = new URL(groupsURL.toExternalForm() + "/" + path);
        log.debug("removeGroupMember request to " +
                  removeGroupMemberURL.toString());
@@ -714,7 +714,7 @@ public class GMSClient implements TransferListener
        log.debug("removeUserMember: " + targetGroupName + " - " + userID.getName() + " type: " + userIDType);
        String path = targetGroupName + "/userMembers/" + NetUtil.encode(userID.getName()) + "?idType=" + userIDType;
        URL groupsURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.GMS_GROUPS_01, AuthMethod.CERT);
        URL removeUserMemberURL = new URL(groupsURL.toExternalForm() + "/" + path);

        log.debug("removeUserMember: " + removeUserMemberURL.toString());
@@ -826,7 +826,7 @@ public class GMSClient implements TransferListener
        searchGroupPath.append("&ROLE=").append(NetUtil.encode(roleString));

        URL searchURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.GMS_SEARCH_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.GMS_SEARCH_01, AuthMethod.CERT);
        URL getMembershipsURL = new URL(searchURL.toExternalForm() + "/" + searchGroupPath.toString());

        log.debug("getMemberships request to " + getMembershipsURL.toString());
@@ -937,7 +937,7 @@ public class GMSClient implements TransferListener
        searchGroupPath.append("&GROUPID=").append(NetUtil.encode(groupName));

        URL searchURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.GMS_SEARCH_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.GMS_SEARCH_01, AuthMethod.CERT);
        URL getMembershipURL = new URL(searchURL.toExternalForm() + "/" + searchGroupPath.toString());

        log.debug("getMembership request to " + getMembershipURL.toString());
+7 −7
Original line number Diff line number Diff line
@@ -149,11 +149,11 @@ public class UserClient

	        // augment subject calls are always https with client certs
            URL usersURL = getRegistryClient()
                .getServiceURL(this.serviceID, Standards.UMS_USERS_01_URI, AuthMethod.CERT);
                .getServiceURL(this.serviceID, Standards.UMS_USERS_01, AuthMethod.CERT);
            URL getUserURL = new URL(usersURL.toExternalForm() + path);

	        if (getUserURL == null)
	            throw new IllegalArgumentException("No service endpoint for uri " + Standards.UMS_USERS_01_URI);
	            throw new IllegalArgumentException("No service endpoint for uri " + Standards.UMS_USERS_01);

	    	log.debug("augmentSubject request to " + getUserURL.toString());
	        ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -189,7 +189,7 @@ public class UserClient
    public List<User> getDisplayUsers() throws IOException
    {
        URL usersURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.UMS_USERS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.UMS_USERS_01, AuthMethod.CERT);
        final List<User> webUsers = new ArrayList<User>();
        HttpDownload httpDownload =
                new HttpDownload(usersURL,
@@ -254,10 +254,10 @@ public class UserClient
        userWriter.write(user, userXML);

        URL createUserURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.UMS_REQS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.UMS_REQS_01, AuthMethod.CERT);

        if (createUserURL == null)
            throw new IllegalArgumentException("No service endpoint for uri " + Standards.UMS_REQS_01_URI);
            throw new IllegalArgumentException("No service endpoint for uri " + Standards.UMS_REQS_01);
        log.debug("createUser request to " + createUserURL.toString());

        ByteArrayInputStream in = new ByteArrayInputStream(userXML.toString().getBytes());
@@ -318,10 +318,10 @@ public class UserClient
        String path = "/" + id + "?idType=" + AuthenticationUtil.getPrincipalType(principal);

        URL usersURL = getRegistryClient()
            .getServiceURL(this.serviceID, Standards.UMS_USERS_01_URI, AuthMethod.CERT);
            .getServiceURL(this.serviceID, Standards.UMS_USERS_01, AuthMethod.CERT);
        URL getUserURL = new URL(usersURL.toExternalForm() + path);
        if (getUserURL == null)
            throw new IllegalArgumentException("No service endpoint for uri " + Standards.UMS_USERS_01_URI);
            throw new IllegalArgumentException("No service endpoint for uri " + Standards.UMS_USERS_01);
        log.debug("getUser request to " + getUserURL.toString());

        ByteArrayOutputStream out = new ByteArrayOutputStream();
+2 −2
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ public class GMSClientTest

        final URI serviceID = URI.create("ivo://mysite.com/users");

        expect(mockRegistryClient.getServiceURL(serviceID, Standards.UMS_USERS_01_URI, AuthMethod.CERT))
        expect(mockRegistryClient.getServiceURL(serviceID, Standards.UMS_USERS_01, AuthMethod.CERT))
            .andReturn(new URL("http://mysite.com/users"));

        replay(mockRegistryClient);
@@ -154,7 +154,7 @@ public class GMSClientTest
        final RegistryClient mockRegistryClient =
                createMock(RegistryClient.class);

        expect(mockRegistryClient.getServiceURL(serviceID, Standards.GMS_GROUPS_01_URI, AuthMethod.CERT ))
        expect(mockRegistryClient.getServiceURL(serviceID, Standards.GMS_GROUPS_01, AuthMethod.CERT ))
            .andReturn(new URL("http://mysite.com/users"));

        replay(mockRegistryClient);