You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/05/05 07:10:23 UTC

svn commit: r399966 - in /directory/branches/apacheds/1.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication: AuthenticationServiceChain.java VerifyPolicy.java

Author: akarasulu
Date: Thu May  4 22:10:23 2006
New Revision: 399966

URL: http://svn.apache.org/viewcvs?rev=399966&view=rev
Log:
adding verify policy command to authentication chain

Added:
    directory/branches/apacheds/1.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/VerifyPolicy.java
Modified:
    directory/branches/apacheds/1.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationServiceChain.java

Modified: directory/branches/apacheds/1.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationServiceChain.java
URL: http://svn.apache.org/viewcvs/directory/branches/apacheds/1.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationServiceChain.java?rev=399966&r1=399965&r2=399966&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationServiceChain.java (original)
+++ directory/branches/apacheds/1.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/AuthenticationServiceChain.java Thu May  4 22:10:23 2006
@@ -31,6 +31,7 @@
         addCommand( new MonitorRequest() );
         addCommand( new ConfigureAuthenticationChain() );
         addCommand( new GetClientEntry() );
+        addCommand( new VerifyPolicy() );
         addCommand( new PreAuthenticationChain() );
         addCommand( new GetServerEntry() );
         addCommand( new GetSessionKey() );

Added: directory/branches/apacheds/1.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/VerifyPolicy.java
URL: http://svn.apache.org/viewcvs/directory/branches/apacheds/1.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/VerifyPolicy.java?rev=399966&view=auto
==============================================================================
--- directory/branches/apacheds/1.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/VerifyPolicy.java (added)
+++ directory/branches/apacheds/1.0/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/authentication/VerifyPolicy.java Thu May  4 22:10:23 2006
@@ -0,0 +1,41 @@
+package org.apache.directory.server.kerberos.kdc.authentication;
+
+import java.util.Date;
+
+import org.apache.directory.server.kerberos.shared.exceptions.ErrorType;
+import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
+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.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+
+public class VerifyPolicy extends CommandBase
+{
+    /** the log for this class */
+//    private static final Logger log = LoggerFactory.getLogger( VerifyPolicy.class );
+
+
+    public boolean execute( Context context ) throws Exception
+    {
+        AuthenticationContext authContext = ( AuthenticationContext ) context;
+        PrincipalStoreEntry entry = authContext.getClientEntry();
+
+        if ( entry.isDisabled() )
+        {
+            throw new KerberosException( ErrorType.KDC_ERR_CLIENT_REVOKED );
+        }
+
+        if ( entry.isLockedOut() )
+        {
+            throw new KerberosException( ErrorType.KDC_ERR_CLIENT_REVOKED );
+        }
+
+        if ( entry.getExpiration().getTime() < new Date().getTime() )
+        {
+            throw new KerberosException( ErrorType.KDC_ERR_CLIENT_REVOKED );
+        }
+
+        return CONTINUE_CHAIN;
+    }
+}
\ No newline at end of file