From b169754b801f8a7f8790796cf666f2c2ed6b5e1a Mon Sep 17 00:00:00 2001 From: Instrumental Date: Sat, 23 Feb 2019 09:21:01 -0600 Subject: Testing final edition, Shiro Issue-ID: AAF-771 Change-Id: Ia86066e986a92756ad5ac9210fbdb4002de0bb23 Signed-off-by: Instrumental --- pom.xml | 2 +- .../java/org/onap/aaf/cadi/shiro/AAFRealm.java | 23 +++++++++------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index c88f47a..4b9f5e7 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ - 2.1.8 + 2.1.10-SNAPSHOT UTF-8 diff --git a/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFRealm.java b/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFRealm.java index dbc57d7..c455a4d 100644 --- a/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFRealm.java +++ b/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFRealm.java @@ -24,11 +24,9 @@ import java.io.IOException; import java.security.Principal; import java.util.ArrayList; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Set; import java.util.TreeMap; import org.apache.shiro.authc.AuthenticationException; @@ -61,7 +59,7 @@ public class AAFRealm extends AuthorizingRealm { private static class Singleton { private AAFCon acon; private AAFAuthn authn; - private Set> supports; +// private Set> supports; private AAFLurPerm authz; private MapBathConverter mbc; private Map idMap; @@ -82,7 +80,7 @@ public class AAFRealm extends AuthorizingRealm { final String csv = access.getProperty(Config.CADI_BATH_CONVERT); if(csv!=null) { try { - mbc = new MapBathConverter(access, new CSV(csv)); + mbc = new MapBathConverter(access, new CSV(access,csv)); access.log(Level.INFO, "MapBathConversion enabled with file ",csv); idMap = Collections.synchronizedMap(new TreeMap()); // Load @@ -104,7 +102,6 @@ public class AAFRealm extends AuthorizingRealm { } } idMap.put(oldID,newID); - } } catch (IOException e) { access.log(e); @@ -116,8 +113,10 @@ public class AAFRealm extends AuthorizingRealm { throw new RuntimeException(msg,e); } } - supports = Collections.synchronizedSet(new HashSet<>()); - supports.add(UsernamePasswordToken.class); + + // There is only one of these. If there are more, put back +// supports = Collections.synchronizedSet(new HashSet<>()); +// supports.add(UsernamePasswordToken.class); } public static synchronized Singleton singleton() { @@ -265,21 +264,15 @@ public class AAFRealm extends AuthorizingRealm { @Override protected void assertCredentialsMatch(AuthenticationToken atoken, AuthenticationInfo ai)throws AuthenticationException { - if(ai instanceof AAFAuthenticationInfo) { if(!((AAFAuthenticationInfo)ai).matches(atoken)) { throw new AuthenticationException("Credentials do not match"); } - } else { throw new AuthenticationException("AuthenticationInfo is not an AAFAuthenticationInfo"); - } } - - - @Override protected AAFAuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { Principal bait = (Principal)principals.getPrimaryPrincipal(); @@ -303,7 +296,9 @@ public class AAFRealm extends AuthorizingRealm { @Override public boolean supports(AuthenticationToken token) { - return singleton.supports.contains(token.getClass()); + // Only one was being loaded. If more are needed uncomment the multi-class mode + return UsernamePasswordToken.class.equals(token); +// return singleton.supports.contains(token.getClass()); } @Override -- cgit 1.2.3-korg