diff options
38 files changed, 109 insertions, 120 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java index b5ff59b1..d2695a35 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java @@ -264,8 +264,7 @@ public abstract class Batch { try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { - e.printStackTrace(); - env.warn().log("Unable to get hostname"); + env.warn().log("Unable to get hostname : "+e.getMessage()); return (0); } @@ -545,7 +544,7 @@ public abstract class Batch { if(cluster!=null && !cluster.isClosed()) { cluster.close(); } - e.printStackTrace(System.err); + env.warn().log(System.err); } } diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java index 49309004..4c14f0fd 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java @@ -316,7 +316,7 @@ public class Cred { } public static void batchDelete(StringBuilder sb, List<String> row) { - Long l = Long.parseLong(row.get(5)); + long l = Long.parseLong(row.get(5)); String date = Chrono.batchFmt.format(new Date(l)); sb.append("DELETE from authz.cred WHERE id='"); sb.append(row.get(1)); @@ -326,9 +326,6 @@ public class Cred { sb.append(" AND expires='"); sb.append(date); sb.append("';\n"); -// sb.append(" AND expires=dateof(maxtimeuuid("); -// sb.append(row.get(5)); -// sb.append("));\n"); } diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java index bb3a3e94..3c246db6 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java @@ -77,10 +77,6 @@ public class ExpireRange { lcred.add(new Range(TWO_MONTH,1,-1,-1,GregorianCalendar.MONTH,1,GregorianCalendar.MONTH,2)); lur.add( new Range(ONE_MONTH,1,-1,-1,0,0,GregorianCalendar.MONTH,1)); - // Comment out until we can get some more clear actions in place for GUI - // lur.add( new Range(ONE_MONTH,1,-1,-1,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1)); - // lur.add( new Range(ONE_WEEK,2,-1,1,0,0,GregorianCalendar.WEEK_OF_MONTH,1)); - lx509.add(new Range(ONE_MONTH,1,-1,-1,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1)); } } diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java index 04814e01..b002dd8b 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java @@ -80,7 +80,6 @@ public abstract class NotifyBody { if(row.size()>3) { escalation = Integer.parseInt(row.get(3)); } - return; } else if(type.equals(row.get(0))) { String user = user(row); if(user!=null) { @@ -180,42 +179,46 @@ public abstract class NotifyBody { String path = pkg.getName().replace('.', '/'); URL url = cl.getResource(path); List<String> classNames = new ArrayList<>(); - String urlString = url.toString(); - if(urlString.startsWith("jar:file:")) { - int exclam = urlString.lastIndexOf('!'); - JarFile jf = new JarFile(urlString.substring(9,exclam)); - try { - Enumeration<JarEntry> jfe = jf.entries(); - while(jfe.hasMoreElements()) { - String name = jfe.nextElement().getName(); - if(name.startsWith(path) && name.endsWith(".class")) { - classNames.add(name.substring(0,name.length()-6).replace('/', '.')); + String urlString; + if (url != null) { + urlString = url.toString(); + if (urlString.startsWith("jar:file:")) { + int exclam = urlString.lastIndexOf('!'); + JarFile jf = new JarFile(urlString.substring(9, exclam)); + try { + Enumeration<JarEntry> jfe = jf.entries(); + while (jfe.hasMoreElements()) { + String name = jfe.nextElement().getName(); + if (name.startsWith(path) && name.endsWith(".class")) { + classNames.add(name.substring(0, name.length() - 6).replace('/', '.')); + } } + } finally { + jf.close(); } - } finally { - jf.close(); - } - } else { - File dir = new File(url.getFile()); - for( String f : dir.list()) { - if(f.endsWith(".class")) { - classNames.add(pkg.getName() + '.' + f.substring(0,f.length() - 6)); + } else { + File dir = new File(url.getFile()); + String[] dirs = dir.list(); + if (dirs != null) { + for (String f : dirs) { + if (f.endsWith(".class")) { + classNames.add(pkg.getName() + '.' + f.substring(0, f.length() - 6)); + } + } } } - } - for(String cls : classNames) { - try { - Class<?> c = cl.loadClass(cls); - if((c!=null)&&(!Modifier.isAbstract(c.getModifiers()))) { - Constructor<?> cst = c.getConstructor(Access.class); - NotifyBody nb = (NotifyBody)cst.newInstance(access); - if(nb!=null) { - bodyMap.put("info|" + nb.name, nb); - bodyMap.put(nb.type+'|' + nb.name, nb); - } + for (String cls : classNames) { + try { + Class<?> c = cl.loadClass(cls); + if ((c != null) && (!Modifier.isAbstract(c.getModifiers()))) { + Constructor<?> cst = c.getConstructor(Access.class); + NotifyBody nb = (NotifyBody) cst.newInstance(access); + bodyMap.put("info|" + nb.name, nb); + bodyMap.put(nb.type + '|' + nb.name, nb); + } + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); } - } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); } } } diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java index 087ab952..3d26ce99 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java @@ -94,7 +94,14 @@ public class Remove extends Batch { remove.add(new File(logDir, args()[i])); } } else { - remove.add(new File(logDir,"Delete"+Chrono.dateOnlyStamp()+".csv")); + final String ending = Chrono.dateOnlyStamp()+".csv"; + for (File file : logDir.listFiles(f -> { + String name = f.getName(); + return name.endsWith(ending) && ( + name.startsWith("Delete") || name.startsWith("Clean.")); + })) { + remove.add(file); + }; } for(File f : remove) { diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java index de0efdfd..c68768e1 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java @@ -73,7 +73,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> { // private static Slot sessionSlot; // not used since 2015 private static final ArrayList<AbsCassDAO<? extends TransStore,?>.PSInfo> psinfos = new ArrayList<>(); private static final List<Object> EMPTY = new ArrayList<>(0); - private static final Deque<ResetRequest> resetDeque = new ConcurrentLinkedDeque<ResetRequest>(); + private static final Deque<ResetRequest> resetDeque = new ConcurrentLinkedDeque<>(); private static boolean resetTrigger = false; private static long nextAvailableReset = 0; @@ -96,10 +96,6 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> { this.dataClass = dataClass; } -// Not used since 2015 -// public static void setSessionSlot(Slot slot) { -// sessionSlot = slot; -// } //Note: Lower case ON PURPOSE. These names used to create History Messages public enum CRUD { diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java index 7ea7dd75..28b8c4b4 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java @@ -40,6 +40,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> { public Result<List<Data>> readNS(AuthzTrans trans, final String ns) { DAOGetter getter = new DAOGetter(trans,dao()) { + @Override public Result<List<Data>> call() { return dao.readNS(trans, ns); } @@ -51,14 +52,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> { } else { } -// if (getter.result==null) { -// if (lurd==null) { - return Result.err(Status.ERR_PermissionNotFound,"No Permission found - " + lurd.details); -// } else { -// return Result.ok(lurd); -// } -// } -// return getter.result; + return Result.err(Status.ERR_PermissionNotFound,"No Permission found - " + lurd.details); } public Result<List<Data>> readChildren(AuthzTrans trans, final String ns, final String type) { @@ -74,6 +68,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> { */ public Result<List<Data>> readByType(AuthzTrans trans, final String ns, final String type) { DAOGetter getter = new DAOGetter(trans,dao()) { + @Override public Result<List<Data>> call() { return dao.readByType(trans, ns, type); } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java index b90c3579..0c1fa4cc 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java @@ -39,6 +39,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> { public Result<List<Data>> readNS(AuthzTrans trans, final String ns) { DAOGetter getter = new DAOGetter(trans,dao()) { + @Override public Result<List<Data>> call() { return dao.readNS(trans, ns); } @@ -53,6 +54,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> { public Result<List<Data>> readName(AuthzTrans trans, final String name) { DAOGetter getter = new DAOGetter(trans,dao()) { + @Override public Result<List<Data>> call() { return dao().readName(trans, name); } 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 c994dd53..6dd0fdd2 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 @@ -117,7 +117,6 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> { obj[++idx]=data.target; obj[++idx]=data.subject; obj[++idx]=data.memo; -// obj[++idx]=data.detail; obj[++idx]=data.reconstruct; } }; @@ -139,9 +138,8 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> { } },writeConsistency) ); -// disable(CRUD.Create); - replace(CRUD.read, new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + + replace(CRUD.read, new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM history WHERE id = ?", defLoader,readConsistency) // new HistLoader(2) { // @Override @@ -227,7 +225,7 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> { private class YYYYMM implements Accept<Data> { private int[] yyyymm; - public YYYYMM(int yyyymm[]) { + public YYYYMM(int[] yyyymm) { this.yyyymm = yyyymm; } @Override diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java index a84490d0..bda7ef0f 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/OAuthTokenDAO.java @@ -3,6 +3,7 @@ * org.onap.aaf * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 IBM. * =========================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,7 +101,7 @@ public class OAuthTokenDAO extends CassDAOImpl<AuthzTrans,OAuthTokenDAO.Data> { } public String toString() { - return user.toString() + ' ' + id.toString() + ' ' + Chrono.dateTime(expires) + (active?"":"in") + "active"; + return user + ' ' + id + ' ' + Chrono.dateTime(expires) + (active?"":"in") + "active"; } } 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 d8096188..89643c4d 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 @@ -297,7 +297,8 @@ public class Function { } // VALIDATIONS done... Add NS - if ((rq = q.nsDAO().create(trans, namespace.data())).notOK()) { + rq = q.nsDAO().create(trans, namespace.data()); + if (rq.notOK()) { return Result.err(rq); } diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java index 2ccbd236..b25e2054 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java @@ -47,8 +47,7 @@ public class DirectAAFLur implements Lur { public DirectAAFLur(AuthzEnv env, Question question/*, TokenMgr tm*/) { this.env = env; - this.question = question; -// oauth = new OAuth2Lur(null); + this.question = question } @Override @@ -148,7 +147,9 @@ public class DirectAAFLur implements Lur { return true; } else{ String[] lp = p.getKey().split("\\|"); - if (lp.length<3)return false; + if (lp.length<3) { + return false; + } if (data.fullType().equals(lp[0])) if (data.instance!=null && (data.instance.equals(lp[1]) || "*".equals(data.instance))) if (data.action!=null && (data.action.equals(lp[2]) || "*".equals(data.action))) diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java index 51b962c8..e7b4ef4f 100644 --- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/JscepCA.java @@ -225,10 +225,7 @@ public class JscepCA extends CA { try { String[] info = Split.split('/', urlinfo); Client c = new Client(new URL(JscepCA.CA_PREFIX + info[0] + JscepCA.CA_POSTFIX), - cert -> { - //TODO checkIssuer - return true; - } + cert -> true ); // Map URL to Client, because Client doesn't expose Connection mxcwiC.put(c, mxcwiS.get(urlinfo)); diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java index fde94b42..32fd906b 100644 --- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/ca/X509ChainWithIssuer.java @@ -34,7 +34,6 @@ import org.onap.aaf.cadi.configure.Factory; public class X509ChainWithIssuer extends X509andChain { private String issuerDN; - public X509Certificate caX509; public X509ChainWithIssuer(X509ChainWithIssuer orig, X509Certificate x509) { super(x509,orig.trustChain); diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java index 67325034..3130e5b2 100644 --- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java +++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/service/CMService.java @@ -3,7 +3,7 @@ * org.onap.aaf * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2018 IBM. + * Modifications Copyright (C) 2019 IBM. * =========================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -334,12 +334,10 @@ public class CMService { trans.error().log("CMService var primary is null"); } else { String fg = fqdns.get(i); - if (fg!=null && primary!=null && fg.equals(primary.getHostName())) { - if (i != 0) { + if ((fg!=null && primary!=null && fg.equals(primary.getHostName()))&&(i != 0)) { String tmp = fqdns.get(0); fqdns.set(0, primary.getHostName()); fqdns.set(i, tmp); - } } } } 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 2c084428..bf4193e4 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 @@ -264,7 +264,8 @@ public class AAFcli { } else if ("set".equalsIgnoreCase(largs[idx])) { while (largs.length > ++idx) { int equals = largs[idx].indexOf('='); - String tag, value; + String tag; + String value; if (equals < 0) { tag = largs[idx]; value = access.getProperty(Config.AAF_APPPASS,null); @@ -549,15 +550,15 @@ public class AAFcli { while ((line = reader.readLine()) != null) { showDetails = (line.contains("-d")); - if (line.equalsIgnoreCase("quit") || line.equalsIgnoreCase("q") || line.equalsIgnoreCase("exit")) { + if ("quit".equalsIgnoreCase(line) || "q".equalsIgnoreCase(line) || "exit".equalsIgnoreCase(line)) { break; - } else if (line.equalsIgnoreCase("--help -d") || line.equalsIgnoreCase("help -d") - || line.equalsIgnoreCase("help")) { + } else if ("--help -d".equalsIgnoreCase(line) || "help -d".equalsIgnoreCase(line) + || "help".equalsIgnoreCase(line)) { line = "--help"; - } else if (line.equalsIgnoreCase("cls")) { + } else if ("cls".equalsIgnoreCase(line)) { reader.clearScreen(); continue; - } else if (line.equalsIgnoreCase("?")) { + } else if ("?".equalsIgnoreCase(line)) { keyboardHelp(); continue; } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java index 559ae070..c444722b 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java @@ -3,6 +3,7 @@ * org.onap.aaf * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 IBM. * =========================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -149,7 +150,8 @@ public class Create extends Cmd { public void detailedHelp(int _indent, StringBuilder sb) { int indent = _indent; detailLine(sb,indent,"Create a Permission with:"); - detailLine(sb,indent+=2,"type - A Namespace qualified identifier identifying the kind of"); + indent=indent+2; + detailLine(sb,indent,"type - A Namespace qualified identifier identifying the kind of"); detailLine(sb,indent+11,"resource to be protected"); detailLine(sb,indent,"instance - A name that distinguishes a particular instance of resource"); detailLine(sb,indent,"action - What kind of action is allowed"); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java index 828cdcbf..765bd0aa 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java @@ -41,7 +41,7 @@ import aaf.v2_0.Approvals; */ public class ListApprovals extends Cmd { private static final String HEADER = "List Approvals"; - private final static String[] options = {"user","approver","ticket"}; + private static final String[] options = {"user","approver","ticket"}; public ListApprovals(List parent) { super(parent,"approvals", new Param(optionsToString(options),true), diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java index dd3a14d9..1dea281f 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/layer/DirectIntrospectImpl.java @@ -21,6 +21,6 @@ package org.onap.aaf.auth.layer; -public class DirectIntrospectImpl { +public interface DirectIntrospectImpl { } diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java index b36ed4b9..d35ac4af 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/local/TextIndex.java @@ -75,7 +75,8 @@ public class TextIndex { long lhash; int curr; while ((max-min)>100) { - ttok.pos((curr=(min+(max-min)/2))*REC_SIZE); + curr=(min+(max-min)/2); + ttok.pos(curr*REC_SIZE); tib.rewind(); lhash = hashToLong(tib.get()); if (lhash<hash) { diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java index a3282849..f8c5ae19 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/Route.java @@ -56,7 +56,7 @@ public class Route<TRANS extends Trans> { content.add(code, others); } - public HttpCode<TRANS,?> getCode(TRANS trans, HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { + public HttpCode<TRANS,?> getCode(TRANS trans, HttpServletRequest req, HttpServletResponse resp) { // Type is associated with Accept for GET (since it is what is being returned // We associate the rest with ContentType. // FYI, thought about this a long time before implementing this way. diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java index c292fae3..6af28356 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/rserv/TypedCode.java @@ -21,12 +21,11 @@ package org.onap.aaf.auth.rserv; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import javax.servlet.ServletException; + import org.onap.aaf.misc.env.Env; import org.onap.aaf.misc.env.TimeTaken; diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java index bcef6de9..899850d0 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java @@ -47,7 +47,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named private final String[] columns; private final Rows rows; private Code<HTMLGen> other; -// private DynamicCode<HTMLGen, AuthGUI, AuthzTrans> prefix,postfix; + public Table(String title, TRANS trans, Data<S,TRANS> data, Code<HTMLGen> other, String name, String ... attrs) { this(title,trans,data,name, attrs); @@ -56,7 +56,6 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named public Table(String title, TRANS trans, Data<S,TRANS> data, String name, String ... attrs) { super(true,name); -// prefix=postfix=null; for (String a : attrs) { addAttr(false, a); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java index 8f3fe958..c19820d3 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java @@ -149,7 +149,8 @@ public class CMArtiChangeAction extends Page { break; case CMArtiChangeForm.UPDATE: Future<Artifacts> fu = client.update("/cert/artifacts", gui.artifactsDF, artifacts); - if ((rv=fu).get(AAFcli.timeout())) { + rv=fu; + if(rv.get(AAFcli.timeout())) { hgen.p("Artifact " + arti.getMechid() + " on " + arti.getMachine() + " is updated"); ok.set(true); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java index 07aa99a6..4ad7893a 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java @@ -188,7 +188,8 @@ public class CredDetail extends Page { } lmu = users.get(u.getId()); if (lmu==null) { - users.put(u.getId(),lmu=new ArrayList<>()); + lmu=new ArrayList<>(); + users.put(u.getId(),lmu); } mu=null; for (Map<Integer,List<User>> xmu : lmu) { @@ -198,12 +199,14 @@ public class CredDetail extends Page { } if (mu==null) { - lmu.add(mu=new HashMap<>()); + mu=new HashMap<>(); + lmu.add(mu); } lu = mu.get(u.getType()); if (lu==null) { - mu.put(u.getType(),lu = new ArrayList<>()); + lu = new ArrayList<>(); + mu.put(u.getType(),lu); } lu.add(u); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLandingAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLandingAction.java index 0c5979ec..88ee139f 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLandingAction.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLandingAction.java @@ -40,7 +40,6 @@ public class LoginLandingAction extends Page { new BreadCrumbs(breadcrumbs), new NamedCode(true,"content") { final Slot sID = gui.env.slot(LoginLanding.NAME+'.'+LoginLanding.fields[0]); -// final Slot sPassword = gui.env.slot(LoginLanding.NAME+'.'+LoginLanding.fields[1]); @Override public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java index 76aef6e2..817f3e8f 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java @@ -3,6 +3,7 @@ * org.onap.aaf * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 IBM. * =========================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,14 +44,14 @@ import org.onap.aaf.misc.xgen.html.HTMLGen; import aaf.v2_0.CredRequest; public class PassDeleteAction extends Page { - public static final String NAME = "PassDeleteAction"; + public static final String CLASS = "PassDeleteAction"; public static final String HREF = "/gui/passdelete"; - private static enum Params{id,date,ns,type}; + private enum Params{id,date,ns,type}; public PassDeleteAction(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException { - super(gui.env,NAME,HREF,Params.values(), + super(gui.env,CLASS,HREF,Params.values(), new BreadCrumbs(breadcrumbs), - new SlotCode<AuthzTrans>(true,gui.env,NAME,Params.values()) { + new SlotCode<AuthzTrans>(true,gui.env,CLASS,Params.values()) { @Override public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException { cache.dynamic(hgen, new DynamicCode<HTMLGen,AAF_GUI, AuthzTrans>() { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java index b528b24b..694fefdc 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java @@ -125,7 +125,7 @@ public class PendingRequestsShow extends Page { * */ private static class Model extends TableData<AAF_GUI,AuthzTrans> { - final long NUM_100NS_INTERVALS_SINCE_UUID_EPOCH = 0x01b21dd213814000L; + final static long NUM_100NS_INTERVALS_SINCE_UUID_EPOCH = 0x01b21dd213814000L; private final Slot sAsUser; private static final String[] headers = new String[] {"Request Date","Status","Memo","Approver"}; @@ -167,7 +167,6 @@ public class PendingRequestsShow extends Page { String prevTicket = null; for (Approval a : approvals) { String approver = a.getApprover(); -// String approverShort = approver.substring(0,approver.indexOf('@')); AbsCell tsCell = null; String ticket = a.getTicket(); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java index ac9cdf1e..4a6e1f49 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java @@ -77,7 +77,6 @@ public class PermGrantForm extends Page { hgen.js(copyRoleJS); hgen.text("function copyRole(role) {"); hgen.text("var txtRole = document.querySelector(\"#role\");"); -// hgen.text("if (role==;"); hgen.text("txtRole.value=role;"); hgen.text("}"); hgen.end(copyRoleJS); diff --git a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java index e5366ac6..49ac8b13 100644 --- a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java +++ b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java @@ -26,7 +26,6 @@ import java.util.Map; import javax.servlet.Filter; -import org.onap.aaf.auth.cache.Cache.Dated; import org.onap.aaf.auth.env.AuthzEnv; import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.auth.env.AuthzTransFilter; @@ -49,7 +48,6 @@ import org.onap.aaf.misc.env.Env; public class AAF_Hello extends AbsService<AuthzEnv,AuthzTrans> { public enum API{TOKEN_REQ, TOKEN,INTROSPECT, ERROR,VOID}; - public Map<String, Dated> cacheUser; public AAFAuthn<?> aafAuthn; public AAFLurPerm aafLurPerm; @@ -57,9 +55,6 @@ public class AAF_Hello extends AbsService<AuthzEnv,AuthzTrans> { * Construct AuthzAPI with all the Context Supporting Routes that Authz needs * * @param env - * @param si - * @param dm - * @param decryptor * @throws APIException */ public AAF_Hello(final AuthzEnv env) throws Exception { diff --git a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java index 0e12ebb9..afaef837 100644 --- a/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java +++ b/auth/auth-locate/src/main/java/org/onap/aaf/auth/locate/service/LocateServiceImpl.java @@ -32,7 +32,6 @@ import org.onap.aaf.auth.locate.AAF_Locate; import org.onap.aaf.auth.locate.mapper.Mapper; import org.onap.aaf.auth.locate.validation.LocateValidator; import org.onap.aaf.cadi.aaf.AAFPermission; -import org.onap.aaf.misc.env.APIException; import locate.v1_0.Endpoints; import locate.v1_0.MgmtEndpoint; diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java index 6f04ed5f..e28e2ff0 100644 --- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java +++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/AAF_OAuth.java @@ -79,9 +79,6 @@ public class AAF_OAuth extends AbsService<AuthzEnv,AuthzTrans> { * Construct AuthzAPI with all the Context Supporting Routes that Authz needs * * @param env - * @param si - * @param dm - * @param decryptor * @throws APIException */ public AAF_OAuth(final AuthzEnv env) throws Exception { diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java index 3127ba18..10830efa 100644 --- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java +++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/facade/DirectIntrospect.java @@ -24,6 +24,7 @@ package org.onap.aaf.auth.oauth.facade; import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.auth.layer.Result; +@FunctionalInterface public interface DirectIntrospect<INTROSPECT> { Result<INTROSPECT> mappedIntrospect(AuthzTrans trans, String token); } diff --git a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java index 4e1dd5b9..a13959f1 100644 --- a/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java +++ b/auth/auth-oauth/src/main/java/org/onap/aaf/auth/oauth/service/OAuthService.java @@ -128,7 +128,8 @@ public class OAuthService { odd.refresh = AAFToken.toToken(UUID.randomUUID()); odd.active = true; long exp; - odd.expires = new Date(exp=(System.currentTimeMillis()+TOK_EXP)); + exp=(System.currentTimeMillis()+TOK_EXP); + odd.expires = new Date(exp); odd.exp_sec = exp/1000; odd.req_ip = trans.ip(); diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java index 341719c3..6354f6a9 100644 --- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java +++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/api/API_History.java @@ -208,7 +208,7 @@ public class API_History { // Get Common "yyyymm" parameter, or none - private static int[] getYears(HttpServletRequest req) throws NumberFormatException { + private static int[] getYears(HttpServletRequest req) { // Sonar says threading issues. SimpleDateFormat FMT = new SimpleDateFormat("yyyyMM"); String yyyymm = req.getParameter("yyyymm"); diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java index 5b092740..3e8d6f97 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/PermEval.java @@ -30,7 +30,6 @@ public class PermEval { public static final char ALT_START_INST_KEY_CHAR='/'; public static final char LIST_SEP = ','; - public static final String INST_KEY_REGEX = new StringBuilder().append(START_INST_KEY_CHAR).toString(); public static final String ASTERIX = "*"; /** @@ -47,7 +46,7 @@ public class PermEval { if (sInst == null || pInst == null) { return false; } - if (sInst == "" || pInst == "") { + if (sInst.equals("") || pInst.equals("")) { return false; } if (ASTERIX.equals(sInst)) { @@ -137,8 +136,8 @@ public class PermEval { * Action is not quite as complex. But we write it in this function so it can be consistent */ public static boolean evalAction(String sAction,String pAction) { - if (ASTERIX.equals(sAction))return true; // If Server's String is "*", then it accepts every Action - if (pAction == "") return false; + if (ASTERIX.equals(sAction)) return true; // If Server's String is "*", then it accepts every Action + if (pAction.equals("")) return false; for (String sItem : Split.split(LIST_SEP,sAction)) { // allow for "," definition in Action if (pAction.charAt(0)==START_REGEX_CHAR? // First char sItem.matches(pAction.substring(1)): // Evaluate as Regular Expression diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java index 65202940..308fcc80 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/client/Examples.java @@ -302,15 +302,16 @@ public class Examples { Ns ns; Nss nss = new Nss(); - nss.getNs().add(ns = new Nss.Ns()); + ns = new Nss.Ns(); + nss.getNs().add(ns); ns.setName("org.osaaf.myns"); ns.getResponsible().add("ab1234@people.osaaf.org"); ns.getResponsible().add("cd5678@people.osaaf.org"); ns.getAdmin().add("zy9876@people.osaaf.org"); ns.getAdmin().add("xw5432@people.osaaf.org"); ns.setDescription("This is my Namespace to set up"); - - nss.getNs().add(ns = new Nss.Ns()); + ns = new Nss.Ns(); + nss.getNs().add(ns); ns.setName("org.osaaf.myOtherNs"); ns.getResponsible().add("ab1234@people.osaaf.org"); ns.getResponsible().add("cd5678@people.osaaf.org"); diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java index e6c95db8..aa20dfae 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java @@ -63,6 +63,8 @@ public class Chrono { niceUTCDateFmt.setTimeZone(TimeZone.getTimeZone("UTC"));
iso8601Fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
batchFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss+SSSS");
+ // Note: DB and thus Batch conversions should always be in UTC Time
+ batchFmt.setTimeZone(TimeZone.getTimeZone("UTC"));
}
|