summaryrefslogtreecommitdiffstats
path: root/auth
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-02-07 18:53:11 -0600
committerInstrumental <jonathan.gathman@att.com>2019-02-07 18:53:18 -0600
commit39596f5b6d2c67d8c2b357243ecfb2dd6d746796 (patch)
treedca4f08d6ad0a65cfb378f2f097bbcff165315b6 /auth
parent27afb0201ce717c25d8ffcc50f8b4972fc98f5c5 (diff)
Minor fixes starting from Scratch
Issue-ID: AAF-698 Change-Id: Ie279c11f9f385e9cb179cbe3e16de35cbfa33ecf Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth')
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java3
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/DelegateDAO.java6
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java2
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java7
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java2
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_OrganizationFactory.java9
-rw-r--r--auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java38
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java5
-rw-r--r--auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java2
-rw-r--r--auth/docker/d.props.init1
10 files changed, 22 insertions, 53 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 d49f4faf..543564d9 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
@@ -122,6 +122,9 @@ public abstract class Batch {
}
org = OrganizationFactory.init(env);
+ if(org==null) {
+ throw new OrganizationException("Organization MUST be defined for Batch");
+ }
org.setTestMode(dryRun);
// Special names to allow behaviors beyond normal rules
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/DelegateDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/DelegateDAO.java
index ad862176..e7749bd5 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/DelegateDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/DelegateDAO.java
@@ -60,9 +60,9 @@ public class DelegateDAO extends CassDAOImpl<AuthzTrans, DelegateDAO.Data> {
public static class Data implements Bytification {
- public static String user;
- public static String delegate;
- public static Date expires;
+ public String user;
+ public String delegate;
+ public Date expires;
@Override
public ByteBuffer bytify() throws IOException {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
index 40c8c2d3..f4e6d14e 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
@@ -71,7 +71,7 @@ public class OrganizationFactory {
String realm = env.getProperty(Config.AAF_DEFAULT_REALM,"people.osaaf.org");
defaultOrg = cnst.newInstance(env,realm);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException e) {
- throw new OrganizationException("At least one Organization must be defined",e);
+ env.warn().log("Not Organization Moduled linked in",e);
}
}
if (defaultOrg == null) {
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
index 1bc367e6..fe610e57 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/AbsServiceStarter.java
@@ -23,7 +23,6 @@ import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
import org.onap.aaf.auth.org.OrganizationException;
import org.onap.aaf.auth.org.OrganizationFactory;
@@ -41,15 +40,13 @@ public abstract class AbsServiceStarter<ENV extends RosettaEnv, TRANS extends Tr
protected AbsService<ENV,TRANS> service;
- public AbsServiceStarter(final AbsService<ENV,TRANS> service, boolean noexit) {
+ public AbsServiceStarter(final AbsService<ENV,TRANS> service) {
this.service = service;
try {
OrganizationFactory.init(service.env);
} catch (OrganizationException e) {
service.access.log(e, "Missing defined Organization Plugins");
- if(!noexit) {
- System.exit(3);
- }
+ System.exit(3);
}
// do_register - this is used for specialty Debug Situations. Developer can create an Instance for a remote system
// for Debugging purposes without fear that real clients will start to call your debug instance
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
index 98503d11..413b7919 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/JettyServiceStarter.java
@@ -59,7 +59,7 @@ public class JettyServiceStarter<ENV extends RosettaEnv, TRANS extends Trans> ex
private boolean secure;
public JettyServiceStarter(final AbsService<ENV,TRANS> service) throws OrganizationException {
- super(service,false);
+ super(service);
secure = true;
}
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_OrganizationFactory.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_OrganizationFactory.java
index 36d071fd..20b47331 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_OrganizationFactory.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_OrganizationFactory.java
@@ -55,13 +55,8 @@ public class JU_OrganizationFactory {
@SuppressWarnings("static-access")
@Test
- public void testInit() {
- try {
- organizationFactory.init(bEnv);
- Assert.fail("Expect an exception");
- } catch (OrganizationException e) {
- Assert.assertEquals("At least one Organization must be defined", e.getMessage());
- }
+ public void testInit() throws OrganizationException {
+ Assert.assertEquals(null, organizationFactory.init(bEnv));
}
@SuppressWarnings("static-access") //TODO:Fix this once real input is available AAF-111
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
index 04d58d6b..9b49216d 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
+++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/server/test/JU_AbsServiceStarter.java
@@ -21,51 +21,25 @@
package org.onap.aaf.auth.server.test;
-import static org.junit.Assert.*;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import javax.servlet.Filter;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.env.AuthzTransFilter;
-import org.onap.aaf.auth.local.AbsData;
-import org.onap.aaf.auth.local.DataFile;
-import org.onap.aaf.auth.local.TextIndex;
import org.onap.aaf.auth.rserv.RServlet;
import org.onap.aaf.auth.server.AbsService;
import org.onap.aaf.auth.server.AbsServiceStarter;
-import org.onap.aaf.auth.server.test.JU_AbsService;
import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.Access.Level;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.LocatorException;
import org.onap.aaf.cadi.PropAccess;
-import org.onap.aaf.cadi.Access.Level;
import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.register.Registrant;
import org.onap.aaf.misc.env.impl.BasicEnv;
-import org.onap.aaf.auth.local.AbsData.Iter;
-import org.onap.aaf.auth.local.AbsData.Reuse;
-
-import junit.framework.Assert;
-
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
-
-import java.io.BufferedWriter;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.Principal;
-
-import javax.servlet.Filter;
public class JU_AbsServiceStarter {
@@ -76,7 +50,7 @@ public class JU_AbsServiceStarter {
private class AbsServiceStarterStub extends AbsServiceStarter {
public AbsServiceStarterStub(AbsService service) {
- super(service, true);
+ super(service);
// TODO Auto-generated constructor stub
}
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java
index 67bf3b50..3bc06f11 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/AuthzCassServiceImpl.java
@@ -33,7 +33,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
@@ -2665,7 +2664,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
String inputOption = cr.getEntry();
if (inputOption == null) {
String message = selectCredFromList(lcd, false);
- String[] variables = buildVariables(lcd);
+ Object[] variables = buildVariables(lcd);
return Result.err(Status.ERR_ChoiceNeeded, message, variables);
} else {
entry = Integer.parseInt(inputOption) - 1;
@@ -2823,7 +2822,7 @@ public class AuthzCassServiceImpl <NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DE
String inputOption = cr.getEntry();
if (inputOption == null) {
String message = selectCredFromList(rlcd.value, true);
- String[] variables = buildVariables(rlcd.value);
+ Object[] variables = buildVariables(rlcd.value);
return Result.err(Status.ERR_ChoiceNeeded, message, variables);
} else {
try {
diff --git a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
index 55c3bc86..2d322390 100644
--- a/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
+++ b/auth/auth-service/src/main/java/org/onap/aaf/auth/service/mapper/Mapper_2_0.java
@@ -672,7 +672,7 @@ public class Mapper_2_0 implements Mapper<Nss, Perms, Pkey, Roles, Users, UserRo
Error err = new Error();
err.setMessageId(msgID);
// AT&T Restful Error Format requires numbers "%" placements
- err.setText(Vars.convert(holder, text, var));
+ err.setText(Vars.convert(holder, text, (Object[])var));
for (String s : var) {
err.getVariables().add(s);
}
diff --git a/auth/docker/d.props.init b/auth/docker/d.props.init
index c406b81c..3aaea001 100644
--- a/auth/docker/d.props.init
+++ b/auth/docker/d.props.init
@@ -26,6 +26,7 @@ CONF_ROOT_DIR=/opt/app/osaaf
# For local builds, set PREFIX=
PREFIX="$DOCKER_REPOSITORY/"
NAMESPACE=onap
+USER=aaf
# HOSTNAME=aaf.osaaf.org