summaryrefslogtreecommitdiffstats
path: root/auth/auth-cass/src/main
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-08-07 13:40:39 -0500
committerInstrumental <jonathan.gathman@att.com>2019-08-07 13:40:42 -0500
commit3d1706fcbe7f95830ff6fd23cf679ee55c6d0595 (patch)
treeff97f10380a44d9f81d536c066782af10f728687 /auth/auth-cass/src/main
parent321dce367d74092a0ba09930c3aa526abdbd5da8 (diff)
Remove Tabs, per Jococo
Issue-ID: AAF-932 Change-Id: I3ab0ebcc082048d2d1424a58a90ea479fb005ee6 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-cass/src/main')
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java20
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java44
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java30
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java62
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java62
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java38
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java226
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java18
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java10
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java110
13 files changed, 318 insertions, 318 deletions
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
index 9672199b..eea3c4c2 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
@@ -72,7 +72,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
// Hold current time stamps from Tables
private final Date startTime;
- private final boolean cacheNotify;
+ private final boolean cacheNotify;
private PreparedStatement psCheck;
//////////////////////////////////////////
@@ -87,22 +87,22 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
init(trans);
}
- public CacheInfoDAO(AuthzTrans trans, AbsCassDAO<AuthzTrans,?> aDao) throws APIException, IOException {
+ public CacheInfoDAO(AuthzTrans trans, AbsCassDAO<AuthzTrans,?> aDao) throws APIException, IOException {
super(trans, CacheInfoDAO.class.getSimpleName(),aDao,Data.class,TABLE,readConsistency(trans,TABLE), writeConsistency(trans,TABLE));
startTime = new Date();
init(trans);
cacheNotify = noK8s(trans);
}
- /**
- * Need a different point to point cache clear strategy for K8s...
- * @param trans
- * @return
- */
+ /**
+ * Need a different point to point cache clear strategy for K8s...
+ * @param trans
+ * @return
+ */
private boolean noK8s(AuthzTrans trans) {
- String container = trans.getProperty(Config.AAF_LOCATOR_CONTAINER);
- return ! ("helm".equals(container) || "oom".equals(container));
- }
+ String container = trans.getProperty(Config.AAF_LOCATOR_CONTAINER);
+ return ! ("helm".equals(container) || "oom".equals(container));
+ }
/**
* @author Jonathan
*/
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
index d64cff29..9a2511d2 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
@@ -85,8 +85,8 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
public Date expires;
public Integer other;
public String ns;
- public String tag;
- public String notes;
+ public String tag;
+ public String notes;
public ByteBuffer cred; // this is a blob in cassandra
@@ -139,7 +139,7 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
@Override
protected void key(Data data, int _idx, Object[] obj) {
- int idx = _idx;
+ int idx = _idx;
obj[idx] = data.id;
obj[++idx] = data.type;
@@ -221,23 +221,23 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
" WHERE id = ?", CredLoader.deflt,readConsistency);
}
- /* (non-Javadoc)
- * @see org.onap.aaf.auth.dao.CassDAOImpl#create(org.onap.aaf.misc.env.TransStore, java.lang.Object)
- */
- @Override
- public Result<Data> create(AuthzTrans trans, Data data) {
- if(data.tag == null) {
- if(data.type==0) {
- data.tag="PlaceHolder";
- } else {
- long l = srand.nextLong();
- data.tag = Long.toHexString(l);
- }
- }
- return super.create(trans, data);
- }
+ /* (non-Javadoc)
+ * @see org.onap.aaf.auth.dao.CassDAOImpl#create(org.onap.aaf.misc.env.TransStore, java.lang.Object)
+ */
+ @Override
+ public Result<Data> create(AuthzTrans trans, Data data) {
+ if(data.tag == null) {
+ if(data.type==0) {
+ data.tag="PlaceHolder";
+ } else {
+ long l = srand.nextLong();
+ data.tag = Long.toHexString(l);
+ }
+ }
+ return super.create(trans, data);
+ }
- public Result<List<Data>> readNS(AuthzTrans trans, String ns) {
+ public Result<List<Data>> readNS(AuthzTrans trans, String ns) {
return psNS.read(trans, R_TEXT, new Object[]{ns});
}
@@ -267,12 +267,12 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
: (modified.name() + "d credential for " + data.id);
String spacer = ": ";
if(data.notes!=null) {
- hd.memo+=spacer + data.notes;
- spacer = ", ";
+ hd.memo+=spacer + data.notes;
+ spacer = ", ";
}
if(data.tag!=null) {
- hd.memo+=spacer + data.tag;
+ hd.memo+=spacer + data.tag;
}
// Detail?
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
index 72c0e98b..eafdb884 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
@@ -69,8 +69,8 @@ public class FutureDAO extends CassDAOImpl<AuthzTrans,FutureDAO.Data> {
public String memo;
public Date start;
public Date expires;
- public String target_key;
- public Date target_date;
+ public String target_key;
+ public Date target_date;
public ByteBuffer construct; // this is a blob in cassandra
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
index 73ab343b..82874ce9 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
@@ -173,21 +173,21 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
}
public void createBatch(StringBuilder sb, Data data) {
- sb.append("INSERT INTO history (");
- sb.append(helpers[FIELD_COMMAS]);
- sb.append(") VALUES(now(),");
- sb.append(data.yr_mon);
- sb.append(",'");
- sb.append(data.user);
- sb.append("','");
- sb.append(data.action);
- sb.append("','");
- sb.append(data.target);
- sb.append("','");
- sb.append(data.subject);
- sb.append("','");
- sb.append(data.memo);
- sb.append("',null);\n");
+ sb.append("INSERT INTO history (");
+ sb.append(helpers[FIELD_COMMAS]);
+ sb.append(") VALUES(now(),");
+ sb.append(data.yr_mon);
+ sb.append(",'");
+ sb.append(data.user);
+ sb.append("','");
+ sb.append(data.action);
+ sb.append("','");
+ sb.append(data.target);
+ sb.append("','");
+ sb.append(data.subject);
+ sb.append("','");
+ sb.append(data.memo);
+ sb.append("',null);\n");
}
public Result<List<Data>> readByYYYYMM(AuthzTrans trans, int yyyymm) {
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
index 085f4199..478cceb0 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
@@ -100,8 +100,8 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
LocateLoader.deflt.unmarshal(this, toDIS(bb));
}
- public Data copy() {
- Data out = new Data();
+ public Data copy() {
+ Data out = new Data();
out.name = name;
out.hostname = hostname;
out.port = port;
@@ -115,8 +115,8 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
out.subprotocol = new HashSet<>();
out.subprotocol.addAll(subprotocol);
out.port_key = port_key;
- return out;
- }
+ return out;
+ }
}
private static class LocateLoader extends Loader<Data> implements Streamer<Data>{
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
index 0033f8a1..699d6e28 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
@@ -93,31 +93,31 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
}
public String fullType() {
- StringBuilder sb = new StringBuilder();
- if(ns==null) {
- sb.append('.');
- } else {
- sb.append(ns);
- sb.append(ns.indexOf('@')<0?'.':':');
- }
- sb.append(type);
- return sb.toString();
+ StringBuilder sb = new StringBuilder();
+ if(ns==null) {
+ sb.append('.');
+ } else {
+ sb.append(ns);
+ sb.append(ns.indexOf('@')<0?'.':':');
+ }
+ sb.append(type);
+ return sb.toString();
}
public String fullPerm() {
- StringBuilder sb = new StringBuilder();
- if(ns==null) {
- sb.append("null.");
- } else {
- sb.append(ns);
- sb.append(ns.indexOf('@')<0?'.':':');
- }
- sb.append(type);
- sb.append('|');
- sb.append(instance);
- sb.append('|');
- sb.append(action);
- return sb.toString();
+ StringBuilder sb = new StringBuilder();
+ if(ns==null) {
+ sb.append("null.");
+ } else {
+ sb.append(ns);
+ sb.append(ns.indexOf('@')<0?'.':':');
+ }
+ sb.append(type);
+ sb.append('|');
+ sb.append(instance);
+ sb.append('|');
+ sb.append(action);
+ return sb.toString();
}
public String encode() {
@@ -213,26 +213,26 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
Data rv = new PermDAO.Data();
if (rdns.isOKhasData()) {
switch(s.length) {
- case 4:
- rv.ns=s[0];
- rv.type=s[1];
- rv.instance=s[2];
- rv.action=s[3];
- break;
+ case 4:
+ rv.ns=s[0];
+ rv.type=s[1];
+ rv.instance=s[2];
+ rv.action=s[3];
+ break;
case 3:
- rv.ns=s[0];
+ rv.ns=s[0];
rv.type=s[1];
rv.instance=s[2];
rv.action=s[3];
break;
case 2:
- rv.ns=s[0];
+ rv.ns=s[0];
rv.type=s[1];
rv.instance=s[2];
rv.action=STAR;
break;
default:
- rv.ns=s[0];
+ rv.ns=s[0];
rv.type=s[1];
rv.instance = STAR;
rv.action = STAR;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
index a5fa7a77..e5c97559 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
@@ -106,15 +106,15 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
}
public String fullName() {
- StringBuilder sb = new StringBuilder();
- if(ns==null) {
- sb.append('.');
- } else {
- sb.append(ns);
- sb.append(ns.indexOf('@')<0?'.':':');
- }
- sb.append(name);
- return sb.toString();
+ StringBuilder sb = new StringBuilder();
+ if(ns==null) {
+ sb.append('.');
+ } else {
+ sb.append(ns);
+ sb.append(ns.indexOf('@')<0?'.':':');
+ }
+ sb.append(name);
+ return sb.toString();
}
public String encode() {
@@ -131,28 +131,28 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
*/
public static Result<Data> decode(AuthzTrans trans, Question q, String r) {
Data data = new Data();
- if(r.indexOf('@')>=0) {
- int colon = r.indexOf(':');
- if(colon<0) {
- return Result.err(Result.ERR_BadData, "%s is not a valid Role",r);
- } else {
- data.ns=r.substring(0, colon);
- data.name=r.substring(++colon);
- }
- } else {
- String[] ss = Split.splitTrim('|', r,2);
- if (ss[1]==null) { // older 1 part encoding must be evaluated for NS
- Result<NsSplit> nss = q.deriveNsSplit(trans, ss[0]);
- if (nss.notOK()) {
- return Result.err(nss);
- }
- data.ns=nss.value.ns;
- data.name=nss.value.name;
- } else { // new 4 part encoding
- data.ns=ss[0];
- data.name=ss[1];
- }
- }
+ if(r.indexOf('@')>=0) {
+ int colon = r.indexOf(':');
+ if(colon<0) {
+ return Result.err(Result.ERR_BadData, "%s is not a valid Role",r);
+ } else {
+ data.ns=r.substring(0, colon);
+ data.name=r.substring(++colon);
+ }
+ } else {
+ String[] ss = Split.splitTrim('|', r,2);
+ if (ss[1]==null) { // older 1 part encoding must be evaluated for NS
+ Result<NsSplit> nss = q.deriveNsSplit(trans, ss[0]);
+ if (nss.notOK()) {
+ return Result.err(nss);
+ }
+ data.ns=nss.value.ns;
+ data.name=nss.value.name;
+ } else { // new 4 part encoding
+ data.ns=ss[0];
+ data.name=ss[1];
+ }
+ }
return Result.ok(data);
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
index 4ec70d4a..dd367c51 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
@@ -245,13 +245,13 @@ public class Function {
// 2.1) Does role exist with that name
if(cname!=null && q.roleDAO().read(trans, parent, cname).isOKhasData()) {
- return Result.err(Status.ERR_ConflictAlreadyExists,
+ return Result.err(Status.ERR_ConflictAlreadyExists,
"Role exists with that name");
}
// 2.2) Do perms exist with that name
if(cname!=null && q.permDAO().readByType(trans, parent, cname).isOKhasData()) {
- return Result.err(Status.ERR_ConflictAlreadyExists,
+ return Result.err(Status.ERR_ConflictAlreadyExists,
"Perms exist with that name");
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
index b0680621..3f0e92e7 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
@@ -153,32 +153,32 @@ public class PermLookup {
List<PermDAO.Data> lpdd = new ArrayList<>();
for (String perm : rss.value) {
if (lookup) {
- Map<String,PermDAO.Data> mspdd = new TreeMap<>();
+ Map<String,PermDAO.Data> mspdd = new TreeMap<>();
Result<String[]> ap = PermDAO.Data.decodeToArray(trans, q, perm);
if (ap.isOK()) {
Result<List<PermDAO.Data>> rlpd = q.permDAO().read(perm,trans,ap.value);
if (rlpd.isOKhasData()) {
for (PermDAO.Data pData : rlpd.value) {
- // ONLY add perms/roles which are related to this lookup
- for(String pdr : pData.roles(false)) {
- for(RoleDAO.Data r : roles.value) {
- if(pdr.equals(r.encode())) {
- PermDAO.Data pdd = mspdd.get(pData.fullPerm());
- if(pdd==null) {
- pdd = new PermDAO.Data();
- pdd.ns = pData.ns;
- pdd.type = pData.type;
- pdd.instance = pData.instance;
- pdd.action = pData.action;
- pdd.description = pData.description;
+ // ONLY add perms/roles which are related to this lookup
+ for(String pdr : pData.roles(false)) {
+ for(RoleDAO.Data r : roles.value) {
+ if(pdr.equals(r.encode())) {
+ PermDAO.Data pdd = mspdd.get(pData.fullPerm());
+ if(pdd==null) {
+ pdd = new PermDAO.Data();
+ pdd.ns = pData.ns;
+ pdd.type = pData.type;
+ pdd.instance = pData.instance;
+ pdd.action = pData.action;
+ pdd.description = pData.description;
lpdd.add(pdd);
- }
- pdd.roles(true).add(pdr);
- break;
- }
- }
- }
+ }
+ pdd.roles(true).add(pdr);
+ break;
+ }
+ }
+ }
}
}
} else {
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
index 6b6c23bf..b797ca05 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
@@ -132,62 +132,62 @@ public class Question {
private final HistoryDAO historyDAO;
public HistoryDAO historyDAO() {
- return historyDAO;
+ return historyDAO;
}
private final CachedNSDAO nsDAO;
public CachedNSDAO nsDAO() {
- return nsDAO;
+ return nsDAO;
}
private final CachedRoleDAO roleDAO;
public CachedRoleDAO roleDAO() {
- return roleDAO;
+ return roleDAO;
}
private final CachedPermDAO permDAO;
public CachedPermDAO permDAO() {
- return permDAO;
+ return permDAO;
}
private final CachedUserRoleDAO userRoleDAO;
public CachedUserRoleDAO userRoleDAO() {
- return userRoleDAO;
+ return userRoleDAO;
}
private final CachedCredDAO credDAO;
public CachedCredDAO credDAO() {
- return credDAO;
+ return credDAO;
}
private final CachedCertDAO certDAO;
public CachedCertDAO certDAO() {
- return certDAO;
+ return certDAO;
}
private final DelegateDAO delegateDAO;
public DelegateDAO delegateDAO() {
- return delegateDAO;
+ return delegateDAO;
}
private final FutureDAO futureDAO;
public FutureDAO futureDAO() {
- return futureDAO;
+ return futureDAO;
}
private final ApprovalDAO approvalDAO;
public ApprovalDAO approvalDAO() {
- return approvalDAO;
+ return approvalDAO;
}
public final LocateDAO locateDAO;
public LocateDAO locateDAO() {
- return locateDAO;
+ return locateDAO;
}
private final CacheInfoDAO cacheInfoDAO;
- private final int cldays;
- private final boolean alwaysSpecial;
+ private final int cldays;
+ private final boolean alwaysSpecial;
public Question(AuthzTrans trans, Cluster cluster, String keyspace) throws APIException, IOException {
PERMS = trans.slot("USER_PERMS");
@@ -229,18 +229,18 @@ public class Question {
* Note: This Constructor created for JUNIT Purposes. Do not use otherwise.
*/
public Question(AuthzTrans trans, HistoryDAO historyDAO, CacheInfoDAO cacheInfoDAO,
- CachedNSDAO nsDAO, CachedPermDAO permDAO, CachedRoleDAO roleDAO,
- CachedUserRoleDAO userRoleDAO, CachedCredDAO credDAO, CachedCertDAO certDAO,
- LocateDAO locateDAO,FutureDAO futureDAO, DelegateDAO delegateDAO,
- ApprovalDAO approvalDAO ) {
- this.historyDAO = historyDAO;
- this.cacheInfoDAO = cacheInfoDAO;
- this.nsDAO = nsDAO;
- this.permDAO = permDAO;
- this.roleDAO = roleDAO;
- this.userRoleDAO = userRoleDAO;
- this.credDAO = credDAO;
- this.certDAO = certDAO;
+ CachedNSDAO nsDAO, CachedPermDAO permDAO, CachedRoleDAO roleDAO,
+ CachedUserRoleDAO userRoleDAO, CachedCredDAO credDAO, CachedCertDAO certDAO,
+ LocateDAO locateDAO,FutureDAO futureDAO, DelegateDAO delegateDAO,
+ ApprovalDAO approvalDAO ) {
+ this.historyDAO = historyDAO;
+ this.cacheInfoDAO = cacheInfoDAO;
+ this.nsDAO = nsDAO;
+ this.permDAO = permDAO;
+ this.roleDAO = roleDAO;
+ this.userRoleDAO = userRoleDAO;
+ this.credDAO = credDAO;
+ this.certDAO = certDAO;
this.locateDAO = locateDAO;
this.futureDAO = futureDAO;
this.delegateDAO = delegateDAO;
@@ -272,28 +272,28 @@ public class Question {
}
public Result<PermDAO.Data> permFrom(AuthzTrans trans, String type, String instance, String action) {
- if(type.indexOf('@') >= 0) {
- int colon = type.indexOf(':');
- if(colon>=0) {
- PermDAO.Data pdd = new PermDAO.Data();
- pdd.ns = type.substring(0, colon);
- pdd.type = type.substring(colon+1);
- pdd.instance = instance;
- pdd.action = action;
-
- return Result.ok(pdd);
- } else {
- return Result.err(Result.ERR_BadData,"Could not extract ns and type from " + type);
- }
- } else {
- Result<NsDAO.Data> rnd = deriveNs(trans, type);
- if (rnd.isOK()) {
- return Result.ok(new PermDAO.Data(new NsSplit(rnd.value, type),
- instance, action));
- } else {
- return Result.err(rnd);
- }
- }
+ if(type.indexOf('@') >= 0) {
+ int colon = type.indexOf(':');
+ if(colon>=0) {
+ PermDAO.Data pdd = new PermDAO.Data();
+ pdd.ns = type.substring(0, colon);
+ pdd.type = type.substring(colon+1);
+ pdd.instance = instance;
+ pdd.action = action;
+
+ return Result.ok(pdd);
+ } else {
+ return Result.err(Result.ERR_BadData,"Could not extract ns and type from " + type);
+ }
+ } else {
+ Result<NsDAO.Data> rnd = deriveNs(trans, type);
+ if (rnd.isOK()) {
+ return Result.ok(new PermDAO.Data(new NsSplit(rnd.value, type),
+ instance, action));
+ } else {
+ return Result.err(rnd);
+ }
+ }
}
/**
@@ -357,38 +357,38 @@ public class Question {
}
public Result<List<PermDAO.Data>> getPermsByType(AuthzTrans trans, String type) {
- if(type.indexOf('@') >= 0) {
- int colon = type.indexOf(':');
- if(colon>=0) {
- return permDAO.readByType(trans, type.substring(0, colon),type.substring(colon+1));
- } else {
- return Result.err(Result.ERR_BadData, "%s is malformed",type);
- }
- } else {
- Result<NsSplit> nss = deriveNsSplit(trans, type);
- if (nss.notOK()) {
- return Result.err(nss);
- }
- return permDAO.readByType(trans, nss.value.ns, nss.value.name);
- }
+ if(type.indexOf('@') >= 0) {
+ int colon = type.indexOf(':');
+ if(colon>=0) {
+ return permDAO.readByType(trans, type.substring(0, colon),type.substring(colon+1));
+ } else {
+ return Result.err(Result.ERR_BadData, "%s is malformed",type);
+ }
+ } else {
+ Result<NsSplit> nss = deriveNsSplit(trans, type);
+ if (nss.notOK()) {
+ return Result.err(nss);
+ }
+ return permDAO.readByType(trans, nss.value.ns, nss.value.name);
+ }
}
public Result<List<PermDAO.Data>> getPermsByName(AuthzTrans trans, String type, String instance, String action) {
- if(type.indexOf('@') >= 0) {
- int colon = type.indexOf(':');
- if(colon>=0) {
- return permDAO.read(trans, type.substring(0, colon),type.substring(colon+1), instance,action);
- } else {
- return Result.err(Result.ERR_BadData, "%s is malformed",type);
- }
- } else {
- Result<NsSplit> nss = deriveNsSplit(trans, type);
- if (nss.notOK()) {
- return Result.err(nss);
- }
-
- return permDAO.read(trans, nss.value.ns, nss.value.name, instance,action);
- }
+ if(type.indexOf('@') >= 0) {
+ int colon = type.indexOf(':');
+ if(colon>=0) {
+ return permDAO.read(trans, type.substring(0, colon),type.substring(colon+1), instance,action);
+ } else {
+ return Result.err(Result.ERR_BadData, "%s is malformed",type);
+ }
+ } else {
+ Result<NsSplit> nss = deriveNsSplit(trans, type);
+ if (nss.notOK()) {
+ return Result.err(nss);
+ }
+
+ return permDAO.read(trans, nss.value.ns, nss.value.name, instance,action);
+ }
}
public Result<List<PermDAO.Data>> getPermsByRole(AuthzTrans trans, String role, boolean lookup) {
@@ -435,13 +435,13 @@ public class Question {
}
public Result<List<RoleDAO.Data>> getRolesByName(AuthzTrans trans, String role) {
- if(role.startsWith(trans.user()) ) {
- if(role.endsWith(":user")) {
- return roleDAO.read(trans,trans.user(), "user");
- } else {
- return Result.err(Result.ERR_BadData,"%s is a badly formatted role",role);
- }
- }
+ if(role.startsWith(trans.user()) ) {
+ if(role.endsWith(":user")) {
+ return roleDAO.read(trans,trans.user(), "user");
+ } else {
+ return Result.err(Result.ERR_BadData,"%s is a badly formatted role",role);
+ }
+ }
Result<NsSplit> nss = deriveNsSplit(trans, role);
if (nss.notOK()) {
return Result.err(nss);
@@ -619,9 +619,9 @@ public class Question {
}
public Result<NsDAO.Data> mayUser(AuthzTrans trans, String user, RoleDAO.Data rdd, Access access) {
- if(trans.user().equals(rdd.ns)) {
- return Result.ok((NsDAO.Data)null);
- }
+ if(trans.user().equals(rdd.ns)) {
+ return Result.ok((NsDAO.Data)null);
+ }
Result<NsDAO.Data> rnsd = deriveNs(trans, rdd.ns);
if (rnsd.isOK()) {
return mayUser(trans, user, rnsd.value, rdd, access);
@@ -676,17 +676,17 @@ public class Question {
}
public Result<NsDAO.Data> mayUser(AuthzTrans trans, String user,PermDAO.Data pdd, Access access) {
- if(pdd.ns.indexOf('@')>-1) {
- if(user.equals(pdd.ns) || isGranted(trans,user,Define.ROOT_NS(),"access",pdd.instance,READ)) {
- NsDAO.Data ndd = new NsDAO.Data();
- ndd.name = user;
- ndd.type = NsDAO.USER;
- ndd.parent = "";
- return Result.ok(ndd);
- } else {
- return Result.err(Result.ERR_Security,"Only a User may modify User");
- }
- }
+ if(pdd.ns.indexOf('@')>-1) {
+ if(user.equals(pdd.ns) || isGranted(trans,user,Define.ROOT_NS(),"access",pdd.instance,READ)) {
+ NsDAO.Data ndd = new NsDAO.Data();
+ ndd.name = user;
+ ndd.type = NsDAO.USER;
+ ndd.parent = "";
+ return Result.ok(ndd);
+ } else {
+ return Result.err(Result.ERR_Security,"Only a User may modify User");
+ }
+ }
Result<NsDAO.Data> rnsd = deriveNs(trans, pdd.ns);
if (rnsd.isOK()) {
return mayUser(trans, user, rnsd.value, pdd, access);
@@ -885,7 +885,7 @@ public class Question {
}
}
if (cddl.size()>1) {
- Collections.sort(cddl, (a, b) -> b.expires.compareTo(a.expires));
+ Collections.sort(cddl, (a, b) -> b.expires.compareTo(a.expires));
}
} else {
cddl = result.value;
@@ -945,13 +945,13 @@ public class Question {
rv = Result.err(Status.ERR_Security,
"Credentials expired %s",Chrono.utcStamp(expired));
} else {
- if (debug==null && alwaysSpecial) {
- debug = new StringBuilder();
- }
- if (debug!=null) {
- debug.append(trans.env().encryptor().encrypt(new String(cred)));
- rv = Result.err(Status.ERR_Security,String.format("invalid password - %s",debug.toString()));
- }
+ if (debug==null && alwaysSpecial) {
+ debug = new StringBuilder();
+ }
+ if (debug!=null) {
+ debug.append(trans.env().encryptor().encrypt(new String(cred)));
+ rv = Result.err(Status.ERR_Security,String.format("invalid password - %s",debug.toString()));
+ }
}
}
} else {
@@ -1005,14 +1005,14 @@ public class Question {
}
} else if (cred.type==CredDAO.FQI) {
- cred.cred = null;
- return Result.ok(cred);
+ cred.cred = null;
+ return Result.ok(cred);
}
return Result.err(Status.ERR_Security,"invalid/unreadable credential");
}
public Result<Boolean> userCredCheck(AuthzTrans trans, CredDAO.Data orig, final byte[] raw) {
- Result<Boolean> rv;
+ Result<Boolean> rv;
TimeTaken tt = trans.start("CheckCred Cred", Env.SUB);
try {
switch(orig.type) {
@@ -1231,11 +1231,11 @@ public class Question {
Result<List<UserRoleDAO.Data>> rur = userRoleDAO.read(trans, user,ns+DOT_ADMIN);
if (rur.isOKhasData()) {
Date now = new Date();
- for (UserRoleDAO.Data urdd : rur.value){
- if (urdd.expires.after(now)) {
- return true;
- }
- }
+ for (UserRoleDAO.Data urdd : rur.value){
+ if (urdd.expires.after(now)) {
+ return true;
+ }
+ }
};
return false;
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
index 27d5df74..bd297e7d 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
@@ -73,15 +73,15 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> {
}
try {
- String aaf_url;
- if(name.indexOf('.')>=0) {
- aaf_url = "https://"+Config.AAF_LOCATE_URL_TAG+'/'+name+':'+version;
- } else {
- aaf_url = "https://"+Config.AAF_LOCATE_URL_TAG+"/%CNS.%NS."+name+':'+version;
- }
- RegistrationPropHolder rph = new RegistrationPropHolder(access,0);
- aaf_url = rph.replacements(getClass().getSimpleName(),aaf_url, null,null);
- access.printf(Level.INIT,"Creating DirectAAFLocator to %s",aaf_url);
+ String aaf_url;
+ if(name.indexOf('.')>=0) {
+ aaf_url = "https://"+Config.AAF_LOCATE_URL_TAG+'/'+name+':'+version;
+ } else {
+ aaf_url = "https://"+Config.AAF_LOCATE_URL_TAG+"/%CNS.%NS."+name+':'+version;
+ }
+ RegistrationPropHolder rph = new RegistrationPropHolder(access,0);
+ aaf_url = rph.replacements(getClass().getSimpleName(),aaf_url, null,null);
+ access.printf(Level.INIT,"Creating DirectAAFLocator to %s",aaf_url);
uri = new URI(aaf_url);
} catch (URISyntaxException | UnknownHostException | CadiException e) {
throw new LocatorException(e);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
index 3c7d873e..bdeb77f3 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
@@ -52,10 +52,10 @@ public class DirectAAFUserPass implements CredVal {
@Override
public boolean validate(String user, Type type, byte[] pass, Object state) {
- if(user==null || type==null || pass==null) {
- return false;
- }
-
+ if(user==null || type==null || pass==null) {
+ return false;
+ }
+
try {
AuthzTrans trans;
boolean transfer = false;
@@ -74,7 +74,7 @@ public class DirectAAFUserPass implements CredVal {
}
Result<Date> result = question.doesUserCredMatch(trans, user, pass);
if(transfer) {
- ((HttpServletRequest)state).setAttribute("CRED_TAG", trans.getTag());
+ ((HttpServletRequest)state).setAttribute("CRED_TAG", trans.getTag());
}
trans.logAuditTrail(env.debug());
switch(result.status) {
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
index 99421097..ce9d5930 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
@@ -41,54 +41,54 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
private LocateDAO ldao;
private List<LocateDAO.Data> ldd;
public DirectRegistrar(Access access, LocateDAO ldao, int port) throws CadiException {
- this.ldao = ldao;
+ this.ldao = ldao;
ldd = new ArrayList<>();
RegistrationCreator rc = new RegistrationCreator(access);
MgmtEndpoints mes = rc.create(port);
for(MgmtEndpoint me : mes.getMgmtEndpoint()) {
- ldd.add(convert(me));
+ ldd.add(convert(me));
}
}
private LocateDAO.Data convert(MgmtEndpoint me) {
- LocateDAO.Data out = new LocateDAO.Data();
- out.name=me.getName();
- out.hostname=me.getHostname();
- out.latitude=me.getLatitude();
- out.longitude=me.getLongitude();
- out.major=me.getMajor();
- out.minor=me.getMinor();
- out.pkg=me.getPkg();
- out.patch=me.getPatch();
- out.port=me.getPort();
- out.protocol=me.getProtocol();
- out.subprotocol(true).addAll(me.getSubprotocol());
-// out.port_key = UUID.randomUUID();
- return out;
- }
+ LocateDAO.Data out = new LocateDAO.Data();
+ out.name=me.getName();
+ out.hostname=me.getHostname();
+ out.latitude=me.getLatitude();
+ out.longitude=me.getLongitude();
+ out.major=me.getMajor();
+ out.minor=me.getMinor();
+ out.pkg=me.getPkg();
+ out.patch=me.getPatch();
+ out.port=me.getPort();
+ out.protocol=me.getProtocol();
+ out.subprotocol(true).addAll(me.getSubprotocol());
+// out.port_key = UUID.randomUUID();
+ return out;
+ }
- @Override
+ @Override
public Result<Void> update(AuthzEnv env) {
- AuthzTrans trans = env.newTransNoAvg();
- StringBuilder sb = null;
- for(LocateDAO.Data ld : ldd) {
- org.onap.aaf.auth.layer.Result<Void> dr = ldao.update(trans, ld);
- if (dr.notOK()) {
- if(sb == null) {
- sb = new StringBuilder(dr.errorString());
- } else {
- sb.append(';');
- sb.append(dr.errorString());
- }
- }
- }
-
- if(sb==null) {
- return Result.ok(200, null);
- } else {
- return Result.err(503, sb.toString());
- }
+ AuthzTrans trans = env.newTransNoAvg();
+ StringBuilder sb = null;
+ for(LocateDAO.Data ld : ldd) {
+ org.onap.aaf.auth.layer.Result<Void> dr = ldao.update(trans, ld);
+ if (dr.notOK()) {
+ if(sb == null) {
+ sb = new StringBuilder(dr.errorString());
+ } else {
+ sb.append(';');
+ sb.append(dr.errorString());
+ }
+ }
+ }
+
+ if(sb==null) {
+ return Result.ok(200, null);
+ } else {
+ return Result.err(503, sb.toString());
+ }
}
/* (non-Javadoc)
@@ -96,25 +96,25 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
*/
@Override
public Result<Void> cancel(AuthzEnv env) {
- AuthzTrans trans = env.newTransNoAvg();
- StringBuilder sb = null;
- for(LocateDAO.Data ld : ldd) {
+ AuthzTrans trans = env.newTransNoAvg();
+ StringBuilder sb = null;
+ for(LocateDAO.Data ld : ldd) {
org.onap.aaf.auth.layer.Result<Void> dr = ldao.delete(trans, ld, false);
- if (dr.notOK()) {
- if(sb == null) {
- sb = new StringBuilder(dr.errorString());
- } else {
- sb.append(';');
- sb.append(dr.errorString());
- }
- }
- }
-
- if(sb==null) {
- return Result.ok(200, null);
- } else {
- return Result.err(503, sb.toString());
- }
+ if (dr.notOK()) {
+ if(sb == null) {
+ sb = new StringBuilder(dr.errorString());
+ } else {
+ sb.append(';');
+ sb.append(dr.errorString());
+ }
+ }
+ }
+
+ if(sb==null) {
+ return Result.ok(200, null);
+ } else {
+ return Result.err(503, sb.toString());
+ }
}
}