Skip to content

Commit

Permalink
Fix for #218. Changed package and some class names related to virtual…
Browse files Browse the repository at this point in the history
… issuers.
  • Loading branch information
jjg-123 committed Nov 6, 2024
1 parent 525ce29 commit f125be9
Show file tree
Hide file tree
Showing 46 changed files with 207 additions and 156 deletions.
4 changes: 2 additions & 2 deletions client-installer/buildNumber.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Sun Nov 03 05:43:39 CST 2024
buildNumber\\d*=553
#Wed Nov 06 05:11:21 CST 2024
buildNumber\\d*=559
4 changes: 2 additions & 2 deletions oa4mp-server-oauth2/buildNumber.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Sun Nov 03 05:43:36 CST 2024
buildNumber\\d*=12444
#Wed Nov 06 05:11:18 CST 2024
buildNumber\\d*=12448
10 changes: 10 additions & 0 deletions oa4mp-server-oauth2/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@
<url-pattern>/register</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>sas</servlet-name>
<servlet-class>org.oa4mp.server.proxy.sas.CLISASServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>sas</servlet-name>
<url-pattern>/sas/*</url-pattern>
</servlet-mapping>

<!-- <servlet>
<servlet-name>client</servlet-name>
<servlet-class>org.oa4mp.server.loader.oauth2.servlet.ClientServlet</servlet-class>
Expand Down
8 changes: 4 additions & 4 deletions proxy/src/main/java/org/oa4mp/server/proxy/OA2ATServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.oa4mp.server.loader.oauth2.storage.transactions.OA2ServiceTransaction;
import org.oa4mp.server.loader.oauth2.storage.transactions.OA2TStoreInterface;
import org.oa4mp.server.loader.oauth2.storage.tx.TXRecord;
import org.oa4mp.server.loader.oauth2.storage.vo.VirtualIssuer;
import org.oa4mp.server.loader.oauth2.storage.vi.VirtualIssuer;
import org.oa4mp.server.loader.oauth2.tokens.UITokenUtils;
import org.oa4mp.server.api.admin.adminClient.AdminClient;
import org.oa4mp.server.api.admin.permissions.Permission;
Expand Down Expand Up @@ -700,7 +700,7 @@ Most of the machinery here is figuring out what type of token (JWT, default), lo
if (adminClient.getVirtualIssuer() == null) {
jsonWebKeys = oa2SE.getJsonWebKeys();
} else {
VirtualIssuer vo = (VirtualIssuer) oa2SE.getVOStore().get(adminClient.getVirtualIssuer());
VirtualIssuer vo = (VirtualIssuer) oa2SE.getVIStore().get(adminClient.getVirtualIssuer());
if (vo == null) {
// Admin client is in a VO but no such VO is found. This implies an internal error
throw new NFWException("Virtual issuer \"" + adminClient.getVirtualIssuer() + "\"not found.");
Expand Down Expand Up @@ -2735,10 +2735,10 @@ protected void doRFC8628(OA2Client client, HttpServletRequest request, HttpServl
OA2SE oa2se = (OA2SE) MyProxyDelegationServlet.getServiceEnvironment();
VirtualIssuer vo = oa2se.getVI(transaction.getClient().getIdentifier());
if (vo == null) {
debugger.trace(this, "no vo");
debugger.trace(this, "no vi");
((ATIResponse2) issuerTransactionState.getIssuerResponse()).setJsonWebKey((oa2se).getJsonWebKeys().getDefault());
} else {
debugger.trace(this, "has vo");
debugger.trace(this, "has vi");
((ATIResponse2) issuerTransactionState.getIssuerResponse()).setJsonWebKey(vo.getJsonWebKeys().get(vo.getDefaultKeyID()));
}
debugger.trace(this, "writing AT response");
Expand Down
26 changes: 20 additions & 6 deletions proxy/src/main/java/org/oa4mp/server/proxy/sas/CLISASServlet.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package org.oa4mp.server.proxy.sas;

import org.oa4mp.server.loader.oauth2.OA2SE;
import org.oa4mp.server.api.storage.servlet.MyProxyDelegationServlet;
import edu.uiuc.ncsa.sas.*;
import edu.uiuc.ncsa.sas.loader.SASConfigurationLoader;
import org.apache.commons.configuration.tree.ConfigurationNode;
import org.oa4mp.server.admin.myproxy.oauth2.tools.OA2Commands;
import edu.uiuc.ncsa.sas.Executable;
import edu.uiuc.ncsa.sas.SASCLIDriver;
import edu.uiuc.ncsa.sas.SASServlet;
import edu.uiuc.ncsa.sas.StringIO;
import org.oa4mp.server.api.storage.servlet.MyProxyDelegationServlet;
import org.oa4mp.server.loader.oauth2.OA2SE;

import static edu.uiuc.ncsa.security.util.configuration.XMLConfigUtil.findConfiguration;

/**
* <p>Created by Jeff Gaynor<br>
Expand All @@ -15,11 +16,24 @@
public class CLISASServlet extends SASServlet {
@Override
public Executable createExecutable(String executableName) {

OA2SE oa2SE = (OA2SE) MyProxyDelegationServlet.getServiceEnvironment();
OA2Commands oa2Commands = new OA2Commands(oa2SE.getMyLogger());
oa2Commands.setEnvironment(oa2SE); // gives it the same runtime as the server.
StringIO stringIO = new StringIO("");
SASCLIDriver sascliDriver = new SASCLIDriver(stringIO);
sascliDriver.addCommands(oa2Commands);
return sascliDriver;
}

@Override
protected SASEnvironment getSASE() {
if(sase == null){
ConfigurationNode node = findConfiguration("/home/ncsa/dev/csd/config/sas/sat.xml", "oa4mp", "sas");
SASConfigurationLoader configurationLoader = new SASConfigurationLoader(node);
sase = configurationLoader.load();
System.out.println(getClass().getSimpleName() + ":\n" + sase.getClientStore());
}
return sase;
}
}
4 changes: 2 additions & 2 deletions qdl/buildNumber.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Sun Nov 03 05:43:39 CST 2024
buildNumber\\d*=13489
#Wed Nov 06 05:11:21 CST 2024
buildNumber\\d*=13497
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public V fromMap(QDLStem stem, V v) {
String issuer = "issuer";
String maxClients = "max_clients";
String notifyOnNewClientCreate="new_client_notify";
String vo="vo";
String vi="vi";
String voURI="vo_uri";
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
package org.oa4mp.server.admin.myproxy.oauth2.tools;

import org.oa4mp.server.loader.oauth2.OA2SE;
import org.oa4mp.server.loader.oauth2.functor.claims.OA2FunctorFactory;
import org.oa4mp.server.loader.oauth2.loader.OA2ConfigurationLoader;
import org.oa4mp.server.admin.myproxy.oauth2.Banners;
import org.oa4mp.server.admin.myproxy.oauth2.base.BaseCommands;
import org.oa4mp.server.admin.myproxy.oauth2.base.ClientStoreCommands;
import org.oa4mp.server.admin.myproxy.oauth2.base.CopyCommands;
import org.oa4mp.delegation.common.OA4MPVersion;
import edu.uiuc.ncsa.sas.SASCLIDriver;
import edu.uiuc.ncsa.sas.StringIO;
import edu.uiuc.ncsa.sas.thing.response.LogonResponse;
Expand All @@ -20,9 +12,16 @@
import edu.uiuc.ncsa.security.util.configuration.XMLConfigUtil;
import org.apache.commons.configuration.tree.ConfigurationNode;
import org.apache.commons.lang.StringUtils;
import org.oa4mp.delegation.common.OA4MPVersion;
import org.oa4mp.server.admin.myproxy.oauth2.Banners;
import org.oa4mp.server.admin.myproxy.oauth2.base.BaseCommands;
import org.oa4mp.server.admin.myproxy.oauth2.base.ClientStoreCommands;
import org.oa4mp.server.admin.myproxy.oauth2.base.CopyCommands;
import org.oa4mp.server.loader.oauth2.OA2SE;
import org.oa4mp.server.loader.oauth2.functor.claims.OA2FunctorFactory;
import org.oa4mp.server.loader.oauth2.loader.OA2ConfigurationLoader;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.*;

/**
* <p>Created by Jeff Gaynor<br>
Expand Down Expand Up @@ -87,7 +86,10 @@ OA2SE getOA2SE() throws Exception {

public static void main(String[] args) {
try {
InputLine inputLine = new InputLine(args);
ArrayList<String> aaa = new ArrayList<>();
aaa.add(OA2Commands.class.getSimpleName()); // dummy first argument
aaa.addAll(Arrays.asList(args));
InputLine inputLine = new InputLine(aaa);
if (inputLine.hasArg("-sas")) {
setupSAS(inputLine);
return;
Expand Down Expand Up @@ -200,7 +202,7 @@ protected CommonCommands getTokenCommands() throws Throwable {

protected VICommands getVOCommands() throws Throwable {
if (VICommands == null) {
VICommands = new VICommands(getMyLogger(), " ", getOA2SE().getVOStore());
VICommands = new VICommands(getMyLogger(), " ", getOA2SE().getVIStore());
VICommands.setEnvironment(getOA2SE());
}
return VICommands;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.oa4mp.server.admin.myproxy.oauth2.tools;

/**
* This is the command line version of the CLI to talk to a SAS instance.
*/
public class SASOA4MPCLI {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import edu.uiuc.ncsa.security.core.Identifier;
import edu.uiuc.ncsa.security.core.util.BasicIdentifier;
import org.oa4mp.server.api.admin.adminClient.AdminClient;
import org.oa4mp.server.loader.oauth2.storage.vo.VISerializationKeys;
import org.oa4mp.server.loader.oauth2.storage.vo.VIStore;
import org.oa4mp.server.loader.oauth2.storage.vo.VirtualIssuer;
import org.oa4mp.server.loader.oauth2.storage.vi.VISerializationKeys;
import org.oa4mp.server.loader.oauth2.storage.vi.VIStore;
import org.oa4mp.server.loader.oauth2.storage.vi.VirtualIssuer;
import org.oa4mp.server.loader.qdl.util.SigningCommands;
import org.oa4mp.server.admin.myproxy.oauth2.base.StoreCommands2;
import edu.uiuc.ncsa.security.core.Identifiable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.oa4mp.server.loader.oauth2.OA2SE;
import org.oa4mp.server.loader.oauth2.storage.transactions.OA2TStoreInterface;
import org.oa4mp.server.loader.oauth2.storage.tx.TXStore;
import org.oa4mp.server.loader.oauth2.storage.vo.VIStore;
import org.oa4mp.server.loader.oauth2.storage.vi.VIStore;
import org.oa4mp.server.api.admin.adminClient.AdminClientStore;
import org.oa4mp.server.api.admin.permissions.Permission;
import org.oa4mp.server.api.admin.permissions.PermissionsStore;
Expand Down Expand Up @@ -364,7 +364,7 @@ public void migrate(OA2SE targetSE,
store = targetSE.getAdminClientStore();
}
if (name.equalsIgnoreCase(VIRTUAL_ORGANIZATION_STORE)) {
store = targetSE.getVOStore();
store = targetSE.getVIStore();
}
if (name.equalsIgnoreCase(TOKEN_EXCHANGE_RECORD_STORE)) {
store = targetSE.getTxStore();
Expand Down
2 changes: 1 addition & 1 deletion server-admin/src/main/resources/help/admin_help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ oa2>use admins
admin_id* debug_on last_modified_ts name vo_uri
allow_qdl description list_users new_client_notify
config email list_users_other_clients secret
creation_ts issuer max_clients vo
creation_ts issuer max_clients vi
admins>/commands
approve count_clients list_clients
approver_search list_ersatz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public AdminClientKeys() {
String issuer = "issuer";
String maxClients = "max_clients";
String notifyOnNewClientCreate="new_client_notify";
String vo="vo";
String vo="vi";
String voURI="vo_uri";
String listUsers = "list_users";
String listUsersInOtherClients = "list_users_other_clients";
Expand Down
4 changes: 2 additions & 2 deletions server-installer/buildNumber.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Sun Nov 03 05:43:39 CST 2024
buildNumber\\d*=551
#Wed Nov 06 05:11:21 CST 2024
buildNumber\\d*=557
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.oa4mp.server.loader.oauth2.loader.OA2ConfigurationLoader;
import org.oa4mp.server.loader.oauth2.servlet.RFC8628ServletConfig;
import org.oa4mp.server.loader.oauth2.storage.tx.TXStore;
import org.oa4mp.server.loader.oauth2.storage.vo.VIStore;
import org.oa4mp.server.loader.oauth2.storage.vo.VirtualIssuer;
import org.oa4mp.server.loader.oauth2.storage.vi.VIStore;
import org.oa4mp.server.loader.oauth2.storage.vi.VirtualIssuer;
import org.oa4mp.server.loader.qdl.scripting.OA2QDLEnvironment;
import org.oa4mp.server.api.MyProxyFacadeProvider;
import org.oa4mp.server.api.ServiceEnvironmentImpl;
Expand Down Expand Up @@ -337,7 +337,7 @@ public long getMaxRTLifetime() {

VIStore VIStore;

public VIStore getVOStore() {
public VIStore getVIStore() {
return VIStore;
}

Expand Down Expand Up @@ -629,8 +629,8 @@ public VirtualIssuer getVI(Identifier clientID) {
return null; // no VO set. Most common case.
}
DebugUtil.trace(this, "got admin client " + ac.getIdentifierString());
VirtualIssuer vo = (VirtualIssuer) getVOStore().get(ac.getVirtualIssuer());
DebugUtil.trace(this, "got vo " + (vo == null ? "(none)" : vo.getIdentifierString()));
VirtualIssuer vo = (VirtualIssuer) getVIStore().get(ac.getVirtualIssuer());
DebugUtil.trace(this, "got vi " + (vo == null ? "(none)" : vo.getIdentifierString()));
if (!vo.isValid()) {
throw new GeneralException("invalid virtual issuer \"" + vo.getIdentifierString() + "\"");
}
Expand All @@ -649,7 +649,7 @@ public VirtualIssuer getVI(Identifier clientID) {
public List<Store> listStores() {
List<Store> stores = super.listStores();
stores.add(getTxStore());
stores.add(getVOStore());
stores.add(getVIStore());
return stores;
}

Expand Down Expand Up @@ -702,7 +702,7 @@ public List<Store> getAllStores() {
storeList.add(getClientStore());
storeList.add(getClientApprovalStore());
storeList.add(getPermissionStore());
storeList.add(getVOStore());
storeList.add(getVIStore());
storeList.add(getTransactionStore());
storeList.add(getTxStore());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.oa4mp.server.loader.oauth2.servlet.ClientUtils;
import org.oa4mp.server.loader.oauth2.servlet.OA2DiscoveryServlet;
import org.oa4mp.server.loader.oauth2.storage.tx.TXRecord;
import org.oa4mp.server.loader.oauth2.storage.vo.VirtualIssuer;
import org.oa4mp.server.loader.oauth2.storage.vi.VirtualIssuer;
import org.oa4mp.server.loader.oauth2.tokens.AccessTokenConfig;
import org.oa4mp.server.loader.oauth2.tokens.AuthorizationPath;
import org.oa4mp.server.loader.oauth2.tokens.AuthorizationTemplate;
Expand Down Expand Up @@ -460,7 +460,7 @@ public void saveState(String execPhase) throws Throwable {
public void setAccountingInformation() {
JSONObject atData = getPayload();
// Figure out issuer. If in config, that wins. If not, if the client is
// in a vo, use the designated at issuer. If that is not set, use the
// in a vi, use the designated at issuer. If that is not set, use the
// VO issuer. If that fails, get the server issuer from the discovery servlet.
//
String issuer = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.oa4mp.server.loader.oauth2.servlet.OA2HeaderUtils;
import org.oa4mp.server.loader.oauth2.storage.clients.OA2Client;
import org.oa4mp.server.loader.oauth2.storage.transactions.OA2ServiceTransaction;
import org.oa4mp.server.loader.oauth2.storage.vo.VirtualIssuer;
import org.oa4mp.server.loader.oauth2.storage.vi.VirtualIssuer;
import org.oa4mp.server.api.admin.adminClient.AdminClient;
import org.oa4mp.delegation.common.token.impl.IDTokenImpl;
import org.oa4mp.delegation.common.token.impl.TokenFactory;
Expand Down Expand Up @@ -75,7 +75,7 @@ protected void setIssuer(HttpServletRequest request) {
issuer = null;
// So in order
VirtualIssuer vo = oa2se.getVI(transaction.getClient().getIdentifier());
DebugUtil.trace(this, "vo = " + vo);
DebugUtil.trace(this, "vi = " + vo);
if (vo != null) {
issuer = vo.getIssuer();
// if issuer set, return it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.oa4mp.server.loader.oauth2.storage.clients.OA2Client;
import org.oa4mp.server.loader.oauth2.storage.clients.OA2ClientConverter;
import org.oa4mp.server.loader.oauth2.storage.clients.OA2ClientKeys;
import org.oa4mp.server.loader.oauth2.storage.vo.VirtualIssuer;
import org.oa4mp.server.loader.oauth2.storage.vi.VirtualIssuer;
import org.oa4mp.server.api.admin.adminClient.AdminClient;
import org.oa4mp.server.api.admin.permissions.Permission;
import org.oa4mp.server.api.storage.servlet.EnvServlet;
Expand Down Expand Up @@ -332,7 +332,7 @@ private void handleServerQuery(AdminClient adminClient, List<String> queries, Ht
jsonObject.put("issuer", getOA2SE().getIssuer());
jsonObject.put("at_issuer", getOA2SE().getIssuer());
} else {
VirtualIssuer vo = (VirtualIssuer) getOA2SE().getVOStore().get(adminClient.getVirtualIssuer());
VirtualIssuer vo = (VirtualIssuer) getOA2SE().getVIStore().get(adminClient.getVirtualIssuer());
jsonObject.put("issuer", vo.getIssuer());
jsonObject.put("at_issuer", vo.getAtIssuer());
}
Expand Down
Loading

0 comments on commit f125be9

Please sign in to comment.