directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r541868 - in /directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory: ./ client/ client/kerberos/ client/kerberos/protocol/
Date Sat, 26 May 2007 07:22:59 GMT
Author: erodriguez
Date: Sat May 26 00:22:58 2007
New Revision: 541868

URL: http://svn.apache.org/viewvc?view=rev&rev=541868
Log:
First pass at Kerberos client:
o  Does retrieve ticket-granting tickets (TGT).
o  Does not support any configuration.

Added:
    directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/
    directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/
    directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/
    directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/GetTicketGrantingTicket.java
  (with props)
    directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/package-info.java
  (with props)
    directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/
    directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientCodecFactory.java
  (with props)
    directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientDecoder.java
  (with props)
    directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientEncoder.java
  (with props)
    directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientHandler.java
  (with props)
    directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/package-info.java
  (with props)

Added: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/GetTicketGrantingTicket.java
URL: http://svn.apache.org/viewvc/directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/GetTicketGrantingTicket.java?view=auto&rev=541868
==============================================================================
--- directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/GetTicketGrantingTicket.java
(added)
+++ directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/GetTicketGrantingTicket.java
Sat May 26 00:22:58 2007
@@ -0,0 +1,237 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.client.kerberos;
+
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
+import javax.security.auth.kerberos.KerberosKey;
+import javax.security.auth.kerberos.KerberosPrincipal;
+
+import org.apache.directory.client.kerberos.protocol.KerberosClientCodecFactory;
+import org.apache.directory.client.kerberos.protocol.KerberosClientHandler;
+import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
+import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
+import org.apache.directory.server.kerberos.shared.crypto.encryption.KeyUsage;
+import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
+import org.apache.directory.server.kerberos.shared.io.encoder.EncryptedDataEncoder;
+import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
+import org.apache.directory.server.kerberos.shared.messages.MessageType;
+import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
+import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStamp;
+import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
+import org.apache.directory.server.kerberos.shared.messages.value.KdcOptions;
+import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
+import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationData;
+import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataModifier;
+import org.apache.directory.server.kerberos.shared.messages.value.PreAuthenticationDataType;
+import org.apache.directory.server.kerberos.shared.messages.value.PrincipalName;
+import org.apache.directory.server.kerberos.shared.messages.value.RequestBody;
+import org.apache.directory.server.kerberos.shared.messages.value.RequestBodyModifier;
+import org.apache.mina.common.ConnectFuture;
+import org.apache.mina.common.IoConnector;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.filter.LoggingFilter;
+import org.apache.mina.filter.codec.ProtocolCodecFilter;
+import org.apache.mina.transport.socket.nio.DatagramConnector;
+
+
+/**
+ * A command-line client for requesting Kerberos tickets.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class GetTicketGrantingTicket
+{
+    private static final boolean PA_ENC_TIMESTAMP_REQUIRED = true;
+
+    /** The remote Kerberos server name. */
+    private String hostname = "localhost";
+
+    /** The remote Kerberos port number. */
+    private static final int REMOTE_PORT = 88;
+
+    /** One day in milliseconds, used for default end time. */
+    private static final int ONE_DAY = 86400000;
+
+    /** One week in milliseconds, used for default renewal period. */
+    private static final int ONE_WEEK = 86400000 * 7;
+
+
+    /**
+     * Get a Ticket-Granting Ticket.
+     * 
+     * @param args
+     * @throws Exception
+     */
+    public static void main( String[] args ) throws Exception
+    {
+        new GetTicketGrantingTicket().go();
+    }
+
+
+    /**
+     * Make the request for a Ticket-Granting Ticket.
+     */
+    public void go()
+    {
+        IoConnector connector = new DatagramConnector();
+
+        connector.getFilterChain()
+            .addLast( "codec", new ProtocolCodecFilter( KerberosClientCodecFactory.getInstance()
) );
+        connector.getFilterChain().addLast( "logger", new LoggingFilter() );
+
+        ConnectFuture future = connector.connect( new InetSocketAddress( hostname, REMOTE_PORT
),
+            new KerberosClientHandler() );
+
+        future.join();
+
+        IoSession session = future.getSession();
+
+        try
+        {
+            KdcRequest request = getKdcRequest();
+            session.write( request );
+        }
+        catch ( Exception e )
+        {
+            e.printStackTrace();
+        }
+
+        session.getCloseFuture().join();
+    }
+
+
+    /**
+     * Create a KdcRequest, suitable for requesting a Ticket-Granting Ticket (TGT).
+     * 
+     * Based on RFC 1510, A.1.  KRB_AS_REQ generation
+     */
+    private KdcRequest getKdcRequest() throws IOException
+    {
+        RequestBodyModifier modifier = new RequestBodyModifier();
+
+        KerberosPrincipal principal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
+        KerberosKey kerberosKey = new KerberosKey( principal, "s3crEt".toCharArray(), "DES"
);
+
+        KdcOptions kdcOptions = getKdcOptions();
+
+        int pvno = 5;
+        MessageType messageType = MessageType.KRB_AS_REQ;
+
+        PreAuthenticationData[] paData = new PreAuthenticationData[1];
+
+        if ( PA_ENC_TIMESTAMP_REQUIRED )
+        {
+            CipherTextHandler lockBox = new CipherTextHandler();
+            EncryptionKey key = new EncryptionKey( EncryptionType.DES_CBC_MD5, kerberosKey.getEncoded()
);
+
+            KerberosTime timeStamp = new KerberosTime();
+            EncryptedTimeStamp encryptedTimeStamp = new EncryptedTimeStamp( timeStamp, 0
);
+
+            EncryptedData encryptedData = null;
+
+            try
+            {
+                encryptedData = lockBox.seal( key, encryptedTimeStamp, KeyUsage.NUMBER1 );
+            }
+            catch ( KerberosException ke )
+            {
+                ke.printStackTrace();
+            }
+
+            byte[] encodedEncryptedData = EncryptedDataEncoder.encode( encryptedData );
+
+            PreAuthenticationDataModifier preAuth = new PreAuthenticationDataModifier();
+            preAuth.setDataType( PreAuthenticationDataType.PA_ENC_TIMESTAMP );
+            preAuth.setDataValue( encodedEncryptedData );
+
+            paData[0] = preAuth.getPreAuthenticationData();
+        }
+
+        PrincipalName clientName = new PrincipalName( principal.getName(), principal.getNameType()
);
+        modifier.setClientName( clientName );
+        modifier.setRealm( principal.getRealm() );
+
+        PrincipalName serverName = new PrincipalName( "krbtgt/EXAMPLE.COM", principal.getNameType()
);
+        modifier.setServerName( serverName );
+
+        if ( kdcOptions.get( KdcOptions.POSTDATED ) )
+        {
+            // body.from := requested starting time;
+        }
+
+        KerberosTime endTime = new KerberosTime( System.currentTimeMillis() + ONE_DAY );
+        modifier.setTill( endTime );
+
+        if ( kdcOptions.get( KdcOptions.RENEWABLE ) )
+        {
+            KerberosTime rTime = new KerberosTime( System.currentTimeMillis() + ONE_WEEK
);
+            modifier.setRtime( rTime );
+        }
+
+        modifier.setKdcOptions( kdcOptions );
+
+        modifier.setNonce( getNonce() );
+
+        EncryptionType[] encryptionTypes = new EncryptionType[1];
+        encryptionTypes[0] = EncryptionType.DES_CBC_MD5;
+
+        modifier.setEType( encryptionTypes );
+
+        /*
+         if ( user supplied addresses )
+         {
+         body.addresses := user's addresses;
+         }
+         */
+
+        /*
+         omit body.enc-authorization-data;
+         */
+
+        RequestBody requestBody = modifier.getRequestBody();
+
+        return new KdcRequest( pvno, messageType, paData, requestBody );
+    }
+
+
+    private int getNonce()
+    {
+        return 7777;
+    }
+
+
+    private KdcOptions getKdcOptions()
+    {
+        /*
+         Forwardable Ticket false
+         Forwarded Ticket false
+         Proxiable Ticket false
+         Proxy Ticket false
+         Postdated Ticket false
+         Renewable Ticket false
+         Initial Ticket false
+         */
+        return new KdcOptions();
+    }
+}

