directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r659710 - /directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Date Fri, 23 May 2008 23:17:45 GMT
Author: elecharny
Date: Fri May 23 16:17:44 2008
New Revision: 659710

URL: http://svn.apache.org/viewvc?rev=659710&view=rev
Log:
Reverted to a previously working revision

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

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=659710&r1=659709&r2=659710&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Fri May 23 16:17:44 2008
@@ -401,19 +401,37 @@
      * @param operation the operation type
      * @throws Exception
      */
-    private void checkAuthenticated( OperationContext opContext ) throws Exception
+    private void checkAuthenticated( OperationContext operation ) throws Exception
     {
-        if ( opContext.getPrincipalDN() != null )
+        try
         {
-            return;
+            checkAuthenticated();
         }
+        catch ( IllegalStateException ise )
+        {
+            LOG.error( "Attempted operation {} by unauthenticated caller.", operation.getName()
);
+
+            throw new IllegalStateException( "Attempted operation by unauthenticated caller."
);
+        }
+    }
+
+    private void checkAuthenticated() throws Exception
+    {
+        ServerContext ctx = ( ServerContext ) InvocationStack.getInstance().peek().getCaller();
+
+        if ( ctx.getPrincipal() != null )
+        {
+            if ( ctx.getEnvironment().containsKey( Context.SECURITY_CREDENTIALS ) )
+            {
+                ctx.removeFromEnvironment( Context.SECURITY_CREDENTIALS );
+            }
 
-        LOG.error( "Attempted operation '{}' by unauthenticated caller.", opContext.getName()
);
+            return;
+        }
 
         throw new IllegalStateException( "Attempted operation by unauthenticated caller."
);
     }
 
-
     public void bind( NextInterceptor next, BindOperationContext opContext ) throws Exception
     {
         // The DN is always normalized here



Mime
View raw message