Skip to content

Commit

Permalink
#216 and #217
Browse files Browse the repository at this point in the history
  • Loading branch information
jjg-123 committed Nov 4, 2024
1 parent ecfabbc commit 5d093ea
Show file tree
Hide file tree
Showing 46 changed files with 648 additions and 368 deletions.
66 changes: 54 additions & 12 deletions .idea/workspace.xml

Large diffs are not rendered by default.

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
#Tue Oct 29 15:35:08 CDT 2024
buildNumber\\d*=551
#Sun Nov 03 05:43:39 CST 2024
buildNumber\\d*=553
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
#Tue Oct 29 15:35:04 CDT 2024
buildNumber\\d*=12442
#Sun Nov 03 05:43:36 CST 2024
buildNumber\\d*=12444
20 changes: 10 additions & 10 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.VirtualOrganization;
import org.oa4mp.server.loader.oauth2.storage.vo.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 @@ -573,7 +573,7 @@ private void processServiceClientRequest(HttpServletRequest request,
}
issuerTransactionState = doAT(issuerTransactionState, client);
// Now, get the right signing key
VirtualOrganization vo = getOA2SE().getVO(client.getIdentifier());
VirtualIssuer vo = getOA2SE().getVI(client.getIdentifier());
JSONWebKey key = null;
if (vo != null && vo.getJsonWebKeys() != null) {
key = vo.getJsonWebKeys().get(vo.getDefaultKeyID());
Expand Down Expand Up @@ -697,13 +697,13 @@ Most of the machinery here is figuring out what type of token (JWT, default), lo
if (isAdminClient) {
if (token.isJWT()) {
JSONWebKeys jsonWebKeys;
if (adminClient.getVirtualOrganization() == null) {
if (adminClient.getVirtualIssuer() == null) {
jsonWebKeys = oa2SE.getJsonWebKeys();
} else {
VirtualOrganization vo = (VirtualOrganization) oa2SE.getVOStore().get(adminClient.getVirtualOrganization());
VirtualIssuer vo = (VirtualIssuer) oa2SE.getVOStore().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 organization \"" + adminClient.getVirtualOrganization() + "\"not found.");
throw new NFWException("Virtual issuer \"" + adminClient.getVirtualIssuer() + "\"not found.");
}
jsonWebKeys = vo.getJsonWebKeys();
}
Expand All @@ -712,7 +712,7 @@ Most of the machinery here is figuring out what type of token (JWT, default), lo
} else {
if (at.isJWT()) {
JSONWebKeys jsonWebKeys;
VirtualOrganization vo = getOA2SE().getVO(clientID);
VirtualIssuer vo = getOA2SE().getVI(clientID);
if (vo == null) {
jsonWebKeys = oa2SE.getJsonWebKeys();
} else {
Expand Down Expand Up @@ -2038,7 +2038,7 @@ private void setupTokenResponseFromRunner(OA2Client client,
if (debugger == null) {
debugger = MyProxyDelegationServlet.createDebugger(client);
}
VirtualOrganization vo = oa2SE.getVO(client.getIdentifier());
VirtualIssuer vo = oa2SE.getVI(client.getIdentifier());
JSONWebKey key = null;
if (vo != null && vo.getJsonWebKeys() != null) {
key = vo.getJsonWebKeys().get(vo.getDefaultKeyID());
Expand Down Expand Up @@ -2334,7 +2334,7 @@ protected TransactionState doNEWRefresh(OA2Client client, HttpServletRequest req
}

rtiResponse.setServiceTransaction(t);
VirtualOrganization vo = oa2SE.getVO(client.getIdentifier());
VirtualIssuer vo = oa2SE.getVI(client.getIdentifier());

if (vo == null) {
rtiResponse.setJsonWebKey(oa2SE.getJsonWebKeys().getDefault());
Expand Down Expand Up @@ -2515,7 +2515,7 @@ public ServiceTransaction verifyAndGet(IssuerResponse iResponse) throws IOExcept
// atResponse.setClaimSources(setupClaimSources(transaction, oa2SE));

atResponse.setServiceTransaction(transaction);
VirtualOrganization vo = oa2SE.getVO(transaction.getClient().getIdentifier());
VirtualIssuer vo = oa2SE.getVI(transaction.getClient().getIdentifier());
if (vo == null) {
atResponse.setJsonWebKey(oa2SE.getJsonWebKeys().getDefault());
} else {
Expand Down Expand Up @@ -2733,7 +2733,7 @@ protected void doRFC8628(OA2Client client, HttpServletRequest request, HttpServl
}
debugger.trace(this, "returns from doAT");
OA2SE oa2se = (OA2SE) MyProxyDelegationServlet.getServiceEnvironment();
VirtualOrganization vo = oa2se.getVO(transaction.getClient().getIdentifier());
VirtualIssuer vo = oa2se.getVI(transaction.getClient().getIdentifier());
if (vo == null) {
debugger.trace(this, "no vo");
((ATIResponse2) issuerTransactionState.getIssuerResponse()).setJsonWebKey((oa2se).getJsonWebKeys().getDefault());
Expand Down
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
#Tue Oct 29 15:35:08 CDT 2024
buildNumber\\d*=13487
#Sun Nov 03 05:43:39 CST 2024
buildNumber\\d*=13489
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ public V fromMap(QDLStem stem, V v) {
v.setMaxClients(stem.getLong(kk().maxClients()).intValue());
}
if (isStringKeyOK(stem, kk().vo())) {
v.setVirtualOrganization(BasicIdentifier.newID(stem.getString(kk().voURI())));
v.setVirtualIssuer(BasicIdentifier.newID(stem.getString(kk().voURI())));
}
if (isStringKeyOK(stem, kk().voURI())) {
v.setExternalVOName(stem.getString(kk().voURI()));
v.setExternalVIName(stem.getString(kk().voURI()));
}

return v;
Expand Down Expand Up @@ -126,8 +126,8 @@ public QDLStem toMap(V v, QDLStem stem) {
stem.put(kk().maxClients(), Long.valueOf(v.getMaxClients()));
setNonNullStemValue(stem, kk().allowQDLCodeBlocks(), v.allowQDLCodeBlocks());

setNonNullStemValue(stem, kk().voURI(), v.getVirtualOrganization().toString());
setNonNullStemValue(stem, kk().vo(), v.getExternalVOName());
setNonNullStemValue(stem, kk().voURI(), v.getVirtualIssuer().toString());
setNonNullStemValue(stem, kk().vo(), v.getExternalVIName());
return stem;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ public void extraUpdates(Identifiable identifiable, int magicNumber) throws IOEx
client.setIssuer(issuer);
}
String voURI;
if (client.getVirtualOrganization() == null) {
if (client.getVirtualIssuer() == null) {
voURI = getPropertyHelp(keys.voURI(), "Give the VO URI", null);
} else {
voURI = getPropertyHelp(keys.voURI(), "Give the VO URI", client.getVirtualOrganization().toString());
voURI = getPropertyHelp(keys.voURI(), "Give the VO URI", client.getVirtualIssuer().toString());
}
if (!isEmpty(voURI)) {
try {
URI z = URI.create(voURI);
client.setVirtualOrganization(BasicIdentifier.newID(z));
client.setVirtualIssuer(BasicIdentifier.newID(z));
} catch (Throwable t) {
if (DebugUtil.isEnabled()) {
t.printStackTrace();
Expand All @@ -89,16 +89,16 @@ public void extraUpdates(Identifiable identifiable, int magicNumber) throws IOEx
}


String vo;
if (client.getExternalVOName() == null) {
String vvv = client.getVirtualOrganization().toString();
vo = getPropertyHelp(keys.vo(), "Give the VO", vvv); // offer the other VO (real one) as default
String vi;
if (client.getExternalVIName() == null) {
String vvv = client.getVirtualIssuer().toString();
vi = getPropertyHelp(keys.vo(), "Give the VI", vvv); // offer the other VO (real one) as default
} else {
vo = getPropertyHelp(keys.vo(), "Give the VO", client.getExternalVOName().toString());
vi = getPropertyHelp(keys.vo(), "Give the VI", client.getExternalVIName().toString());
}

if (!isEmpty(vo)) {
client.setExternalVOName(vo);
if (!isEmpty(vi)) {
client.setExternalVIName(vi);
}
client.setAllowQDL(getPropertyHelp(keys.allowQDL(), "allow QDL?", "n").equalsIgnoreCase("y"));
if (client.isAllowQDL()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public class OA2Commands extends BaseCommands {
public static final String ADMINS = "admins";
public static final String TOKENS = "tokens";
public static final String KEYS = "keys";
public static final String VIRTUAL_ORGANIZATION = "vo";
// public static final String JSON = "json";
public static final String VIRTUAL_ISSUER = "vi";


@Override
Expand All @@ -46,7 +45,7 @@ protected void init() {
components.add(ADMINS);
components.add(TOKENS);
components.add(KEYS);
components.add(VIRTUAL_ORGANIZATION);
components.add(VIRTUAL_ISSUER);
}

public OA2Commands(MyLoggingFacade logger) {
Expand Down Expand Up @@ -122,7 +121,7 @@ public void useHelp() {
say(PERMISSIONS + " - basic permission management.");
say(ADMINS + " - create or manage administrative clients.");
say(TOKENS + " - manage tokens created in the token exchange endpoint");
say(VIRTUAL_ORGANIZATION + " - manage virtual organizations");
say(VIRTUAL_ISSUER + " - manage virtual issuers");
say("e.g.\n\nuse " + CLIENTS + "\n\nwill call up the client management component.");
say("Type 'exit' or /q when you wish to exit the component and return to the main menu");
say(" --> and /h prints your command history, /r runs the last command");
Expand Down Expand Up @@ -197,14 +196,14 @@ protected CommonCommands getTokenCommands() throws Throwable {
return tokenStoreCommands;
}

VOCommands voCommands;
VICommands VICommands;

protected VOCommands getVOCommands() throws Throwable {
if (voCommands == null) {
voCommands = new VOCommands(getMyLogger(), " ", getOA2SE().getVOStore());
voCommands.setEnvironment(getOA2SE());
protected VICommands getVOCommands() throws Throwable {
if (VICommands == null) {
VICommands = new VICommands(getMyLogger(), " ", getOA2SE().getVOStore());
VICommands.setEnvironment(getOA2SE());
}
return voCommands;
return VICommands;
}

TransactionStoreCommands transactionStoreCommands = null;
Expand Down Expand Up @@ -262,7 +261,7 @@ public boolean use(InputLine inputLine) throws Throwable {
if (inputLine.hasArg(TOKENS)) {
commands = getTokenCommands();
}
if (inputLine.hasArg(VIRTUAL_ORGANIZATION)) {
if (inputLine.hasArg(VIRTUAL_ISSUER)) {
commands = getVOCommands();
}
if (commands != null) {
Expand Down
Loading

0 comments on commit 5d093ea

Please sign in to comment.