Skip to content
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
******************* CANADIAN ASTRONOMY DATA CENTRE *******************
************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
*
* (c) 2025. (c) 2025.
* (c) 2026. (c) 2026.
* Government of Canada Gouvernement du Canada
* National Research Council Conseil national de recherches
* Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -119,8 +119,7 @@ public class ConfigUsers {
private static final String ANON_CERT_FILE = "ac-anon-user.pem";
private static final String PRIV_CERT_FILE = "ac-priv-user.pem";

public static final String AC_SERVICE_ID = "ivo://opencadc.org/gms"; // TODO make configurable
//public static final String AC_SERVICE_ID = "ivo://cadc.nrc.ca/gms"; // TODO make configurable
public static final String AC_SERVICE_ID = "ivo://opencadc.org/ac"; // TODO make configurable

PasswordAuthentication passwordAuthUser;
private static ConfigUsers instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
******************* CANADIAN ASTRONOMY DATA CENTRE *******************
************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
*
* (c) 2025. (c) 2025.
* (c) 2026. (c) 2026.
* Government of Canada Gouvernement du Canada
* National Research Council Conseil national de recherches
* Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -65,9 +65,8 @@
************************************************************************
*/

package org.opencadc.ac;
package ca.nrc.cadc.ac.integration;

import ca.nrc.cadc.ac.integration.ConfigUsers;
import ca.nrc.cadc.auth.PosixPrincipal;
import ca.nrc.cadc.reg.client.RegistryClient;
import ca.nrc.cadc.util.Log4jInit;
Expand All @@ -86,8 +85,8 @@
*
* @author pdowler
*/
public class UserGroupMapTest {
private static final Logger log = Logger.getLogger(UserGroupMapTest.class);
public class UserMapTest {
private static final Logger log = Logger.getLogger(UserMapTest.class);

static {
Log4jInit.setLevel("org.opencadc.ac", Level.INFO);
Expand All @@ -98,35 +97,18 @@ public void testUserMap() throws Exception {
RegistryClient reg = new RegistryClient();
URI srv = URI.create(ConfigUsers.AC_SERVICE_ID);
final PosixMapperClient pmc = new PosixMapperClient(srv);

Iterator<PosixPrincipal> iter = Subject.doAs(ConfigUsers.getInstance().getOwnerSubject(),
(PrivilegedExceptionAction<Iterator<PosixPrincipal>>) () -> pmc.getUserMap());

Assert.assertNotNull(iter);
Assert.assertTrue(iter.hasNext());
log.info("obtained uidmap:");
while (iter.hasNext()) {
PosixPrincipal pp = iter.next();
log.info(pp.username + " aka " + pp.getUidNumber() + ":" + pp.defaultGroup);
}

}

@Test
public void testGroupMap() throws Exception {
RegistryClient reg = new RegistryClient();
URI srv = URI.create("ivo://cadc.nrc.ca/gms");
PosixMapperClient pmc = new PosixMapperClient(srv);

Iterator<PosixGroup> iter = Subject.doAs(ConfigUsers.getInstance().getOwnerSubject(),
(PrivilegedExceptionAction<Iterator<PosixGroup>>) () -> pmc.getGroupMap());

Assert.assertNotNull(iter);
Assert.assertTrue(iter.hasNext());
log.info("obtained uidmap:");
while (iter.hasNext()) {
PosixGroup pg = iter.next();
log.info(pg.getGroupURI() + " aka " + pg.getGID());
}
}

}
4 changes: 2 additions & 2 deletions ac/src/main/java/ca/nrc/cadc/ac/server/GetUserMapAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
******************* CANADIAN ASTRONOMY DATA CENTRE *******************
************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
*
* (c) 2023. (c) 2023.
* (c) 2026. (c) 2026.
* Government of Canada Gouvernement du Canada
* National Research Council Conseil national de recherches
* Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -77,13 +77,13 @@
import java.util.Collection;
import java.util.List;
import org.apache.log4j.Logger;
import static org.opencadc.ac.GetGroupMapAction.CONTENT_TYPE_TSV;

/**
*
* @author pdowler
*/
public class GetUserMapAction extends RestAction {
private static final String CONTENT_TYPE_TSV = "text/tab-separated-values";
private static final Logger log = Logger.getLogger(GetUserMapAction.class);

public GetUserMapAction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
************************************************************************
**** C A N A D I A N A S T R O N O M Y D A T A C E N T R E *****
*
* (c) 2025. (c) 2025.
* (c) 2026. (c) 2026.
* National Research Council Conseil national de recherches
* Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
* All rights reserved Tous droits reserves
Expand Down Expand Up @@ -152,8 +152,5 @@ public Object run() throws Exception {
}
throw new CheckException(sb.toString());
}



}
}
6 changes: 1 addition & 5 deletions ac/src/main/resources/PluginFactory.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@
## change the configuration here

## UserPersistence implementation
ca.nrc.cadc.ac.server.UserPersistence = ca.nrc.cadc.ac.server.impl.UserPersistenceImpl

## GroupPersistence implementation
ca.nrc.cadc.ac.server.GroupPersistence = ca.nrc.cadc.ac.server.impl.GroupPersistenceImpl

ca.nrc.cadc.ac.server.UserPersistence = ca.nrc.cadc.ac.server.impl.UserPersistenceImpl
88 changes: 1 addition & 87 deletions ac/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
******************* CANADIAN ASTRONOMY DATA CENTRE *******************
************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
*
* (c) 2019. (c) 2019.
* (c) 2026. (c) 2026.
* Government of Canada Gouvernement du Canada
* National Research Council Conseil national de recherches
* Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -76,17 +76,6 @@
<welcome-file>index.html</welcome-file>
</welcome-file-list>

<servlet>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the group-related endpoints have to stay here while we transition so we can find poorly behaved clients without breaking them??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll wait until ready to deploy both.

<servlet-name>GroupMapServlet</servlet-name>
<servlet-class>ca.nrc.cadc.rest.RestServlet</servlet-class>
<init-param>
<param-name>get</param-name>
<param-value>org.opencadc.ac.GetGroupMapAction</param-value>
</init-param>

<load-on-startup>3</load-on-startup>
</servlet>

<servlet>
<servlet-name>UserMapServlet</servlet-name>
<servlet-class>ca.nrc.cadc.rest.RestServlet</servlet-class>
Expand All @@ -101,32 +90,6 @@
<!--
The Servlets to handle Requests.
-->
<servlet>
<servlet-name>GroupServlet</servlet-name>
<servlet-class>ca.nrc.cadc.rest.RestServlet</servlet-class>
<init-param>
<param-name>init</param-name>
<param-value>org.opencadc.ac.InitGroupAction</param-value>
</init-param>
<init-param>
<param-name>get</param-name>
<param-value>org.opencadc.ac.GetAction</param-value>
</init-param>
<init-param>
<param-name>delete</param-name>
<param-value>org.opencadc.ac.DeleteAction</param-value>
</init-param>
<init-param>
<param-name>post</param-name>
<param-value>org.opencadc.ac.ModifyAction</param-value>
</init-param>
<init-param>
<param-name>put</param-name>
<param-value>org.opencadc.ac.CreateAction</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>

<servlet>
<servlet-name>ResetPasswordServlet</servlet-name>
<servlet-class>ca.nrc.cadc.ac.server.web.ResetPasswordServlet</servlet-class>
Expand Down Expand Up @@ -215,29 +178,6 @@
<load-on-startup>3</load-on-startup>
</servlet>

<!-- sync ac search servlet-->
<servlet>
<servlet-name>ACSearchServlet</servlet-name>
<servlet-class>ca.nrc.cadc.uws.server.JobServlet</servlet-class>
<init-param>
<param-name>get</param-name>
<param-value>ca.nrc.cadc.uws.web.SyncGetAction</param-value>
</init-param>
<init-param>
<param-name>post</param-name>
<param-value>ca.nrc.cadc.uws.web.SyncPostAction</param-value>
</init-param>
<init-param>
<param-name>ca.nrc.cadc.uws.web.SyncPostAction.execOnPOST</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>ca.nrc.cadc.uws.server.JobManager</param-name>
<param-value>ca.nrc.cadc.ac.server.web.ACSearchJobManager</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>

<!-- OIDC Endpoints -->

<servlet>
Expand Down Expand Up @@ -410,7 +350,6 @@
<param-name>logLevelPackages</param-name>
<param-value>
ca.nrc.cadc.ac
org.opencadc.ac
ca.nrc.cadc.auth
ca.nrc.cadc.rest
ca.nrc.cadc.uws
Expand All @@ -424,26 +363,11 @@
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>GroupMapServlet</servlet-name>
<url-pattern>/gidmap/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>UserMapServlet</servlet-name>
<url-pattern>/uidmap/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>GroupServlet</servlet-name>
<url-pattern>/groups/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>GroupServlet</servlet-name>
<url-pattern>/auth/groups/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>UserServlet</servlet-name>
<url-pattern>/users/*</url-pattern>
Expand Down Expand Up @@ -479,16 +403,6 @@
<url-pattern>/auth/resetPassword</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACSearchServlet</servlet-name>
<url-pattern>/search/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>ACSearchServlet</servlet-name>
<url-pattern>/auth/search/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>WhoAmIServlet</servlet-name>
<url-pattern>/whoami</url-pattern>
Expand Down
44 changes: 1 addition & 43 deletions ac/src/main/webapp/capabilities.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,40 +67,7 @@
<securityMethod standardID="vos://cadc.nrc.ca~vospace/CADC/std/Auth#token-1.0"/>
</interface>
</capability>

<capability standardID="ivo://ivoa.net/std/GMS#groups-0.1">
<interface xsi:type="vs:ParamHTTP" role="std" version="0.1">
<accessURL use="base">https://replace.me.com/ac/groups</accessURL>
<securityMethod standardID="ivo://ivoa.net/sso#cookie"/>
<securityMethod standardID="ivo://ivoa.net/sso#tls-with-certificate"/>
<securityMethod standardID="ivo://ivoa.net/sso#token"/>
<!-- deprecated -->
<securityMethod standardID="vos://cadc.nrc.ca~vospace/CADC/std/Auth#token-1.0"/>
</interface>
</capability>

<!-- for old CADC clients using the GMS API -->
<capability standardID="ivo://ivoa.net/std/GMS#search-0.1">
<interface xsi:type="vs:ParamHTTP" role="std" version="0.1">
<accessURL use="base">https://replace.me.com/ac/search</accessURL>
<securityMethod standardID="ivo://ivoa.net/sso#cookie"/>
<securityMethod standardID="ivo://ivoa.net/sso#tls-with-certificate"/>
<securityMethod standardID="ivo://ivoa.net/sso#token"/>
<!-- deprecated -->
<securityMethod standardID="vos://cadc.nrc.ca~vospace/CADC/std/Auth#token-1.0"/>
</interface>
</capability>

<!-- The capability matching the GMS 1.0 specification -->
<capability standardID="ivo://ivoa.net/std/GMS#search-1.0">
<interface xsi:type="vs:ParamHTTP" role="std" version="1.0">
<accessURL use="base">https://replace.me.com/ac/search</accessURL>
<securityMethod standardID="ivo://ivoa.net/sso#cookie"/>
<securityMethod standardID="ivo://ivoa.net/sso#tls-with-certificate"/>
<securityMethod standardID="ivo://ivoa.net/sso#token"/>
</interface>
</capability>


<capability standardID="ivo://ivoa.net/sso#OAuth">
<interface xsi:type="vs:ParamHTTP" role="std" version="0.1">
<accessURL use="base">https://replace.me.com/ac/authorize</accessURL>
Expand Down Expand Up @@ -135,15 +102,6 @@
</capability>

<!-- prototypes -->
<capability standardID="http://www.opencadc.org/std/posix#group-mapping-0.1">
<interface xsi:type="vs:ParamHTTP" role="std" version="0.1">
<accessURL use="base">https://replace.me.com/ac/gidmap</accessURL>
<securityMethod standardID="ivo://ivoa.net/sso#cookie"/>
<securityMethod standardID="ivo://ivoa.net/sso#tls-with-certificate"/>
<securityMethod standardID="ivo://ivoa.net/sso#token"/>
</interface>
</capability>

<capability standardID="http://www.opencadc.org/std/posix#user-mapping-0.1">
<interface xsi:type="vs:ParamHTTP" role="std" version="0.1">
<accessURL use="base">https://replace.me.com/ac/uidmap</accessURL>
Expand Down
Loading
Loading