Propchange: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/GetTicketGrantingTicket.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/package-info.java
URL: http://svn.apache.org/viewvc/directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/package-info.java?view=auto&rev=541868
==============================================================================
--- directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/package-info.java
(added)
+++ directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/package-info.java
Sat May 26 00:22:58 2007
@@ -0,0 +1,10 @@
+/**
+ * Provides the entry point for the Kerberos client.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+
+package org.apache.directory.client.kerberos;
+
+

Propchange: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientCodecFactory.java
URL: http://svn.apache.org/viewvc/directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientCodecFactory.java?view=auto&rev=541868
==============================================================================
--- directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientCodecFactory.java
(added)
+++ directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientCodecFactory.java
Sat May 26 00:22:58 2007
@@ -0,0 +1,66 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.client.kerberos.protocol;
+
+
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 540371 $, $Date: 2007-05-21 17:00:43 -0700 (Mon, 21 May 2007) $
+ */
+public class KerberosClientCodecFactory implements ProtocolCodecFactory
+{
+    private static final KerberosClientCodecFactory INSTANCE = new KerberosClientCodecFactory();
+
+
+    /**
+     * Returns the singleton {@link KerberosClientCodecFactory}.
+     *
+     * @return The singleton {@link KerberosClientCodecFactory}.
+     */
+    public static KerberosClientCodecFactory getInstance()
+    {
+        return INSTANCE;
+    }
+
+
+    private KerberosClientCodecFactory()
+    {
+        // Private constructor prevents instantiation outside this class.
+    }
+
+
+    public ProtocolEncoder getEncoder()
+    {
+        // Create a new encoder.
+        return new KerberosClientEncoder();
+    }
+
+
+    public ProtocolDecoder getDecoder()
+    {
+        // Create a new decoder.
+        return new KerberosClientDecoder();
+    }
+}

