summaryrefslogtreecommitdiffstats
path: root/shiro/src/test/java/org
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-11-12 10:57:07 -0600
committerInstrumental <jonathan.gathman@att.com>2018-11-12 10:57:14 -0600
commit990a15f23a823ef02029950db5059888b7083801 (patch)
tree86dc0f817bc2717ff76379a46a5e6b8f672efac4 /shiro/src/test/java/org
parentf2c2c058cf0660c94ad0a40445c6305b0be2de14 (diff)
Put MapBath code in Shiro
Issue-ID: AAF-618 Change-Id: Ibbee25744a479d40ed438f926d0d3785a76fc5d1 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'shiro/src/test/java/org')
-rw-r--r--shiro/src/test/java/org/onap/aaf/cadi/shiro/test/JU_AAFRealm.java54
1 files changed, 29 insertions, 25 deletions
diff --git a/shiro/src/test/java/org/onap/aaf/cadi/shiro/test/JU_AAFRealm.java b/shiro/src/test/java/org/onap/aaf/cadi/shiro/test/JU_AAFRealm.java
index 591a56c..f915538 100644
--- a/shiro/src/test/java/org/onap/aaf/cadi/shiro/test/JU_AAFRealm.java
+++ b/shiro/src/test/java/org/onap/aaf/cadi/shiro/test/JU_AAFRealm.java
@@ -27,9 +27,7 @@ import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.Permission;
import org.apache.shiro.subject.PrincipalCollection;
-import org.junit.Test;
import org.onap.aaf.cadi.aaf.AAFPermission;
-import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.shiro.AAFRealm;
import org.onap.aaf.cadi.shiro.AAFShiroPermission;
@@ -37,31 +35,37 @@ import junit.framework.Assert;
public class JU_AAFRealm {
- // TODO: Ian - fix this test
- // @Test
- // public void test() {
- // // NOTE This is a live test. This JUnit needs to be built with "Mock"
- // try {
- // System.setProperty(Config.CADI_PROP_FILES, "/opt/app/osaaf/etc/org.osaaf.common.props");
- // TestAAFRealm ar = new TestAAFRealm();
-
- // UsernamePasswordToken upt = new UsernamePasswordToken("jonathan@people.osaaf.org", "new2You!");
- // AuthenticationInfo ani = ar.authn(upt);
-
- // AuthorizationInfo azi = ar.authz(ani.getPrincipals());
- // // Change this to something YOU have, Sai...
-
- // testAPerm(true,azi,"org.access","something","*");
- // testAPerm(false,azi,"org.accessX","something","*");
- // } catch (Throwable t) {
- // t.printStackTrace();
- // Assert.fail();
- // }
- // }
+/*
+ @Test
+ public void test() {
+ // NOTE This is a live test. This JUnit needs to be built with "Mock" before it can be
+ // an official JUNIT
+ try {
+ System.setProperty(Config.CADI_PROP_FILES, "/opt/app/osaaf/local/org.onap.aai.props");
+ TestAAFRealm ar = new TestAAFRealm();
+
+ //UsernamePasswordToken upt = new UsernamePasswordToken("demo@people.osaaf.org", "demo123456!");
+ UsernamePasswordToken upt = new UsernamePasswordToken("AAI", "AAI");
+
+ AuthenticationInfo ani = ar.authn(upt);
+
+ AuthorizationInfo azi = ar.authz(ani.getPrincipals());
+ // Change this to something YOU have, Sai...
+
+ testAPerm(true,azi,"org.onap.aai","resources","something","get");
+ testAPerm(false,azi,"org.osaaf.nons","resources","something","get");
+ // testAPerm(true,azi,"name","org.access","something","*");
+ // testAPerm(false,azi,"org.accessX","something","*");
+ } catch (Throwable t) {
+ t.printStackTrace();
+ Assert.fail();
+ }
+ }
+*/
- private void testAPerm(boolean expect, AuthorizationInfo azi, String name, String type, String instance, String action) {
+ private void testAPerm(boolean expect, AuthorizationInfo azi, String ns, String type, String instance, String action) {
- AAFShiroPermission testPerm = new AAFShiroPermission(new AAFPermission(type,name,instance,action,new ArrayList<String>()));
+ AAFShiroPermission testPerm = new AAFShiroPermission(new AAFPermission(ns,type,instance,action,new ArrayList<String>()));
boolean any = false;
for(Permission p : azi.getObjectPermissions()) {