From 4a698c2e3d926fd69673eea8b15a78bc7770a29c Mon Sep 17 00:00:00 2001 From: Instrumental Date: Fri, 22 Feb 2019 13:52:58 -0600 Subject: Add Multi-Realm class handling Also, improve Logging Issue-ID: AAF-771 Change-Id: I4cf286b5c474596f5e824e5204598cf0c1bb014c Signed-off-by: Instrumental --- .../org/onap/aaf/cadi/shiro/AAFAuthenticationInfo.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthenticationInfo.java') diff --git a/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthenticationInfo.java b/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthenticationInfo.java index beb9707..99e387d 100644 --- a/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthenticationInfo.java +++ b/shiro/src/main/java/org/onap/aaf/cadi/shiro/AAFAuthenticationInfo.java @@ -24,20 +24,17 @@ import java.nio.ByteBuffer; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.AuthenticationToken; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.subject.PrincipalCollection; import org.onap.aaf.cadi.Access; +import org.onap.aaf.cadi.Access.Level; import org.onap.aaf.cadi.Hash; public class AAFAuthenticationInfo implements AuthenticationInfo { private static final long serialVersionUID = -1502704556864321020L; - final static Logger logger = LoggerFactory.getLogger(AAFAuthenticationInfo.class); - // We assume that Shiro is doing Memory Only, and this salt is not needed cross process private final static int salt = new SecureRandom().nextInt(); @@ -50,15 +47,16 @@ public class AAFAuthenticationInfo implements AuthenticationInfo { apc = new AAFPrincipalCollection(username); hash = getSaltedCred(password); } + @Override public byte[] getCredentials() { -// logger.info("AAFAuthenticationInfo.getCredentials"); + access.log(Level.DEBUG, "AAFAuthenticationInfo.getCredentials"); return hash; } @Override public PrincipalCollection getPrincipals() { -// logger.info( "AAFAuthenticationInfo.getPrincipals"); + access.log(Level.DEBUG, "AAFAuthenticationInfo.getPrincipals"); return apc; } @@ -67,7 +65,7 @@ public class AAFAuthenticationInfo implements AuthenticationInfo { UsernamePasswordToken upt = (UsernamePasswordToken)atoken; if(apc.getPrimaryPrincipal().getName().equals(upt.getPrincipal())) { byte[] newhash = getSaltedCred(new String(upt.getPassword())); - logger.info("Successful authentication attempt by " +upt.getPrincipal()); + access.printf(Level.INFO,"Successful authentication attempt by %s",upt.getPrincipal()); if(newhash.length==hash.length) { for(int i=0;i