directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r731312 - /directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
Date Sun, 04 Jan 2009 18:27:57 GMT
Author: kayyagari
Date: Sun Jan  4 10:27:57 2009
New Revision: 731312

URL: http://svn.apache.org/viewvc?rev=731312&view=rev
Log:
a new extended operation for generating and assigning a digital certificate to an entry

Added:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java

Added: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java?rev=731312&view=auto
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
(added)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
Sun Jan  4 10:27:57 2009
@@ -0,0 +1,91 @@
+/*
+ *  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.server.ldap.handlers.extended;
+
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.directory.server.core.entry.ClonedServerEntry;
+import org.apache.directory.server.core.security.TlsKeyGenerator;
+import org.apache.directory.server.ldap.ExtendedOperationHandler;
+import org.apache.directory.server.ldap.LdapService;
+import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.shared.ldap.message.ExtendedRequest;
+import org.apache.directory.shared.ldap.message.extended.CertGenerationRequest;
+import org.apache.directory.shared.ldap.message.extended.CertGenerationResponse;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An extended handler for digital certificate generation
+ * 
+ * @org.apache.xbean.XBean
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CertGenerationRequestHandler implements ExtendedOperationHandler
+{
+
+    private static final Set<String> EXTENSION_OIDS;
+
+    private static final Logger LOG = LoggerFactory.getLogger( CertGenerationRequestHandler.class
);
+
+    static
+    {
+        Set<String> set = new HashSet<String>( 2 );
+        set.add( CertGenerationRequest.EXTENSION_OID );
+        set.add( CertGenerationResponse.EXTENSION_OID );
+        EXTENSION_OIDS = Collections.unmodifiableSet( set );
+    }
+
+
+    public String getOid()
+    {
+        return CertGenerationRequest.EXTENSION_OID;
+    }
+
+
+    public Set<String> getExtensionOids()
+    {
+        return EXTENSION_OIDS;
+    }
+
+
+    public void handleExtendedOperation( LdapSession session, ExtendedRequest req ) throws
Exception
+    {
+        CertGenerationRequest certGenReq = ( CertGenerationRequest ) req;
+        
+        ClonedServerEntry entry = session.getCoreSession().lookup( new LdapDN( certGenReq.getTargetDN()
) );
+        if( entry != null )
+        {
+            TlsKeyGenerator.addKeyPair( entry.getOriginalEntry(), certGenReq.getIssuerDN(),
certGenReq.getSubjectDN(), certGenReq.getKeyAlgorithm() );
+        }
+    }
+
+
+    public void setLdapServer( LdapService ldapService )
+    {
+    }
+
+}



Mime
View raw message