Propchange: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientCodecFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientDecoder.java
URL: http://svn.apache.org/viewvc/directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientDecoder.java?view=auto&rev=541868
==============================================================================
--- directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientDecoder.java
(added)
+++ directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientDecoder.java
Sat May 26 00:22:58 2007
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.client.kerberos.protocol;
+
+
+import java.io.IOException;
+
+import org.apache.directory.server.kerberos.shared.io.decoder.KdcReplyDecoder;
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolDecoderOutput;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 502788 $, $Date: 2007-02-02 15:11:29 -0800 (Fri, 02 Feb 2007) $
+ */
+public class KerberosClientDecoder implements ProtocolDecoder
+{
+    private KdcReplyDecoder decoder = new KdcReplyDecoder();
+
+
+    public void decode( IoSession session, ByteBuffer in, ProtocolDecoderOutput out ) throws
IOException
+    {
+        out.write( decoder.decode( in.buf() ) );
+    }
+
+
+    public void dispose( IoSession session ) throws Exception
+    {
+        // Unused interface method.
+    }
+
+
+    public void finishDecode( IoSession session, ProtocolDecoderOutput out ) throws Exception
+    {
+        // Unused interface method.
+    }
+}

Propchange: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientDecoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientEncoder.java
URL: http://svn.apache.org/viewvc/directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientEncoder.java?view=auto&rev=541868
==============================================================================
--- directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientEncoder.java
(added)
+++ directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientEncoder.java
Sat May 26 00:22:58 2007
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.client.kerberos.protocol;
+
+
+import java.io.IOException;
+
+import org.apache.directory.server.kerberos.shared.io.encoder.KdcRequestEncoder;
+import org.apache.directory.server.kerberos.shared.messages.KdcRequest;
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+import org.apache.mina.filter.codec.ProtocolEncoderOutput;
+
+
+/**
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 502788 $, $Date: 2007-02-02 15:11:29 -0800 (Fri, 02 Feb 2007) $
+ */
+public class KerberosClientEncoder implements ProtocolEncoder
+{
+    private KdcRequestEncoder requestEncoder = new KdcRequestEncoder();
+
+
+    public void encode( IoSession session, Object message, ProtocolEncoderOutput out ) throws
IOException
+    {
+        ByteBuffer buf = ByteBuffer.allocate( 1024 );
+
+        requestEncoder.encode( ( KdcRequest ) message, buf.buf() );
+
+        buf.flip();
+
+        out.write( buf );
+    }
+
+
+    public void dispose( IoSession arg0 ) throws Exception
+    {
+        // Unused interface method.
+    }
+}

