directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r396169 - in /directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw: protocol/ service/
Date Sat, 22 Apr 2006 22:02:12 GMT
Author: erodriguez
Date: Sat Apr 22 15:02:07 2006
New Revision: 396169

URL: http://svn.apache.org/viewcvs?rev=396169&view=rev
Log:
Updated protocol-changepw to use MINA IoHandlerChain, replacing protocol-common chain.

Removed:
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordExceptionHandler.java
Modified:
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/BuildReply.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordChain.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordContext.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ConfigureChangePasswordChain.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ExtractPassword.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/GetAuthHeader.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/GetServerEntry.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorContext.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorReply.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorRequest.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ProcessPasswordChange.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicket.java
    directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicketAuthHeader.java

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/protocol/ChangePasswordProtocolHandler.java
Sat Apr 22 15:02:07 2006
@@ -20,17 +20,26 @@
 
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+
+import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.server.changepw.ChangePasswordConfiguration;
+import org.apache.directory.server.changepw.exceptions.ChangePasswordException;
+import org.apache.directory.server.changepw.messages.ChangePasswordErrorModifier;
 import org.apache.directory.server.changepw.messages.ChangePasswordRequest;
 import org.apache.directory.server.changepw.service.ChangePasswordChain;
 import org.apache.directory.server.changepw.service.ChangePasswordContext;
+import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
+import org.apache.directory.server.kerberos.shared.messages.ErrorMessage;
+import org.apache.directory.server.kerberos.shared.messages.ErrorMessageModifier;
+import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
-import org.apache.directory.server.protocol.shared.chain.Command;
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,8 +50,8 @@
 
     private ChangePasswordConfiguration config;
     private PrincipalStore store;
-
-    private Command changepwService;
+    private IoHandlerCommand changepwService;
+    private String contextKey = "context";
 
 
     public ChangePasswordProtocolHandler(ChangePasswordConfiguration config, PrincipalStore
store)
@@ -102,14 +111,24 @@
             changepwContext.setStore( store );
             changepwContext.setClientAddress( clientAddress );
             changepwContext.setRequest( request );
+            session.setAttribute( getContextKey(), changepwContext );
 
-            changepwService.execute( changepwContext );
+            changepwService.execute( null, session, message );
 
             session.write( changepwContext.getReply() );
         }
         catch ( Exception e )
         {
             log.error( e.getMessage() );
+
+            ChangePasswordException cpe = ( ChangePasswordException ) e;
+
+            ErrorMessage errorMessage = getErrorMessage( config.getChangepwPrincipal(), cpe
);
+
+            ChangePasswordErrorModifier modifier = new ChangePasswordErrorModifier();
+            modifier.setErrorMessage( errorMessage );
+
+            session.write( modifier.getChangePasswordError() );
         }
     }
 
