directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r655572 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Date Mon, 12 May 2008 17:24:56 GMT
Author: elecharny
Date: Mon May 12 10:24:56 2008
New Revision: 655572

URL: http://svn.apache.org/viewvc?rev=655572&view=rev
Log:
o Fixed DIRSERVER-768

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=655572&r1=655571&r2=655572&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Mon May 12 10:24:56 2008
@@ -225,7 +225,7 @@
             LOG.debug( "Matching name = '" + opContext.getDn().getUpName() + "'" );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( "getMatchedName" );
         return next.getMatchedName( opContext );
     }
 
@@ -237,7 +237,7 @@
             LOG.debug( "Getting root DSE" );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( "getRootDSE" );
         return next.getRootDSE( opContext );
     }
 
@@ -249,7 +249,7 @@
             LOG.debug( "Getting suffix for name = '" + opContext.getDn().getUpName() + "'"
);
         }
 
-        checkAuthenticated();
+        checkAuthenticated( "getSuffix" );
         return next.getSuffix( opContext );
     }
 
@@ -261,7 +261,7 @@
             LOG.debug( "Testing if entry name = '" + opContext.getDn().getUpName() + "' exists"
);
         }
 
-        checkAuthenticated();
+        checkAuthenticated( "hasEntry" );
         return next.hasEntry( opContext );
     }
 
@@ -273,7 +273,7 @@
             LOG.debug( "Listing base = '" + opContext.getDn().getUpName() + "'" );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( "list" );
         return next.list( opContext );
     }
 
@@ -285,7 +285,7 @@
             LOG.debug( "Listing suffixes" );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( "listSuffixes" );
         return next.listSuffixes( opContext );
     }
 
@@ -306,7 +306,7 @@
             }
         }
 
-        checkAuthenticated();
+        checkAuthenticated( "lookup" );
         return next.lookup( opContext );
     }
 
@@ -401,17 +401,15 @@
     {
         try
         {
-            checkAuthenticated();
+            checkAuthenticated( operation.toString() );
         }
         catch ( IllegalStateException ise )
         {
-            LOG.error( "Attempted operation {} by unauthenticated caller.", operation.name()
);
-
             throw new IllegalStateException( "Attempted operation by unauthenticated caller."
);
         }
     }
 
-    private void checkAuthenticated() throws NamingException
+    private void checkAuthenticated( String operation ) throws NamingException
     {
         ServerContext ctx = ( ServerContext ) InvocationStack.getInstance().peek().getCaller();
 
@@ -425,7 +423,10 @@
             return;
         }
 
-        throw new IllegalStateException( "Attempted operation by unauthenticated caller."
);
+        String principal = (String)ctx.getEnvironment().get( Context.SECURITY_PRINCIPAL );

+        String message = "Attempted operation '" + operation + "' by unauthenticated caller
'" + principal + "'.";
+        LOG.error( message );
+        throw new IllegalStateException( message );
     }
 
 



Mime
View raw message