Propchange: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientEncoder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientHandler.java
URL: http://svn.apache.org/viewvc/directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientHandler.java?view=auto&rev=541868
==============================================================================
--- directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientHandler.java
(added)
+++ directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientHandler.java
Sat May 26 00:22:58 2007
@@ -0,0 +1,117 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.client.kerberos.protocol;
+
+
+import org.apache.directory.server.kerberos.shared.messages.KdcReply;
+import org.apache.mina.common.IdleStatus;
+import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoHandlerAdapter;
+import org.apache.mina.common.IoSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * An {@link IoHandler} implementation for a Kerberos client.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class KerberosClientHandler extends IoHandlerAdapter
+{
+    private static final Logger log = LoggerFactory.getLogger( KerberosClientHandler.class
);
+
+
+    public void sessionCreated( IoSession session ) throws Exception
+    {
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( session.getRemoteAddress() + " CREATED" );
+        }
+    }
+
+
+    public void sessionOpened( IoSession session )
+    {
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( session.getRemoteAddress() + " OPENED" );
+        }
+    }
+
+
+    public void sessionClosed( IoSession session )
+    {
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( session.getRemoteAddress() + " CLOSED" );
+        }
+    }
+
+
+    public void sessionIdle( IoSession session, IdleStatus status )
+    {
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( session.getRemoteAddress() + " IDLE(" + status + ")" );
+        }
+    }
+
+
+    public void messageReceived( IoSession session, Object message )
+    {
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( session.getRemoteAddress() + " RCVD: " + message );
+        }
+
+        System.out.println( session.getRemoteAddress() + " RCVD: " + message );
+
+        KdcReply reply = (KdcReply) message;
+        
+        System.out.println( reply.getClientRealm() );
+        
+        session.close();
+    }
+
+
+    public void messageSent( IoSession session, Object message )
+    {
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( session.getRemoteAddress() + " SENT: " + message );
+        }
+        
+        System.out.println( session.getRemoteAddress() + " SENT: " + message );
+    }
+
+
+    public void exceptionCaught( IoSession session, Throwable cause )
+    {
+        log.error( session.getRemoteAddress() + " EXCEPTION", cause );
+        
+        System.out.println( session.getRemoteAddress() + " EXCEPTION" );
+        
+        cause.printStackTrace();
+        
+        session.close();
+    }
+}

Propchange: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/KerberosClientHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/package-info.java
URL: http://svn.apache.org/viewvc/directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/package-info.java?view=auto&rev=541868
==============================================================================
--- directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/package-info.java
(added)
+++ directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/package-info.java
Sat May 26 00:22:58 2007
@@ -0,0 +1,11 @@
+/**
+ * Provides the {@link IoHandler} and associated {@link ProtocolCodecFactory}
+ * required to implement a Kerberos client with the MINA NIO framework.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+
+package org.apache.directory.client.kerberos.protocol;
+
+

Propchange: directory/clients/trunk/kerberos/client/src/main/java/org/apache/directory/client/kerberos/protocol/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message