|
From: <pe...@us...> - 2003-12-14 20:53:07
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/servlet
In directory sc8-pr-cvs1:/tmp/cvs-serv18638/src/java/org/neuclear/signers/servlet
Modified Files:
DemoSigningServlet.java SigningServlet.java
Log Message:
Added ServletPassPhraseAgent which uses ThreadLocal to transfer the passphrase to the signer.
Added ServletSignerFactory, which builds Signers for use within servlets based on parameters in the Servlets
Init parameters in web.xml
Updated SQLContext to use ThreadLocal
Added jakarta cactus unit tests to neuclear-commons to test the 2 new features above.
Added use of the new features in neuclear-commons to the servilets within neuclear-id and added
configuration parameters in web.xml
Index: DemoSigningServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/servlet/DemoSigningServlet.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** DemoSigningServlet.java 12 Dec 2003 19:28:03 -0000 1.13
--- DemoSigningServlet.java 14 Dec 2003 20:53:04 -0000 1.14
***************
*** 2,5 ****
--- 2,14 ----
* $Id$
* $Log$
+ * Revision 1.14 2003/12/14 20:53:04 pelle
+ * Added ServletPassPhraseAgent which uses ThreadLocal to transfer the passphrase to the signer.
+ * Added ServletSignerFactory, which builds Signers for use within servlets based on parameters in the Servlets
+ * Init parameters in web.xml
+ * Updated SQLContext to use ThreadLocal
+ * Added jakarta cactus unit tests to neuclear-commons to test the 2 new features above.
+ * Added use of the new features in neuclear-commons to the servilets within neuclear-id and added
+ * configuration parameters in web.xml
+ *
* Revision 1.13 2003/12/12 19:28:03 pelle
* All the Cactus tests now for signing servlet.
***************
*** 163,166 ****
--- 172,176 ----
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.crypto.passphraseagents.PassPhraseAgent;
+ import org.neuclear.commons.crypto.passphraseagents.ServletPassPhraseAgent;
import org.neuclear.commons.crypto.signers.Signer;
import org.neuclear.commons.crypto.signers.TestCaseSigner;
***************
*** 175,203 ****
import java.security.GeneralSecurityException;
! public final class DemoSigningServlet extends SigningServlet implements PassPhraseAgent, SingleThreadModel {
protected Signer createSigner(ServletConfig config) throws GeneralSecurityException, NeuClearException {
! passphrase = "neuclear";
! return new TestCaseSigner(this);
}
! protected synchronized void handleInputStream(InputStream is, HttpServletRequest request, HttpServletResponse response) throws IOException, NeuClearException, XMLException {
! passphrase = request.getParameter("passphrase");
super.handleInputStream(is, request, response);
! passphrase = null;
! }
!
! /**
! * Retrieve the PassPhrase for a given name/alias
! *
! * @param name
! * @return
! */
! public final char[] getPassPhrase(final String name) {
! if (passphrase == null)
! return null;
! return passphrase.toCharArray();
}
!
! private String passphrase;// Single Thread Model hack
}
--- 185,205 ----
import java.security.GeneralSecurityException;
! public final class DemoSigningServlet extends SigningServlet {
! public DemoSigningServlet(){
! agent=new ServletPassPhraseAgent();
! }
protected Signer createSigner(ServletConfig config) throws GeneralSecurityException, NeuClearException {
! agent.set("neuclear");
! final TestCaseSigner signerd = new TestCaseSigner(agent);
! agent.clear();
! return signerd;
}
! protected void handleInputStream(InputStream is, HttpServletRequest request, HttpServletResponse response) throws IOException, NeuClearException, XMLException {
! agent.setRequest(request);
super.handleInputStream(is, request, response);
! agent.clear();
}
! private final ServletPassPhraseAgent agent;
}
Index: SigningServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/signers/servlet/SigningServlet.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** SigningServlet.java 12 Dec 2003 19:28:03 -0000 1.20
--- SigningServlet.java 14 Dec 2003 20:53:04 -0000 1.21
***************
*** 2,5 ****
--- 2,14 ----
* $Id$
* $Log$
+ * Revision 1.21 2003/12/14 20:53:04 pelle
+ * Added ServletPassPhraseAgent which uses ThreadLocal to transfer the passphrase to the signer.
+ * Added ServletSignerFactory, which builds Signers for use within servlets based on parameters in the Servlets
+ * Init parameters in web.xml
+ * Updated SQLContext to use ThreadLocal
+ * Added jakarta cactus unit tests to neuclear-commons to test the 2 new features above.
+ * Added use of the new features in neuclear-commons to the servilets within neuclear-id and added
+ * configuration parameters in web.xml
+ *
* Revision 1.20 2003/12/12 19:28:03 pelle
* All the Cactus tests now for signing servlet.
***************
*** 211,218 ****
import org.neuclear.commons.crypto.Base64;
import org.neuclear.commons.crypto.passphraseagents.GuiDialogAgent;
! import org.neuclear.commons.crypto.signers.DefaultSigner;
! import org.neuclear.commons.crypto.signers.InvalidPassphraseException;
! import org.neuclear.commons.crypto.signers.NonExistingSignerException;
! import org.neuclear.commons.crypto.signers.Signer;
import org.neuclear.commons.servlets.ServletTools;
import org.neuclear.id.InvalidNamedObjectException;
--- 220,224 ----
import org.neuclear.commons.crypto.Base64;
import org.neuclear.commons.crypto.passphraseagents.GuiDialogAgent;
! import org.neuclear.commons.crypto.signers.*;
import org.neuclear.commons.servlets.ServletTools;
import org.neuclear.id.InvalidNamedObjectException;
***************
*** 233,236 ****
--- 239,243 ----
import java.io.InputStream;
import java.io.PrintWriter;
+ import java.io.FileNotFoundException;
import java.security.GeneralSecurityException;
***************
*** 256,260 ****
protected Signer createSigner(ServletConfig config) throws GeneralSecurityException, NeuClearException, IOException {
! return new DefaultSigner(new GuiDialogAgent());
}
--- 263,267 ----
protected Signer createSigner(ServletConfig config) throws GeneralSecurityException, NeuClearException, IOException {
! return ServletSignerFactory.getInstance().createSigner(config);
}
|