You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2008/05/24 01:17:45 UTC
svn commit: r659710 -
/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
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