summaryrefslogtreecommitdiffstats
path: root/auth/auth-cmd
diff options
context:
space:
mode:
authorSai Gandham <sai.gandham@att.com>2019-07-12 22:26:30 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-12 22:26:30 +0000
commitf918e038f8f4eea2fb879edf704683877bc19849 (patch)
tree6eb10de329001f74401e8d2cae1fa33a35079d19 /auth/auth-cmd
parent3c06c9887d6f88524f06b46f2593f6eef640826b (diff)
parent1338680ef142f9a33ee32a00b07c7d2ae658cb3a (diff)
Merge "Adjust Agent for none K8s"
Diffstat (limited to 'auth/auth-cmd')
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java10
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java12
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java2
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java3
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java7
5 files changed, 13 insertions, 21 deletions
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
index 8fcea294..01d001fd 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java
@@ -94,10 +94,6 @@ public class AAFcli {
this(access,new AuthzEnv(access.getProperties()),wtr,hman, si,ss);
}
- public AuthzEnv env() {
- return env;
- }
-
public AAFcli(Access access, AuthzEnv env, Writer wtr, HMangr hman, SecurityInfoC<HttpURLConnection> si, SecuritySetter<HttpURLConnection> ss) throws APIException {
this.env = env;
this.access = access;
@@ -127,7 +123,11 @@ public class AAFcli {
cmds.add(new Mgmt(this));
}
- public static int timeout() {
+ public AuthzEnv env() {
+ return env;
+ }
+
+ public static int timeout() {
return TIMEOUT;
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
index add5aed8..e1252d87 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
@@ -26,6 +26,7 @@ import java.util.Comparator;
import org.onap.aaf.auth.cmd.BaseCmd;
import org.onap.aaf.auth.cmd.DeprecatedCMD;
+import org.onap.aaf.auth.common.Define;
import org.onap.aaf.cadi.client.Future;
import org.onap.aaf.misc.env.util.Chrono;
@@ -162,15 +163,8 @@ public class List extends BaseCmd<NS> {
if ((type=u.getType())==null) {
type = 9999;
}
- switch(type) {
- case 0: return "NoCrd";
- case 1: return "U/P";
- case 2: return "U/P2";
- case 10: return "FQI";
- case 200: return "x509";
- default:
- return "n/a";
- }
+ return Define.getCredType(type);
}
+
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java
index 1dfcc17f..2d626d4e 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java
@@ -122,7 +122,7 @@ public class Cred extends Cmd {
pw().println(']');
} else if (fp.code()==202) {
pw().println("Credential Action Accepted, but requires Approvals before actualizing");
- } else if (fp.code()==300) {
+ } else if (fp.code()==300 || fp.code()==406) {
Error err = em.getError(fp);
String text = err.getText();
List<String> vars = err.getVariables();
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java
index 46d5d052..71d61f79 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ID.java
@@ -35,7 +35,6 @@ import org.onap.aaf.misc.env.APIException;
import aaf.v2_0.CredRequest;
public class ID extends Cmd {
- public static final String ATTEMPT_FAILED_SPECIFICS_WITHELD = "Attempt Failed. Specifics witheld.";
private static final String CRED_PATH = "/authn/cred";
private static final String[] options = {"add","del"};
public ID(User parent) {
@@ -98,7 +97,7 @@ public class ID extends Cmd {
} else if (fp.code()==406 && option==1) {
pw().println("FQI does not exist");
} else {
- pw().println(ATTEMPT_FAILED_SPECIFICS_WITHELD);
+ pw().println(Cred.ATTEMPT_FAILED_SPECIFICS_WITHELD);
}
return fp.code();
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
index 7daa51fb..444a82ab 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
@@ -48,7 +48,6 @@ public class List extends BaseCmd<User> {
void report(Users users, boolean count, String ... str) {
reportHead(str);
- int idx = 0;
java.util.List<aaf.v2_0.Users.User> sorted = users.getUser();
Collections.sort(sorted, (Comparator<aaf.v2_0.Users.User>) (u1, u2) -> {
if (u1==null || u2 == null) {
@@ -56,11 +55,11 @@ public class List extends BaseCmd<User> {
}
return u1.getId().compareTo(u2.getId());
});
- String format = reportColHead("%-48s %-5s %-11s %-16s\n","User","Type","Expires","Tag");
+ String format = reportColHead("%-36s %-5s %-20s %-16s\n","User","Type","Expires","Tag");
String date = "XXXX-XX-XX";
for (aaf.v2_0.Users.User user : sorted) {
if (!aafcli.isTest()) {
- date = Chrono.dateOnlyStamp(user.getExpires());
+ date = Chrono.niceUTCStamp(user.getExpires());
}
String tag=user.getTag();
Integer type = user.getType();
@@ -70,7 +69,7 @@ public class List extends BaseCmd<User> {
tag = "\n\tfingerprint: " + tag;
}
pw().format(format,
- count? (Integer.valueOf(++idx) + ") " + user.getId()): user.getId(),
+ user.getId(),
org.onap.aaf.auth.cmd.ns.List.getType(user),
date,
tag);