You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2014/11/14 14:27:56 UTC
directory-fortress-realm git commit: FC-48 - remove log4j from realm
impl
Repository: directory-fortress-realm
Updated Branches:
refs/heads/master 4d2e0d005 -> e014bfbf4
FC-48 - remove log4j from realm impl
Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/commit/e014bfbf
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/tree/e014bfbf
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/diff/e014bfbf
Branch: refs/heads/master
Commit: e014bfbf48e5b0f6697a375d5974d6f3c85b662f
Parents: 4d2e0d0
Author: Shawn McKinney <sm...@apache.org>
Authored: Fri Nov 14 07:27:40 2014 -0600
Committer: Shawn McKinney <sm...@apache.org>
Committed: Fri Nov 14 07:27:40 2014 -0600
----------------------------------------------------------------------
impl/pom.xml | 4 +-
.../fortress/realm/J2eePolicyMgrFactory.java | 15 +++---
.../fortress/realm/J2eePolicyMgrImpl.java | 49 ++++++--------------
.../fortress/realm/tomcat/TcAccessMgrImpl.java | 28 ++++-------
pom.xml | 4 +-
proxy/pom.xml | 2 +-
6 files changed, 32 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/e014bfbf/impl/pom.xml
----------------------------------------------------------------------
diff --git a/impl/pom.xml b/impl/pom.xml
index 8ee93df..c8ae058 100644
--- a/impl/pom.xml
+++ b/impl/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.directory</groupId>
<artifactId>fortress-realm</artifactId>
- <version>1.0-RC40</version>
+ <version>1.0-RC40-SNAPSHOT</version>
</parent>
<artifactId>fortress-realm-impl</artifactId>
@@ -34,7 +34,7 @@
</description>
<properties>
- <fortress-core.version>1.0-RC40</fortress-core.version>
+ <fortress-core.version>1.0-RC40-SNAPSHOT</fortress-core.version>
</properties>
<dependencies>
http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/e014bfbf/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrFactory.java
----------------------------------------------------------------------
diff --git a/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrFactory.java b/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrFactory.java
index 03801fc..d265432 100644
--- a/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrFactory.java
+++ b/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrFactory.java
@@ -22,8 +22,8 @@ package org.apache.directory.fortress.realm;
import org.apache.directory.fortress.core.cfg.Config;
import org.apache.directory.fortress.core.SecurityException;
import org.apache.directory.fortress.core.GlobalErrIds;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Creates an instance of the J2eePolicyMgr object.
@@ -42,7 +42,7 @@ public class J2eePolicyMgrFactory
private static final String J2EE_POLICYMGR_IMPLEMENTATION = "realmImplementation";
private static final String J2EE_POLICYMGR_DEFAULT_CLASS = J2eePolicyMgrImpl.class.getName();
private static final String CLS_NM = J2eePolicyMgrFactory.class.getName();
- private static final Logger log = Logger.getLogger(CLS_NM);
+ private static final Logger log = LoggerFactory.getLogger(CLS_NM);
private static String j2eeClassName = Config.getProperty(J2EE_POLICYMGR_IMPLEMENTATION);
/**
@@ -60,11 +60,8 @@ public class J2eePolicyMgrFactory
if (j2eeClassName == null || j2eeClassName.compareTo("") == 0)
{
j2eeClassName = J2EE_POLICYMGR_DEFAULT_CLASS;
- if (log.isEnabledFor(Level.DEBUG))
- {
- log.debug(CLS_NM + ".createInstance <" + J2EE_POLICYMGR_IMPLEMENTATION + "> not found.");
- log.debug(CLS_NM + ".createInstance use default <" + J2EE_POLICYMGR_DEFAULT_CLASS + ">");
- }
+ log.debug( ".createInstance [{}], not found.", J2EE_POLICYMGR_IMPLEMENTATION );
+ log.debug( ".createInstance use default [{}], not found.", J2EE_POLICYMGR_DEFAULT_CLASS );
}
realmMgr = (J2eePolicyMgr) Class.forName(j2eeClassName).newInstance();
}
@@ -81,7 +78,7 @@ public class J2eePolicyMgrFactory
catch (java.lang.IllegalAccessException e)
{
String error = CLS_NM + ".createInstance caught java.lang.IllegalAccessException=" + e;
- log.fatal(error);
+ log.error(error);
throw new SecurityException(GlobalErrIds.FT_MGR_ILLEGAL_ACCESS, error, e);
}
return realmMgr;
http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/e014bfbf/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrImpl.java
----------------------------------------------------------------------
diff --git a/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrImpl.java b/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrImpl.java
index 2f3790a..9acaacc 100644
--- a/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrImpl.java
+++ b/impl/src/main/java/org/apache/directory/fortress/realm/J2eePolicyMgrImpl.java
@@ -41,8 +41,8 @@ import org.apache.directory.fortress.core.rbac.Session;
import org.apache.directory.fortress.realm.tomcat.TcPrincipal;
import org.apache.directory.fortress.core.util.attr.VUtil;
import org.apache.directory.fortress.core.util.time.CUtil;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This class is for components that use Websphere and Tomcat Container SPI's to provide
@@ -54,7 +54,7 @@ import org.apache.log4j.Logger;
public class J2eePolicyMgrImpl implements J2eePolicyMgr
{
private static final String CLS_NM = J2eePolicyMgrImpl.class.getName();
- private static final Logger log = Logger.getLogger( CLS_NM );
+ private static final Logger log = LoggerFactory.getLogger( CLS_NM );
private static AccessMgr accessMgr;
private static ReviewMgr reviewMgr;
private static final String SESSION = "session";
@@ -71,7 +71,7 @@ public class J2eePolicyMgrImpl implements J2eePolicyMgr
catch ( SecurityException se )
{
String error = CLS_NM + " caught SecurityException=" + se;
- log.fatal( error );
+ log.error( error );
}
}
@@ -93,17 +93,11 @@ public class J2eePolicyMgrImpl implements J2eePolicyMgr
if ( session != null )
{
result = true;
- if ( log.isEnabledFor( Level.DEBUG ) )
- {
- log.debug( CLS_NM + ".authenticate userId [" + userId + "] successful" );
- }
+ log.debug( ".authenticate userId [{}], successful", userId );
}
else
{
- if ( log.isEnabledFor( Level.DEBUG ) )
- {
- log.debug( CLS_NM + ".authenticate userId [" + userId + "] failed" );
- }
+ log.debug( ".authenticate userId [{}], failed", userId );
}
return result;
@@ -270,10 +264,7 @@ public class J2eePolicyMgrImpl implements J2eePolicyMgr
private TcPrincipal createSession( User user ) throws SecurityException
{
Session session = accessMgr.createSession( user, false );
- if ( log.isEnabledFor( Level.DEBUG ) )
- {
- log.debug( CLS_NM + ".createSession userId [" + user.getUserId() + "] successful" );
- }
+ log.debug( ".createSession userId [{}], successful", user.getUserId() );
HashMap context = new HashMap<String, Session>();
context.put( SESSION, session );
@@ -365,10 +356,7 @@ public class J2eePolicyMgrImpl implements J2eePolicyMgr
@Override
public Session createSession( User user, boolean isTrusted ) throws SecurityException
{
- if ( log.isDebugEnabled() )
- {
- log.debug( CLS_NM + ".createSession userId [" + user.getUserId() + "] " );
- }
+ log.debug( ".createSession userId [{}], isTrusted [{}]", user.getUserId(), isTrusted );
return accessMgr.createSession( user, isTrusted );
}
@@ -388,10 +376,7 @@ public class J2eePolicyMgrImpl implements J2eePolicyMgr
public boolean hasRole( Principal principal, String roleName ) throws SecurityException
{
String fullMethodName = CLS_NM + ".hasRole";
- if ( log.isDebugEnabled() )
- {
- log.debug( fullMethodName + " userId [" + principal.getName() + "] role [" + roleName + "]" );
- }
+ log.debug( ".hasRole userId [{}], role [{}]", principal.getName(), roleName );
// Fail closed
boolean result = false;
@@ -411,27 +396,19 @@ public class J2eePolicyMgrImpl implements J2eePolicyMgr
if ( authZRoles.contains( roleName ) )
{
// Yes, we have a match.
- if ( log.isEnabledFor( Level.DEBUG ) )
- {
- log.debug( fullMethodName + " userId [" + principal.getName() + "] role [" + roleName + "] " +
- "successful" );
- }
+ log.debug( "{} userId [{}], role [{}], successful", fullMethodName, principal.getName(), roleName );
result = true;
}
else
{
- if ( log.isEnabledFor( Level.DEBUG ) )
- {
- // User is not authorized in their Session..
- log.debug( fullMethodName + " userId [" + principal.getName() + "] is not authorized role [" +
- roleName + "]" );
- }
+ // User is not authorized in their Session..
+ log.debug( "{} userId [{}], is not authorized role [{}]", fullMethodName, principal.getName(), roleName );
}
}
else
{
// User does not have any authorized Roles in their Session..
- log.info( fullMethodName + " userId [" + principal.getName() + "], role [" + roleName + "], has no authorized roles" );
+ log.info( "{} userId [{}], role [{}], has no authorized roles", fullMethodName, principal.getName(), roleName );
}
return result;
}
http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/e014bfbf/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcAccessMgrImpl.java
----------------------------------------------------------------------
diff --git a/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcAccessMgrImpl.java b/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcAccessMgrImpl.java
index c0628ec..38d8485 100644
--- a/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcAccessMgrImpl.java
+++ b/impl/src/main/java/org/apache/directory/fortress/realm/tomcat/TcAccessMgrImpl.java
@@ -23,8 +23,8 @@ import org.apache.directory.fortress.core.SecurityException;
import org.apache.directory.fortress.core.util.attr.VUtil;
import org.apache.directory.fortress.realm.J2eePolicyMgr;
import org.apache.directory.fortress.realm.J2eePolicyMgrFactory;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.security.Principal;
import java.util.Arrays;
@@ -38,7 +38,7 @@ import java.util.List;
public class TcAccessMgrImpl implements TcAccessMgr
{
private static final String CLS_NM = TcAccessMgrImpl.class.getName();
- private static final Logger log = Logger.getLogger(CLS_NM);
+ private static final Logger log = LoggerFactory.getLogger(CLS_NM);
private static int count = 0;
private J2eePolicyMgr j2eeMgr;
// If this field gets set, use for all subsequent calls to authenticate:
@@ -57,7 +57,7 @@ public class TcAccessMgrImpl implements TcAccessMgr
catch (SecurityException se)
{
String error = CLS_NM + " constructor caught SecurityException=" + se;
- log.fatal(error);
+ log.error( error );
se.printStackTrace();
throw new java.lang.RuntimeException(error, se);
}
@@ -79,18 +79,12 @@ public class TcAccessMgrImpl implements TcAccessMgr
if( VUtil.isNotNullOrEmpty( defaultRoles ))
{
prin = j2eeMgr.createSession( userId, password, defaultRoles );
- if (log.isEnabledFor(Level.DEBUG))
- {
- log.debug(CLS_NM + ".authenticate userId [" + userId + "], with default roles [" + defaultRoles + "], successful");
- }
+ log.debug( ".authenticate userId [{}], with default roles[{}], successful", userId, defaultRoles );
}
else
{
prin = j2eeMgr.createSession(userId, password);
- if (log.isEnabledFor(Level.DEBUG))
- {
- log.debug(CLS_NM + ".authenticate userId [" + userId + "] successful");
- }
+ log.debug( ".authenticate userId [{}], successful", userId );
}
}
catch (SecurityException se)
@@ -117,18 +111,12 @@ public class TcAccessMgrImpl implements TcAccessMgr
{
if (j2eeMgr.hasRole(principal, roleName))
{
- if (log.isEnabledFor(Level.DEBUG))
- {
- log.debug(CLS_NM + ".hasRole userId <" + principal.getName() + "> role <" + roleName + "> successful");
- }
+ log.debug( ".hasRole userId [{}], role[{}], successful", principal.getName(), roleName );
result = true;
}
else
{
- if (log.isEnabledFor(Level.DEBUG))
- {
- log.debug(CLS_NM + ".hasRole userId <" + principal.getName() + "> role <" + roleName + "> failed");
- }
+ log.debug( ".hasRole userId [{}], role[{}], failed", principal.getName(), roleName );
}
}
catch (SecurityException se)
http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/e014bfbf/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bcd9df3..fa8cbec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
<name>Apache Fortress Realm</name>
<description>Fortress Realm is an ANSI RBAC INCITS 359 compliant policy enforcement engine.</description>
<url>http://directory.apache.org/foress/</url>
- <version>1.0-RC40</version>
+ <version>1.0-RC40-SNAPSHOT</version>
<properties>
<projectName>apache-directory-fortress-realm</projectName>
@@ -42,7 +42,7 @@
<junit.version>4.11</junit.version>
<!-- Set versions for depending jars -->
- <fortress-core.version>1.0-RC40</fortress-core.version>
+ <fortress-core.version>1.0-RC40-SNAPSHOT</fortress-core.version>
<!-- Set versions for depending jars -->
<findbugs.annotations.version>1.0.0</findbugs.annotations.version>
http://git-wip-us.apache.org/repos/asf/directory-fortress-realm/blob/e014bfbf/proxy/pom.xml
----------------------------------------------------------------------
diff --git a/proxy/pom.xml b/proxy/pom.xml
index 876e755..6329ec8 100644
--- a/proxy/pom.xml
+++ b/proxy/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.directory</groupId>
<artifactId>fortress-realm</artifactId>
- <version>1.0-RC40</version>
+ <version>1.0-RC40-SNAPSHOT</version>
</parent>
<artifactId>fortress-realm-proxy</artifactId>