|
From: <pe...@us...> - 2003-12-14 20:53:07
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/auth
In directory sc8-pr-cvs1:/tmp/cvs-serv18638/src/java/org/neuclear/auth
Modified Files:
AuthenticationServlet.java
Added Files:
DemoAuthenticationServlet.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
--- NEW FILE: DemoAuthenticationServlet.java ---
package org.neuclear.auth;
import org.neuclear.commons.crypto.signers.Signer;
import org.neuclear.commons.crypto.signers.TestCaseSigner;
import org.neuclear.commons.NeuClearException;
import javax.servlet.ServletConfig;
import java.io.FileNotFoundException;
import java.security.GeneralSecurityException;
/**
* Created by IntelliJ IDEA.
* User: pelleb
* Date: Dec 12, 2003
* Time: 9:17:38 PM
* To change this template use Options | File Templates.
*/
public class DemoAuthenticationServlet extends AuthenticationServlet{
protected Signer createSigner(ServletConfig config) throws FileNotFoundException, GeneralSecurityException, NeuClearException {
return new TestCaseSigner();
}
}
Index: AuthenticationServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/auth/AuthenticationServlet.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** AuthenticationServlet.java 12 Dec 2003 21:13:16 -0000 1.8
--- AuthenticationServlet.java 14 Dec 2003 20:53:04 -0000 1.9
***************
*** 3,8 ****
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.Utility;
! import org.neuclear.commons.crypto.signers.Signer;
! import org.neuclear.commons.crypto.signers.TestCaseSigner;
import org.neuclear.commons.servlets.ServletTools;
import org.neuclear.id.builders.AuthenticationTicketBuilder;
--- 3,9 ----
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.Utility;
! import org.neuclear.commons.crypto.signers.*;
! import org.neuclear.commons.crypto.passphraseagents.*;
! import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.commons.servlets.ServletTools;
import org.neuclear.id.builders.AuthenticationTicketBuilder;
***************
*** 21,24 ****
--- 22,26 ----
import java.io.IOException;
import java.io.PrintWriter;
+ import java.io.FileNotFoundException;
import java.security.GeneralSecurityException;
***************
*** 43,48 ****
$Id$
$Log$
! Revision 1.8 2003/12/12 21:13:16 pelle
! I have now done manual testing of the SigningServlet et al and am happy releasing it to 0.8
Revision 1.7 2003/12/10 23:58:51 pelle
--- 45,56 ----
$Id$
$Log$
! Revision 1.9 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.7 2003/12/10 23:58:51 pelle
***************
*** 86,90 ****
* Time: 2:04:31 PM
*/
! public final class AuthenticationServlet extends HttpServlet {
public final void init(final ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
--- 94,98 ----
* Time: 2:04:31 PM
*/
! public class AuthenticationServlet extends HttpServlet {
public final void init(final ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
***************
*** 93,105 ****
try {
! signer = new TestCaseSigner();
} catch (NeuClearException e) {
throw new ServletException(e);
} catch (GeneralSecurityException e) {
throw new ServletException(e);
}
}
!
protected final void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
--- 101,117 ----
try {
! signer = createSigner(servletConfig);
} catch (NeuClearException e) {
throw new ServletException(e);
} catch (GeneralSecurityException e) {
throw new ServletException(e);
+ } catch (FileNotFoundException e) {
+ throw new ServletException(e);
}
}
! protected Signer createSigner(ServletConfig config) throws FileNotFoundException, GeneralSecurityException, NeuClearException {
! return ServletSignerFactory.getInstance().createSigner(config);
! }
protected final void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
***************
*** 143,147 ****
out.print(NSResolver.resolveIdentity(userns).getSigner());
out.write("\" method=\"POST\">\n ");
! out.write("<input name=\"neuclear-request\" value=\"");
out.print(XMLSecTools.encodeElementBase64(sigreq));
out.write("\" type=\"hidden\">\n ");
--- 155,159 ----
out.print(NSResolver.resolveIdentity(userns).getSigner());
out.write("\" method=\"POST\">\n ");
! out.write("<input name=\"base64xml\" value=\"");
out.print(XMLSecTools.encodeElementBase64(sigreq));
out.write("\" type=\"hidden\">\n ");
|