@@ -120,5 +139,45 @@
         {
             log.debug( "{} SENT: {}", session.getRemoteAddress(), message );
         }
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
+    }
+
+
+    private ErrorMessage getErrorMessage( KerberosPrincipal principal, KerberosException
exception )
+    {
+        ErrorMessageModifier modifier = new ErrorMessageModifier();
+
+        KerberosTime now = new KerberosTime();
+
+        modifier.setErrorCode( exception.getErrorCode() );
+        modifier.setExplanatoryText( exception.getMessage() );
+        modifier.setServerPrincipal( principal );
+        modifier.setServerTime( now );
+        modifier.setServerMicroSecond( 0 );
+        modifier.setExplanatoryData( buildExplanatoryData( exception ) );
+
+        return modifier.getErrorMessage();
+    }
+
+
+    private byte[] buildExplanatoryData( KerberosException exception )
+    {
+        short resultCode = ( short ) exception.getErrorCode();
+        byte[] resultString = exception.getExplanatoryData();
+
+        ByteBuffer byteBuffer = ByteBuffer.allocate( 256 );
+        byteBuffer.putShort( resultCode );
+        byteBuffer.put( resultString );
+
+        byteBuffer.flip();
+        byte[] explanatoryData = new byte[byteBuffer.remaining()];
+        byteBuffer.get( explanatoryData, 0, explanatoryData.length );
+
+        return explanatoryData;
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/BuildReply.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/BuildReply.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/BuildReply.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/BuildReply.java
Sat Apr 22 15:02:07 2006
@@ -35,21 +35,22 @@
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.messages.value.HostAddress;
 import org.apache.directory.server.kerberos.shared.service.LockBox;
-import org.apache.directory.server.protocol.shared.chain.Context;
-import org.apache.directory.server.protocol.shared.chain.impl.CommandBase;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-public class BuildReply extends CommandBase
+public class BuildReply implements IoHandlerCommand
 {
     /** the log for this class */
     private static final Logger log = LoggerFactory.getLogger( BuildReply.class );
 
+    private String contextKey = "context";
 
-    public boolean execute( Context context ) throws Exception
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
-        ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+        ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
 
         Authenticator authenticator = changepwContext.getAuthenticator();
         Ticket ticket = changepwContext.getTicket();
@@ -114,6 +115,12 @@
 
         changepwContext.setReply( replyModifier.getChangePasswordReply() );
 
-        return CONTINUE_CHAIN;
+        next.execute( session, message );
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordChain.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordChain.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordChain.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordChain.java
Sat Apr 22 15:02:07 2006
@@ -17,7 +17,7 @@
 package org.apache.directory.server.changepw.service;
 
 
-import org.apache.directory.server.protocol.shared.chain.impl.ChainBase;
+import org.apache.mina.handler.chain.IoHandlerChain;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -25,7 +25,7 @@
 /**
  * Kerberos Change Password and Set Password Protocols (RFC 3244)
  */
-public class ChangePasswordChain extends ChainBase
+public class ChangePasswordChain extends IoHandlerChain
 {
     /** the logger for this class */
     private static final Logger log = LoggerFactory.getLogger( ChangePasswordChain.class
);
@@ -33,34 +33,31 @@
 
     public ChangePasswordChain()
     {
-        super();
-        addCommand( new ChangePasswordExceptionHandler() );
-
         if ( log.isDebugEnabled() )
         {
-            addCommand( new MonitorRequest() );
+            addLast( "monitorRequest", new MonitorRequest() );
         }
 
-        addCommand( new ConfigureChangePasswordChain() );
-        addCommand( new GetAuthHeader() );
-        addCommand( new VerifyServiceTicket() );
-        addCommand( new GetServerEntry() );
-        addCommand( new VerifyServiceTicketAuthHeader() );
+        addLast( "configureChangePasswordChain", new ConfigureChangePasswordChain() );
+        addLast( "getAuthHeader", new GetAuthHeader() );
+        addLast( "verifyServiceTicket", new VerifyServiceTicket() );
+        addLast( "getServerEntry", new GetServerEntry() );
+        addLast( "verifyServiceTicketAuthHeader", new VerifyServiceTicketAuthHeader() );
 
-        addCommand( new ExtractPassword() );
+        addLast( "extractPassword", new ExtractPassword() );
 
         if ( log.isDebugEnabled() )
         {
-            addCommand( new MonitorContext() );
+            addLast( "monitorContext", new MonitorContext() );
         }
 
-        addCommand( new CheckPasswordPolicy() );
-        addCommand( new ProcessPasswordChange() );
-        addCommand( new BuildReply() );
+        addLast( "checkPasswordPolicy", new CheckPasswordPolicy() );
+        addLast( "processPasswordChange", new ProcessPasswordChange() );
+        addLast( "buildReply", new BuildReply() );
 
         if ( log.isDebugEnabled() )
         {
-            addCommand( new MonitorReply() );
+            addLast( "monitorReply", new MonitorReply() );
         }
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordContext.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordContext.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordContext.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ChangePasswordContext.java
Sat Apr 22 15:02:07 2006
@@ -28,10 +28,9 @@
 import org.apache.directory.server.kerberos.shared.service.LockBox;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntry;
-import org.apache.directory.server.protocol.shared.chain.impl.ContextBase;
 
 
-public class ChangePasswordContext extends ContextBase
+public class ChangePasswordContext
 {
     private static final long serialVersionUID = -5124209294966799740L;
 

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/CheckPasswordPolicy.java
Sat Apr 22 15:02:07 2006
@@ -27,8 +27,8 @@
 import org.apache.directory.server.changepw.exceptions.ChangePasswordException;
 import org.apache.directory.server.changepw.exceptions.ErrorType;
 import org.apache.directory.server.kerberos.shared.messages.components.Authenticator;
-import org.apache.directory.server.protocol.shared.chain.Context;
-import org.apache.directory.server.protocol.shared.chain.impl.CommandBase;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -39,15 +39,16 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class CheckPasswordPolicy extends CommandBase
+public class CheckPasswordPolicy implements IoHandlerCommand
 {
     /** the log for this class */
     private static final Logger log = LoggerFactory.getLogger( CheckPasswordPolicy.class
);
 
+    private String contextKey = "context";
 
-    public boolean execute( Context context ) throws Exception
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
-        ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+        ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
 
         ChangePasswordConfiguration config = changepwContext.getConfig();
         Authenticator authenticator = changepwContext.getAuthenticator();
@@ -62,7 +63,7 @@
 
         if ( isValid( username, password, passwordLength, categoryCount, tokenSize ) )
         {
-            return CONTINUE_CHAIN;
+            next.execute( session, message );
         }
 
         String explanation = buildErrorMessage( username, password, passwordLength, categoryCount,
tokenSize );
@@ -211,5 +212,11 @@
         }
 
         return sb.toString();
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ConfigureChangePasswordChain.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ConfigureChangePasswordChain.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ConfigureChangePasswordChain.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ConfigureChangePasswordChain.java
Sat Apr 22 15:02:07 2006
@@ -20,23 +20,30 @@
 import org.apache.directory.server.kerberos.shared.replay.InMemoryReplayCache;
 import org.apache.directory.server.kerberos.shared.replay.ReplayCache;
 import org.apache.directory.server.kerberos.shared.service.LockBox;
-import org.apache.directory.server.protocol.shared.chain.Context;
-import org.apache.directory.server.protocol.shared.chain.impl.CommandBase;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 
 
-public class ConfigureChangePasswordChain extends CommandBase
+public class ConfigureChangePasswordChain implements IoHandlerCommand
 {
     private static final ReplayCache replayCache = new InMemoryReplayCache();
     private static final LockBox lockBox = new LockBox();
 
+    private String contextKey = "context";
 
-    public boolean execute( Context context ) throws Exception
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
-        ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+        ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
 
         changepwContext.setReplayCache( replayCache );
         changepwContext.setLockBox( lockBox );
 
-        return CONTINUE_CHAIN;
+        next.execute( session, message );
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ExtractPassword.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ExtractPassword.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ExtractPassword.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ExtractPassword.java
Sat Apr 22 15:02:07 2006
@@ -31,21 +31,22 @@
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.service.LockBox;
-import org.apache.directory.server.protocol.shared.chain.Context;
-import org.apache.directory.server.protocol.shared.chain.impl.CommandBase;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-public class ExtractPassword extends CommandBase
+public class ExtractPassword implements IoHandlerCommand
 {
     /** the log for this class */
     private static final Logger log = LoggerFactory.getLogger( ExtractPassword.class );
 
+    private String contextKey = "context";
 
-    public boolean execute( Context context ) throws Exception
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
-        ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+        ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
 
         ChangePasswordRequest request = ( ChangePasswordRequest ) changepwContext.getRequest();
         Authenticator authenticator = changepwContext.getAuthenticator();
@@ -100,6 +101,12 @@
             throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR );
         }
 
-        return CONTINUE_CHAIN;
+        next.execute( session, message );
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/GetAuthHeader.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/GetAuthHeader.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/GetAuthHeader.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/GetAuthHeader.java
Sat Apr 22 15:02:07 2006
@@ -20,18 +20,20 @@
 import org.apache.directory.server.changepw.messages.ChangePasswordRequest;
 import org.apache.directory.server.kerberos.shared.messages.ApplicationRequest;
 import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
-import org.apache.directory.server.protocol.shared.chain.Context;
-import org.apache.directory.server.protocol.shared.chain.impl.CommandBase;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 
 
 /*
  * differs from the TGS getAuthHeader by not verifying the presence of TGS_REQ
  */
-public class GetAuthHeader extends CommandBase
+public class GetAuthHeader implements IoHandlerCommand
 {
-    public boolean execute( Context context ) throws Exception
+    private String contextKey = "context";
+
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
-        ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+        ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
         ChangePasswordRequest request = ( ChangePasswordRequest ) changepwContext.getRequest();
 
         ApplicationRequest authHeader = request.getAuthHeader();
@@ -40,6 +42,12 @@
         changepwContext.setAuthHeader( authHeader );
         changepwContext.setTicket( ticket );
 
-        return CONTINUE_CHAIN;
+        next.execute( session, message );
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/GetServerEntry.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/GetServerEntry.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/GetServerEntry.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/GetServerEntry.java
Sat Apr 22 15:02:07 2006
@@ -22,20 +22,28 @@
 import org.apache.directory.server.kerberos.shared.exceptions.ErrorType;
 import org.apache.directory.server.kerberos.shared.service.GetPrincipalStoreEntry;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
-import org.apache.directory.server.protocol.shared.chain.Context;
+import org.apache.mina.common.IoSession;
 
 
 public class GetServerEntry extends GetPrincipalStoreEntry
 {
-    public boolean execute( Context context ) throws Exception
+    private String contextKey = "context";
+
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
-        ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+        ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
 
         KerberosPrincipal principal = changepwContext.getTicket().getServerPrincipal();
         PrincipalStore store = changepwContext.getStore();
 
         changepwContext.setServerEntry( getEntry( principal, store, ErrorType.KDC_ERR_S_PRINCIPAL_UNKNOWN
) );
 
-        return CONTINUE_CHAIN;
+        next.execute( session, message );
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorContext.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorContext.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorContext.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorContext.java
Sat Apr 22 15:02:07 2006
@@ -29,25 +29,26 @@
 import org.apache.directory.server.kerberos.shared.replay.ReplayCache;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStoreEntry;
-import org.apache.directory.server.protocol.shared.chain.Context;
-import org.apache.directory.server.protocol.shared.chain.impl.CommandBase;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-public class MonitorContext extends CommandBase
+public class MonitorContext implements IoHandlerCommand
 {
     /** the log for this class */
     private static final Logger log = LoggerFactory.getLogger( MonitorContext.class );
 
+    private String contextKey = "context";
 
-    public boolean execute( Context context ) throws Exception
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
         if ( log.isDebugEnabled() )
         {
             try
             {
-                ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+                ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
 
                 PrincipalStore store = changepwContext.getStore();
                 ApplicationRequest authHeader = changepwContext.getAuthHeader();
@@ -102,6 +103,12 @@
             }
         }
 
-        return CONTINUE_CHAIN;
+        next.execute( session, message );
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorReply.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorReply.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorReply.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorReply.java
Sat Apr 22 15:02:07 2006
@@ -20,25 +20,26 @@
 import org.apache.directory.server.changepw.messages.ChangePasswordReply;
 import org.apache.directory.server.kerberos.shared.messages.application.ApplicationReply;
 import org.apache.directory.server.kerberos.shared.messages.application.PrivateMessage;
-import org.apache.directory.server.protocol.shared.chain.Context;
-import org.apache.directory.server.protocol.shared.chain.impl.CommandBase;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-public class MonitorReply extends CommandBase
+public class MonitorReply implements IoHandlerCommand
 {
     /** the log for this class */
     private static final Logger log = LoggerFactory.getLogger( MonitorReply.class );
 
+    private String contextKey = "context";
 
-    public boolean execute( Context context ) throws Exception
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
         if ( log.isDebugEnabled() )
         {
             try
             {
-                ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+                ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
 
                 ChangePasswordReply reply = ( ChangePasswordReply ) changepwContext.getReply();
                 ApplicationReply appReply = reply.getApplicationReply();
@@ -58,6 +59,12 @@
             }
         }
 
-        return CONTINUE_CHAIN;
+        next.execute( session, message );
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorRequest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorRequest.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorRequest.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/MonitorRequest.java
Sat Apr 22 15:02:07 2006
@@ -18,25 +18,26 @@
 
 
 import org.apache.directory.server.changepw.messages.ChangePasswordRequest;
-import org.apache.directory.server.protocol.shared.chain.Context;
-import org.apache.directory.server.protocol.shared.chain.impl.CommandBase;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-public class MonitorRequest extends CommandBase
+public class MonitorRequest implements IoHandlerCommand
 {
     /** the log for this class */
     private static final Logger log = LoggerFactory.getLogger( MonitorRequest.class );
 
+    private String contextKey = "context";
 
-    public boolean execute( Context context ) throws Exception
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
         if ( log.isDebugEnabled() )
         {
             try
             {
-                ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+                ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
 
                 ChangePasswordRequest request = ( ChangePasswordRequest ) changepwContext.getRequest();
                 short authHeaderLength = request.getAuthHeaderLength();
@@ -58,6 +59,12 @@
             }
         }
 
-        return CONTINUE_CHAIN;
+        next.execute( session, message );
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ProcessPasswordChange.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ProcessPasswordChange.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ProcessPasswordChange.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/ProcessPasswordChange.java
Sat Apr 22 15:02:07 2006
@@ -24,21 +24,22 @@
 import org.apache.directory.server.changepw.exceptions.ErrorType;
 import org.apache.directory.server.kerberos.shared.messages.components.Authenticator;
 import org.apache.directory.server.kerberos.shared.store.PrincipalStore;
-import org.apache.directory.server.protocol.shared.chain.Context;
-import org.apache.directory.server.protocol.shared.chain.impl.CommandBase;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.handler.chain.IoHandlerCommand;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-public class ProcessPasswordChange extends CommandBase
+public class ProcessPasswordChange implements IoHandlerCommand
 {
     /** the log for this class */
     private static final Logger log = LoggerFactory.getLogger( ProcessPasswordChange.class
);
 
+    private String contextKey = "context";
 
-    public boolean execute( Context context ) throws Exception
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
-        ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+        ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
 
         PrincipalStore store = changepwContext.getStore();
         Authenticator authenticator = changepwContext.getAuthenticator();
@@ -64,6 +65,12 @@
             throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_HARDERROR );
         }
 
-        return CONTINUE_CHAIN;
+        next.execute( session, message );
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicket.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicket.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicket.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicket.java
Sat Apr 22 15:02:07 2006
@@ -22,14 +22,16 @@
 import org.apache.directory.server.changepw.ChangePasswordConfiguration;
 import org.apache.directory.server.kerberos.shared.messages.components.Ticket;
 import org.apache.directory.server.kerberos.shared.service.VerifyTicket;
-import org.apache.directory.server.protocol.shared.chain.Context;
+import org.apache.mina.common.IoSession;
 
 
 public class VerifyServiceTicket extends VerifyTicket
 {
-    public boolean execute( Context context ) throws Exception
+    private String contextKey = "context";
+
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
-        ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+        ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
         ChangePasswordConfiguration config = changepwContext.getConfig();
         Ticket ticket = changepwContext.getTicket();
         String primaryRealm = config.getPrimaryRealm();
@@ -37,6 +39,12 @@
 
         verifyTicket( ticket, primaryRealm, changepwPrincipal );
 
-        return CONTINUE_CHAIN;
+        next.execute( session, message );
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }

Modified: directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicketAuthHeader.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicketAuthHeader.java?rev=396169&r1=396168&r2=396169&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicketAuthHeader.java
(original)
+++ directory/trunks/apacheds/protocol-changepw/src/main/java/org/apache/directory/server/changepw/service/VerifyServiceTicketAuthHeader.java
Sat Apr 22 15:02:07 2006
@@ -26,14 +26,16 @@
 import org.apache.directory.server.kerberos.shared.replay.ReplayCache;
 import org.apache.directory.server.kerberos.shared.service.LockBox;
 import org.apache.directory.server.kerberos.shared.service.VerifyAuthHeader;
-import org.apache.directory.server.protocol.shared.chain.Context;
+import org.apache.mina.common.IoSession;
 
 
 public class VerifyServiceTicketAuthHeader extends VerifyAuthHeader
 {
-    public boolean execute( Context context ) throws Exception
+    private String contextKey = "context";
+
+    public void execute( NextCommand next, IoSession session, Object message ) throws Exception
     {
-        ChangePasswordContext changepwContext = ( ChangePasswordContext ) context;
+        ChangePasswordContext changepwContext = ( ChangePasswordContext ) session.getAttribute(
getContextKey() );
 
         ApplicationRequest authHeader = changepwContext.getAuthHeader();
         Ticket ticket = changepwContext.getTicket();
@@ -49,6 +51,12 @@
 
         changepwContext.setAuthenticator( authenticator );
 
-        return CONTINUE_CHAIN;
+        next.execute( session, message );
+    }
+
+
+    public String getContextKey()
+    {
+        return ( this.contextKey );
     }
 }



Mime
View raw message