diff options
author | Sean Hassan <sean.hassan@att.com> | 2020-09-17 15:54:19 -0500 |
---|---|---|
committer | Sean Hassan <sean.hassan@att.com> | 2020-09-24 14:32:42 -0500 |
commit | 4a3962dec1da8d43e0db225d42fa4d57e338e1d6 (patch) | |
tree | 37bb59f7dd421ffed038a1e28aea9f6bb83b834c /shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthorizationInfo.java | |
parent | c5d6ab10c6715bbe75be3ece7d033048ce2e1f97 (diff) |
Prepare for release 2.1.18
Issue-ID: AAF-1202
Change-Id: I138ff4d94ed17a5b2de24fa95daf7d2a38eb84c0
Signed-off-by: Sean Hassan <sean.hassan@att.com>
Diffstat (limited to 'shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthorizationInfo.java')
-rw-r--r-- | shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthorizationInfo.java | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthorizationInfo.java b/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthorizationInfo.java index ac62778..247683a 100644 --- a/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthorizationInfo.java +++ b/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthorizationInfo.java @@ -42,6 +42,7 @@ public class AAFAuthorizationInfo implements AuthorizationInfo { private Access access; private Principal bait; + private List<org.onap.aaf.cadi.Permission> pond; // Use these to save conversions private List<org.onap.aaf.cadi.Permission> cPerms; private List<Permission> oPerms; @@ -53,6 +54,16 @@ public class AAFAuthorizationInfo implements AuthorizationInfo { cPerms=null; oPerms=null; sPerms=null; + pond=null; + } + + public AAFAuthorizationInfo(Access access, Principal bait, List<org.onap.aaf.cadi.Permission> pond) { + this.access = access; + this.bait = bait; + this.pond = pond; + oPerms=null; + sPerms=null; + cPerms=null; } public Principal principal() { @@ -64,13 +75,20 @@ public class AAFAuthorizationInfo implements AuthorizationInfo { access.log(Level.DEBUG, "AAFAuthorizationInfo.getObjectPermissions"); synchronized(bait) { if(oPerms == null) { - oPerms = new ArrayList<>(); - if(cPerms==null) { - cPerms = new ArrayList<>(); - AAFRealm.singleton.authz.fishAll(bait, cPerms); - } - for(final org.onap.aaf.cadi.Permission p : cPerms) { - oPerms.add(new AAFShiroPermission(p)); + if (pond != null) { + oPerms = new ArrayList<Permission>(); + for(final org.onap.aaf.cadi.Permission p : pond) { + oPerms.add(new AAFShiroPermission(p)); + } + } else { + oPerms = new ArrayList<>(); + if (cPerms == null) { + cPerms = new ArrayList<>(); + AAFRealm.singleton.authz.fishAll(bait, cPerms); + } + for (final org.onap.aaf.cadi.Permission p : cPerms) { + oPerms.add(new AAFShiroPermission(p)); + } } } } @@ -89,13 +107,21 @@ public class AAFAuthorizationInfo implements AuthorizationInfo { access.log(Level.DEBUG,"AAFAuthorizationInfo.getStringPermissions"); synchronized(bait) { if(sPerms == null) { - sPerms = new ArrayList<>(); - if(cPerms==null) { - cPerms = new ArrayList<>(); - AAFRealm.singleton.authz.fishAll(bait,cPerms); - } - for(final org.onap.aaf.cadi.Permission p : cPerms) { - sPerms.add(p.getKey()); + if (pond != null) { + sPerms = new ArrayList<String>(); + for(org.onap.aaf.cadi.Permission p : pond) { + sPerms.add(p.getKey().replace("|", ":")); + access.printf(Level.INFO, "%s has %s", bait.getName(), p.getKey()); + } + } else { + sPerms = new ArrayList<>(); + if (cPerms == null) { + cPerms = new ArrayList<>(); + AAFRealm.singleton.authz.fishAll(bait, cPerms); + } + for (final org.onap.aaf.cadi.Permission p : cPerms) { + sPerms.add(p.getKey()); + } } } } |