directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r179334 - /directory/protocol-providers/kerberos/trunk/src/java/org/apache/kerberos/protocol/KerberosProtocolHandler.java
Date Wed, 01 Jun 2005 02:20:24 GMT
Author: akarasulu
Date: Tue May 31 19:20:23 2005
New Revision: 179334

URL: http://svn.apache.org/viewcvs?rev=179334&view=rev
Log:
dos2unix file

Modified:
    directory/protocol-providers/kerberos/trunk/src/java/org/apache/kerberos/protocol/KerberosProtocolHandler.java

Modified: directory/protocol-providers/kerberos/trunk/src/java/org/apache/kerberos/protocol/KerberosProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/kerberos/trunk/src/java/org/apache/kerberos/protocol/KerberosProtocolHandler.java?rev=179334&r1=179333&r2=179334&view=diff
==============================================================================
--- directory/protocol-providers/kerberos/trunk/src/java/org/apache/kerberos/protocol/KerberosProtocolHandler.java
(original)
+++ directory/protocol-providers/kerberos/trunk/src/java/org/apache/kerberos/protocol/KerberosProtocolHandler.java
Tue May 31 19:20:23 2005
@@ -1,121 +1,121 @@
-/*
- *   Copyright 2005 The Apache Software Foundation
- *
- *   Licensed 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.kerberos.protocol;
-
-import java.io.IOException;
-
-import org.apache.kerberos.exceptions.ErrorType;
-import org.apache.kerberos.exceptions.KerberosException;
-import org.apache.kerberos.kdc.AuthenticationService;
-import org.apache.kerberos.kdc.ErrorService;
-import org.apache.kerberos.kdc.TicketGrantingService;
-import org.apache.kerberos.messages.AuthenticationReply;
-import org.apache.kerberos.messages.ErrorMessage;
-import org.apache.kerberos.messages.KdcRequest;
-import org.apache.kerberos.messages.TicketGrantReply;
-import org.apache.kerberos.service.KdcConfiguration;
-import org.apache.kerberos.store.PrincipalStore;
-import org.apache.mina.common.IdleStatus;
-import org.apache.mina.protocol.ProtocolHandler;
-import org.apache.mina.protocol.ProtocolSession;
-
-
-public class KerberosProtocolHandler implements ProtocolHandler
-{
-	private AuthenticationService authService;
-	private TicketGrantingService tgsService;
-	private ErrorService          errorService;
-	
-	public KerberosProtocolHandler( KdcConfiguration config, PrincipalStore store )
-    {
-		errorService = new ErrorService( config );
-		authService  = new AuthenticationService( config, store );
-		tgsService   = new TicketGrantingService( config, store );
-	}
-
-    public void sessionOpened( ProtocolSession session )
-    {
-        System.out.println( session.getRemoteAddress() + " OPENED" );
-    }
-
-    public void sessionClosed( ProtocolSession session )
-    {
-        System.out.println( session.getRemoteAddress() + " CLOSED" );
-    }
-
-    public void sessionIdle( ProtocolSession session, IdleStatus status )
-    {
-        System.out.println( session.getRemoteAddress() + " IDLE(" + status + ")" );
-    }
-
-    public void exceptionCaught( ProtocolSession session, Throwable cause )
-    {
-        System.out.println( session.getRemoteAddress() + " EXCEPTION" );
-        cause.printStackTrace( System.out );
-
-        session.close();
-    }
-
-    public void messageReceived( ProtocolSession session, Object message )
-    {
-        System.out.println( session.getRemoteAddress() + " RCVD: " + message );
-        
-		try
-		{
-			KdcRequest request = (KdcRequest)message;
-			
-			int messageType = request.getMessageType().getOrdinal();
-			
-			switch ( messageType )
-			{
-				case 10:
-					AuthenticationReply authReply = authService.getReplyFor( request );
-					session.write( authReply );
-					break;
-				
-				case 12:
-					TicketGrantReply ticketReply = tgsService.getReplyFor( request );
-					session.write( ticketReply );
-		    		break;
-		    		
-		    	case 11:
-		    	case 13:
-		    		throw new KerberosException( ErrorType.KRB_AP_ERR_BADDIRECTION );
-		    		
-				default:
-					throw new KerberosException( ErrorType.KRB_AP_ERR_MSG_TYPE );
-			}
-		}
-		catch ( KerberosException ke )
-		{
-			System.out.println( "Returning error message:  " + ke.getMessage() );
-			ErrorMessage errorMessage = errorService.getReplyFor( ke );
-			session.write( errorMessage );
-		}
-		catch ( IOException ioe )
-		{
-			ioe.printStackTrace();
-		}
-    }
-
-    public void messageSent( ProtocolSession session, Object message )
-    {
-        System.out.println( session.getRemoteAddress() + " SENT: " + message );
-    }
-}
-
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.kerberos.protocol;
+
+import java.io.IOException;
+
+import org.apache.kerberos.exceptions.ErrorType;
+import org.apache.kerberos.exceptions.KerberosException;
+import org.apache.kerberos.kdc.AuthenticationService;
+import org.apache.kerberos.kdc.ErrorService;
+import org.apache.kerberos.kdc.TicketGrantingService;
+import org.apache.kerberos.messages.AuthenticationReply;
+import org.apache.kerberos.messages.ErrorMessage;
+import org.apache.kerberos.messages.KdcRequest;
+import org.apache.kerberos.messages.TicketGrantReply;
+import org.apache.kerberos.service.KdcConfiguration;
+import org.apache.kerberos.store.PrincipalStore;
+import org.apache.mina.common.IdleStatus;
+import org.apache.mina.protocol.ProtocolHandler;
+import org.apache.mina.protocol.ProtocolSession;
+
+
+public class KerberosProtocolHandler implements ProtocolHandler
+{
+	private AuthenticationService authService;
+	private TicketGrantingService tgsService;
+	private ErrorService          errorService;
+	
+	public KerberosProtocolHandler( KdcConfiguration config, PrincipalStore store )
+    {
+		errorService = new ErrorService( config );
+		authService  = new AuthenticationService( config, store );
+		tgsService   = new TicketGrantingService( config, store );
+	}
+
+    public void sessionOpened( ProtocolSession session )
+    {
+        System.out.println( session.getRemoteAddress() + " OPENED" );
+    }
+
+    public void sessionClosed( ProtocolSession session )
+    {
+        System.out.println( session.getRemoteAddress() + " CLOSED" );
+    }
+
+    public void sessionIdle( ProtocolSession session, IdleStatus status )
+    {
+        System.out.println( session.getRemoteAddress() + " IDLE(" + status + ")" );
+    }
+
+    public void exceptionCaught( ProtocolSession session, Throwable cause )
+    {
+        System.out.println( session.getRemoteAddress() + " EXCEPTION" );
+        cause.printStackTrace( System.out );
+
+        session.close();
+    }
+
+    public void messageReceived( ProtocolSession session, Object message )
+    {
+        System.out.println( session.getRemoteAddress() + " RCVD: " + message );
+        
+		try
+		{
+			KdcRequest request = (KdcRequest)message;
+			
+			int messageType = request.getMessageType().getOrdinal();
+			
+			switch ( messageType )
+			{
+				case 10:
+					AuthenticationReply authReply = authService.getReplyFor( request );
+					session.write( authReply );
+					break;
+				
+				case 12:
+					TicketGrantReply ticketReply = tgsService.getReplyFor( request );
+					session.write( ticketReply );
+		    		break;
+		    		
+		    	case 11:
+		    	case 13:
+		    		throw new KerberosException( ErrorType.KRB_AP_ERR_BADDIRECTION );
+		    		
+				default:
+					throw new KerberosException( ErrorType.KRB_AP_ERR_MSG_TYPE );
+			}
+		}
+		catch ( KerberosException ke )
+		{
+			System.out.println( "Returning error message:  " + ke.getMessage() );
+			ErrorMessage errorMessage = errorService.getReplyFor( ke );
+			session.write( errorMessage );
+		}
+		catch ( IOException ioe )
+		{
+			ioe.printStackTrace();
+		}
+    }
+
+    public void messageSent( ProtocolSession session, Object message )
+    {
+        System.out.println( session.getRemoteAddress() + " SENT: " + message );
+    }
+}
+



Mime
View raw message