You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by va...@apache.org on 2006/11/17 21:05:29 UTC
svn commit: r476291 [2/9] - in /geronimo/server/trunk:
applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/
applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/ca/
applications/geronimo-ca...
Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ConfirmClientCertHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ConfirmClientCertHandler.java?view=diff&rev=476291&r1=476290&r2=476291
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ConfirmClientCertHandler.java (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ConfirmClientCertHandler.java Fri Nov 17 12:05:24 2006
@@ -1,168 +1,168 @@
-/**
- *
- * 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.geronimo.console.ca;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.PublicKey;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.security.auth.x500.X500Principal;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.management.geronimo.CertificationAuthority;
-import org.apache.geronimo.util.CaUtils;
-import org.apache.geronimo.util.asn1.x509.X509Name;
-
-/**
- * Handler for Confirm Client Certificate Issue screen.
- *
- * @version $Rev$ $Date$
- */
-public class ConfirmClientCertHandler extends BaseCAHandler {
- private final static Log log = LogFactory.getLog(ConfirmClientCertHandler.class);
- public ConfirmClientCertHandler() {
- super(CONFIRM_CLIENT_CERT_MODE, "/WEB-INF/view/ca/confirmClientCert.jsp");
- }
-
- public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG, "subject", "publickey", "algorithm", "validFrom", "validTo", "sNo", "pkcs10certreq", "requestId"};
- for(int i = 0; i < params.length; ++i) {
- String value = request.getParameter(params[i]);
- if(value != null) response.setRenderParameter(params[i], value);
- }
- return getMode();
- }
-
- public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG, "subject", "publickey", "algorithm", "validFrom", "validTo", "sNo", "pkcs10certreq", "requestId"};
- for(int i = 0; i < params.length; ++i) {
- String value = request.getParameter(params[i]);
- if(value != null) request.setAttribute(params[i], value);
- }
- }
-
- public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String errorMsg = null;
- try {
- CertificationAuthority ca = getCertificationAuthority(request);
- if(ca == null) {
- throw new Exception("CA is not running. CA may not have been initialized!!");
- }
- BigInteger sNo = new BigInteger(request.getParameter("sNo"));
- if(ca.isCertificateIssued(sNo)) {
- // A certificate with the serial number has already been issued.
- // This may happen if the user clicks on "Issue Certificate" button a second time
- log.warn("Second request to issue certificate with serial number'"+sNo+"'. A certificate has already been issued.");
- response.setRenderParameter("sNo", sNo.toString());
- response.setRenderParameter(INFO_MSG, "A certificate with the serial number '"+sNo+"' has already been issued. "
- +"You may be seeing this message since you have clicked on 'Issue Certificate' button a second time.");
- return VIEW_CERT_MODE;
- }
-
- X509Name subject = null;
- PublicKey publickey = null;
- // Process the CSR text to get subject details
- String pkcs10certreq = null, certreq = null;
- String challenge = null;
- String requestId = request.getParameter("requestId");
- if(requestId != null && !requestId.equals("")) {
- // Certificate request is being processed using a previously stored request in CertificateRequestStore
- String certreqText = getCertificateRequestStore(request).getRequest(requestId);
- if(certreqText.startsWith(CaUtils.CERT_REQ_HEADER)) {
- // A PKCS 10 Certificate Request
- pkcs10certreq = certreqText;
- } else {
- // Possibly a CSR received through web browser
- certreq = certreqText;
- }
- } else {
- // No request id is found. Get the PKCS10 request submitted through form input
- pkcs10certreq = request.getParameter("pkcs10certreq");
- }
-
- if(pkcs10certreq != null && !"".equals(pkcs10certreq)) {
- // Process PKCS 10 Certificate Request text to get Subject name and public-key
- Map certReqMap = CaUtils.processPKCS10Request(pkcs10certreq);
- subject = (X509Name) certReqMap.get(CaUtils.CERT_REQ_SUBJECT);
- publickey = (PublicKey) certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ);
- } else {
- // This is a custom request containing SPKAC and X509Name attributes received through web browser
- Properties csrProps = new Properties();
- csrProps.load(new ByteArrayInputStream(certreq.getBytes()));
- String spkac = csrProps.getProperty("SPKAC");
- String cn = csrProps.getProperty("CN");
- String ou = csrProps.getProperty("OU");
- String o = csrProps.getProperty("O");
- String l = csrProps.getProperty("L");
- String st = csrProps.getProperty("ST");
- String c = csrProps.getProperty("C");
- subject = CaUtils.getX509Name(cn, ou, o, l, st, c);
- Map certReqMap = CaUtils.processSPKAC(spkac);
- publickey = (PublicKey) certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ);
- challenge = (String) certReqMap.get(CaUtils.PKAC_CHALLENGE);
- }
-
- // Dates have already been validated in the previous screen
- String validFrom = request.getParameter("validFrom");
- String validTo = request.getParameter("validTo");
- DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
- Date validFromDate = df.parse(validFrom);
- Date validToDate = df.parse(validTo);
- String algorithm = request.getParameter("algorithm");
- // Issue certificate
- ca.issueCertificate(new X500Principal(subject.getEncoded()), publickey, sNo, validFromDate, validToDate, algorithm);
- // Store the challenge phrase against the issued certificate serial number
- if(challenge != null && !challenge.equals("")) {
- getCertificateStore(request).setCertificateChallenge(sNo, challenge);
- }
-
- if(requestId != null && !requestId.equals("")) {
- // This request was processed using a requestId from CertificateRequestStore. Delete the fulfilled request.
- getCertificateRequestStore(request).setRequestFulfilled(requestId, sNo);
- // The confirmation page will show a link to the "Requests to be fulfilled" page.
- response.setRenderParameter("linkToListRequests", "true");
- }
-
- // Set the serial number and forward to view certificate page
- response.setRenderParameter("sNo", sNo.toString());
- response.setRenderParameter(INFO_MSG, "Certificate Issued successfully. This Certificate details can also be viewed using the serial number '"
- +sNo+"' with the 'View Issued Certificate' link provided in the CA home screen.");
- log.info("Certificate with serial number '"+sNo+"' issued to "+subject);
- return VIEW_CERT_MODE;
- } catch(Exception e) {
- errorMsg = e.toString();
- log.error("Errors in issuing certificate.", e);
- }
- // An error occurred. Go back to previous screen to let the user correct the errors.
- response.setRenderParameter(ERROR_MSG, errorMsg);
- return CERT_REQ_DETAILS_MODE+BEFORE_ACTION;
- }
-}
+/**
+ *
+ * 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.geronimo.console.ca;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.security.PublicKey;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.security.auth.x500.X500Principal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.management.geronimo.CertificationAuthority;
+import org.apache.geronimo.util.CaUtils;
+import org.apache.geronimo.util.asn1.x509.X509Name;
+
+/**
+ * Handler for Confirm Client Certificate Issue screen.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConfirmClientCertHandler extends BaseCAHandler {
+ private final static Log log = LogFactory.getLog(ConfirmClientCertHandler.class);
+ public ConfirmClientCertHandler() {
+ super(CONFIRM_CLIENT_CERT_MODE, "/WEB-INF/view/ca/confirmClientCert.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG, "subject", "publickey", "algorithm", "validFrom", "validTo", "sNo", "pkcs10certreq", "requestId"};
+ for(int i = 0; i < params.length; ++i) {
+ String value = request.getParameter(params[i]);
+ if(value != null) response.setRenderParameter(params[i], value);
+ }
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG, "subject", "publickey", "algorithm", "validFrom", "validTo", "sNo", "pkcs10certreq", "requestId"};
+ for(int i = 0; i < params.length; ++i) {
+ String value = request.getParameter(params[i]);
+ if(value != null) request.setAttribute(params[i], value);
+ }
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String errorMsg = null;
+ try {
+ CertificationAuthority ca = getCertificationAuthority(request);
+ if(ca == null) {
+ throw new Exception("CA is not running. CA may not have been initialized!!");
+ }
+ BigInteger sNo = new BigInteger(request.getParameter("sNo"));
+ if(ca.isCertificateIssued(sNo)) {
+ // A certificate with the serial number has already been issued.
+ // This may happen if the user clicks on "Issue Certificate" button a second time
+ log.warn("Second request to issue certificate with serial number'"+sNo+"'. A certificate has already been issued.");
+ response.setRenderParameter("sNo", sNo.toString());
+ response.setRenderParameter(INFO_MSG, "A certificate with the serial number '"+sNo+"' has already been issued. "
+ +"You may be seeing this message since you have clicked on 'Issue Certificate' button a second time.");
+ return VIEW_CERT_MODE;
+ }
+
+ X509Name subject = null;
+ PublicKey publickey = null;
+ // Process the CSR text to get subject details
+ String pkcs10certreq = null, certreq = null;
+ String challenge = null;
+ String requestId = request.getParameter("requestId");
+ if(requestId != null && !requestId.equals("")) {
+ // Certificate request is being processed using a previously stored request in CertificateRequestStore
+ String certreqText = getCertificateRequestStore(request).getRequest(requestId);
+ if(certreqText.startsWith(CaUtils.CERT_REQ_HEADER)) {
+ // A PKCS 10 Certificate Request
+ pkcs10certreq = certreqText;
+ } else {
+ // Possibly a CSR received through web browser
+ certreq = certreqText;
+ }
+ } else {
+ // No request id is found. Get the PKCS10 request submitted through form input
+ pkcs10certreq = request.getParameter("pkcs10certreq");
+ }
+
+ if(pkcs10certreq != null && !"".equals(pkcs10certreq)) {
+ // Process PKCS 10 Certificate Request text to get Subject name and public-key
+ Map certReqMap = CaUtils.processPKCS10Request(pkcs10certreq);
+ subject = (X509Name) certReqMap.get(CaUtils.CERT_REQ_SUBJECT);
+ publickey = (PublicKey) certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ);
+ } else {
+ // This is a custom request containing SPKAC and X509Name attributes received through web browser
+ Properties csrProps = new Properties();
+ csrProps.load(new ByteArrayInputStream(certreq.getBytes()));
+ String spkac = csrProps.getProperty("SPKAC");
+ String cn = csrProps.getProperty("CN");
+ String ou = csrProps.getProperty("OU");
+ String o = csrProps.getProperty("O");
+ String l = csrProps.getProperty("L");
+ String st = csrProps.getProperty("ST");
+ String c = csrProps.getProperty("C");
+ subject = CaUtils.getX509Name(cn, ou, o, l, st, c);
+ Map certReqMap = CaUtils.processSPKAC(spkac);
+ publickey = (PublicKey) certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ);
+ challenge = (String) certReqMap.get(CaUtils.PKAC_CHALLENGE);
+ }
+
+ // Dates have already been validated in the previous screen
+ String validFrom = request.getParameter("validFrom");
+ String validTo = request.getParameter("validTo");
+ DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
+ Date validFromDate = df.parse(validFrom);
+ Date validToDate = df.parse(validTo);
+ String algorithm = request.getParameter("algorithm");
+ // Issue certificate
+ ca.issueCertificate(new X500Principal(subject.getEncoded()), publickey, sNo, validFromDate, validToDate, algorithm);
+ // Store the challenge phrase against the issued certificate serial number
+ if(challenge != null && !challenge.equals("")) {
+ getCertificateStore(request).setCertificateChallenge(sNo, challenge);
+ }
+
+ if(requestId != null && !requestId.equals("")) {
+ // This request was processed using a requestId from CertificateRequestStore. Delete the fulfilled request.
+ getCertificateRequestStore(request).setRequestFulfilled(requestId, sNo);
+ // The confirmation page will show a link to the "Requests to be fulfilled" page.
+ response.setRenderParameter("linkToListRequests", "true");
+ }
+
+ // Set the serial number and forward to view certificate page
+ response.setRenderParameter("sNo", sNo.toString());
+ response.setRenderParameter(INFO_MSG, "Certificate Issued successfully. This Certificate details can also be viewed using the serial number '"
+ +sNo+"' with the 'View Issued Certificate' link provided in the CA home screen.");
+ log.info("Certificate with serial number '"+sNo+"' issued to "+subject);
+ return VIEW_CERT_MODE;
+ } catch(Exception e) {
+ errorMsg = e.toString();
+ log.error("Errors in issuing certificate.", e);
+ }
+ // An error occurred. Go back to previous screen to let the user correct the errors.
+ response.setRenderParameter(ERROR_MSG, errorMsg);
+ return CERT_REQ_DETAILS_MODE+BEFORE_ACTION;
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ConfirmClientCertHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ConfirmClientCertHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ConfirmClientCertHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/IntroHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/IntroHandler.java?view=diff&rev=476291&r1=476290&r2=476291
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/IntroHandler.java (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/IntroHandler.java Fri Nov 17 12:05:24 2006
@@ -1,93 +1,93 @@
-/**
- *
- * 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.geronimo.console.ca;
-
-import java.io.IOException;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.management.geronimo.CertificationAuthority;
-
-/**
- * Handler for the CA home screen.
- *
- * @version $Rev$ $Date$
- */
-public class IntroHandler extends BaseCAHandler {
- private final static Log log = LogFactory.getLog(IntroHandler.class);
- public IntroHandler() {
- super(INDEX_MODE, "/WEB-INF/view/ca/index.jsp");
- }
-
- public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = new String[] {ERROR_MSG, INFO_MSG};
- for(int i = 0; i < params.length; ++i) {
- String value = request.getParameter(params[i]);
- if(value != null) response.setRenderParameter(params[i], value);
- }
- return getMode();
- }
-
- public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG};
- for(int i = 0; i < params.length; ++i) {
- String value = request.getParameter(params[i]);
- if(value != null) request.setAttribute(params[i], value);
- }
-
- CertificationAuthority ca = getCertificationAuthority(request);
- if(ca == null) {
- // CA GBean is not running or the CA has not been initialized.
- request.setAttribute("caNotSetup", Boolean.TRUE);
- } else {
- request.setAttribute("caNotSetup", Boolean.FALSE);
- request.setAttribute("caLocked", ca.isLocked() ? Boolean.TRUE : Boolean.FALSE);
- }
- }
-
- public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- if(request.getParameter("lock") != null) {
- CertificationAuthority ca = getCertificationAuthority(request);
- if(ca == null) {
- log.warn("CA is not running or CA may not have been initialized. Unable to lock CA.");
- response.setRenderParameter(ERROR_MSG, "CA is not running or CA may not have been initialized. Unable to lock CA.");
- } else {
- ca.lock();
- log.info("CA is now locked.");
- response.setRenderParameter(INFO_MSG, "CA has been locked!");
- }
- } else if(request.getParameter("publish") != null) {
- CertificationAuthority ca = getCertificationAuthority(request);
- try {
- getCertificateStore(request).storeCACertificate(ca.getCertificate());
- response.setRenderParameter(INFO_MSG, "CA's certificate published to Certificate Store");
- } catch (Exception e) {
- log.error("Error while publishing CA's certificate to Certificate Store", e);
- response.setRenderParameter(ERROR_MSG, "Error while publishing CA's certificate to Certificate Store. "+e);
- }
- }
- return getMode()+BEFORE_ACTION;
- }
-}
+/**
+ *
+ * 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.geronimo.console.ca;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.management.geronimo.CertificationAuthority;
+
+/**
+ * Handler for the CA home screen.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntroHandler extends BaseCAHandler {
+ private final static Log log = LogFactory.getLog(IntroHandler.class);
+ public IntroHandler() {
+ super(INDEX_MODE, "/WEB-INF/view/ca/index.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = new String[] {ERROR_MSG, INFO_MSG};
+ for(int i = 0; i < params.length; ++i) {
+ String value = request.getParameter(params[i]);
+ if(value != null) response.setRenderParameter(params[i], value);
+ }
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG};
+ for(int i = 0; i < params.length; ++i) {
+ String value = request.getParameter(params[i]);
+ if(value != null) request.setAttribute(params[i], value);
+ }
+
+ CertificationAuthority ca = getCertificationAuthority(request);
+ if(ca == null) {
+ // CA GBean is not running or the CA has not been initialized.
+ request.setAttribute("caNotSetup", Boolean.TRUE);
+ } else {
+ request.setAttribute("caNotSetup", Boolean.FALSE);
+ request.setAttribute("caLocked", ca.isLocked() ? Boolean.TRUE : Boolean.FALSE);
+ }
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ if(request.getParameter("lock") != null) {
+ CertificationAuthority ca = getCertificationAuthority(request);
+ if(ca == null) {
+ log.warn("CA is not running or CA may not have been initialized. Unable to lock CA.");
+ response.setRenderParameter(ERROR_MSG, "CA is not running or CA may not have been initialized. Unable to lock CA.");
+ } else {
+ ca.lock();
+ log.info("CA is now locked.");
+ response.setRenderParameter(INFO_MSG, "CA has been locked!");
+ }
+ } else if(request.getParameter("publish") != null) {
+ CertificationAuthority ca = getCertificationAuthority(request);
+ try {
+ getCertificateStore(request).storeCACertificate(ca.getCertificate());
+ response.setRenderParameter(INFO_MSG, "CA's certificate published to Certificate Store");
+ } catch (Exception e) {
+ log.error("Error while publishing CA's certificate to Certificate Store", e);
+ response.setRenderParameter(ERROR_MSG, "Error while publishing CA's certificate to Certificate Store. "+e);
+ }
+ }
+ return getMode()+BEFORE_ACTION;
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/IntroHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/IntroHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/IntroHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsIssueHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsIssueHandler.java?view=diff&rev=476291&r1=476290&r2=476291
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsIssueHandler.java (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsIssueHandler.java Fri Nov 17 12:05:24 2006
@@ -1,107 +1,107 @@
-/**
- *
- * 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.geronimo.console.ca;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.management.geronimo.CertificateRequestStore;
-import org.apache.geronimo.util.CaUtils;
-import org.apache.geronimo.util.asn1.x509.X509Name;
-
-/**
- * Handler for "Requests to be fulfilled" screen.
- *
- * @version $Rev$ $Date$
- */
-public class ListRequestsIssueHandler extends BaseCAHandler {
- private final static Log log = LogFactory.getLog(ListRequestsIssueHandler.class);
- public ListRequestsIssueHandler() {
- super(LIST_REQUESTS_ISSUE_MODE, "/WEB-INF/view/ca/listRequestsIssue.jsp");
- }
-
- public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG};
- for(int i = 0; i < params.length; ++i) {
- String value = request.getParameter(params[i]);
- if(value != null) response.setRenderParameter(params[i], value);
- }
- return getMode();
- }
-
- public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG};
- for(int i = 0; i < params.length; ++i) {
- String value = request.getParameter(params[i]);
- if(value != null) request.setAttribute(params[i], value);
- }
- CertificateRequestStore csrStore = getCertificateRequestStore(request);
- String[] csrIds = csrStore.getVerifiedRequestIds();
- request.setAttribute("csrIds", csrIds);
- }
-
- public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String errorMsg = null;
- String requestId = request.getParameter("requestId");
- try {
- response.setRenderParameter("requestId", requestId);
- // Retrieve the request info based on the requestId
- String certreq = getCertificateRequestStore(request).getRequest(requestId);
- if(certreq.startsWith(CaUtils.CERT_REQ_HEADER)) {
- // This is a PKCS 10 Request
- Map certReqMap = CaUtils.processPKCS10Request(certreq);
- // Set the subject and publickey values to be displayed in subsequent screens
- response.setRenderParameter("subject", certReqMap.get(CaUtils.CERT_REQ_SUBJECT).toString());
- response.setRenderParameter("publickey", certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ).toString());
- } else {
- // This is a custom request containing SPKAC and X509Name attributes received through web browser
- Properties csrProps = new Properties();
- csrProps.load(new ByteArrayInputStream(certreq.getBytes()));
- String spkac = csrProps.getProperty("SPKAC");
- String cn = csrProps.getProperty("CN");
- String ou = csrProps.getProperty("OU");
- String o = csrProps.getProperty("O");
- String l = csrProps.getProperty("L");
- String st = csrProps.getProperty("ST");
- String c = csrProps.getProperty("C");
- X509Name subject = CaUtils.getX509Name(cn, ou, o, l, st, c);
- Map certReqMap = CaUtils.processSPKAC(spkac);
- // Set the subject and publickey values to be displayed in subsequent screens
- response.setRenderParameter("subject", subject.toString());
- response.setRenderParameter("publickey", certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ).toString());
- }
- return CERT_REQ_DETAILS_MODE+BEFORE_ACTION;
- } catch(Exception e) {
- errorMsg = e.toString();
- log.error("Errors while processing a Certificate Request. id="+requestId, e);
- }
- response.setRenderParameter(ERROR_MSG, errorMsg);
- return getMode()+BEFORE_ACTION;
- }
-}
+/**
+ *
+ * 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.geronimo.console.ca;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.management.geronimo.CertificateRequestStore;
+import org.apache.geronimo.util.CaUtils;
+import org.apache.geronimo.util.asn1.x509.X509Name;
+
+/**
+ * Handler for "Requests to be fulfilled" screen.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ListRequestsIssueHandler extends BaseCAHandler {
+ private final static Log log = LogFactory.getLog(ListRequestsIssueHandler.class);
+ public ListRequestsIssueHandler() {
+ super(LIST_REQUESTS_ISSUE_MODE, "/WEB-INF/view/ca/listRequestsIssue.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG};
+ for(int i = 0; i < params.length; ++i) {
+ String value = request.getParameter(params[i]);
+ if(value != null) response.setRenderParameter(params[i], value);
+ }
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG};
+ for(int i = 0; i < params.length; ++i) {
+ String value = request.getParameter(params[i]);
+ if(value != null) request.setAttribute(params[i], value);
+ }
+ CertificateRequestStore csrStore = getCertificateRequestStore(request);
+ String[] csrIds = csrStore.getVerifiedRequestIds();
+ request.setAttribute("csrIds", csrIds);
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String errorMsg = null;
+ String requestId = request.getParameter("requestId");
+ try {
+ response.setRenderParameter("requestId", requestId);
+ // Retrieve the request info based on the requestId
+ String certreq = getCertificateRequestStore(request).getRequest(requestId);
+ if(certreq.startsWith(CaUtils.CERT_REQ_HEADER)) {
+ // This is a PKCS 10 Request
+ Map certReqMap = CaUtils.processPKCS10Request(certreq);
+ // Set the subject and publickey values to be displayed in subsequent screens
+ response.setRenderParameter("subject", certReqMap.get(CaUtils.CERT_REQ_SUBJECT).toString());
+ response.setRenderParameter("publickey", certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ).toString());
+ } else {
+ // This is a custom request containing SPKAC and X509Name attributes received through web browser
+ Properties csrProps = new Properties();
+ csrProps.load(new ByteArrayInputStream(certreq.getBytes()));
+ String spkac = csrProps.getProperty("SPKAC");
+ String cn = csrProps.getProperty("CN");
+ String ou = csrProps.getProperty("OU");
+ String o = csrProps.getProperty("O");
+ String l = csrProps.getProperty("L");
+ String st = csrProps.getProperty("ST");
+ String c = csrProps.getProperty("C");
+ X509Name subject = CaUtils.getX509Name(cn, ou, o, l, st, c);
+ Map certReqMap = CaUtils.processSPKAC(spkac);
+ // Set the subject and publickey values to be displayed in subsequent screens
+ response.setRenderParameter("subject", subject.toString());
+ response.setRenderParameter("publickey", certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ).toString());
+ }
+ return CERT_REQ_DETAILS_MODE+BEFORE_ACTION;
+ } catch(Exception e) {
+ errorMsg = e.toString();
+ log.error("Errors while processing a Certificate Request. id="+requestId, e);
+ }
+ response.setRenderParameter(ERROR_MSG, errorMsg);
+ return getMode()+BEFORE_ACTION;
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsIssueHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsIssueHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsIssueHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsVerifyHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsVerifyHandler.java?view=diff&rev=476291&r1=476290&r2=476291
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsVerifyHandler.java (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsVerifyHandler.java Fri Nov 17 12:05:24 2006
@@ -1,107 +1,107 @@
-/**
- *
- * 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.geronimo.console.ca;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.management.geronimo.CertificateRequestStore;
-import org.apache.geronimo.util.CaUtils;
-import org.apache.geronimo.util.asn1.x509.X509Name;
-
-/**
- * Handler for "Requests to be verified" screen.
- *
- * @version $Rev$ $Date$
- */
-public class ListRequestsVerifyHandler extends BaseCAHandler {
- private final static Log log = LogFactory.getLog(ListRequestsVerifyHandler.class);
- public ListRequestsVerifyHandler() {
- super(LIST_REQUESTS_VERIFY_MODE, "/WEB-INF/view/ca/listRequestsVerify.jsp");
- }
-
- public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG};
- for(int i = 0; i < params.length; ++i) {
- String value = request.getParameter(params[i]);
- if(value != null) response.setRenderParameter(params[i], value);
- }
- return getMode();
- }
-
- public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG};
- for(int i = 0; i < params.length; ++i) {
- String value = request.getParameter(params[i]);
- if(value != null) request.setAttribute(params[i], value);
- }
- CertificateRequestStore csrStore = getCertificateRequestStore(request);
- String[] csrIds = csrStore.getVerificatonDueRequestIds();
- request.setAttribute("csrIds", csrIds);
- }
-
- public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String errorMsg = null;
- String requestId = request.getParameter("requestId");
- try {
- response.setRenderParameter("requestId", requestId);
- // Retrieve the request info based on the requestId
- String certreq = getCertificateRequestStore(request).getRequest(requestId);
- if(certreq.startsWith(CaUtils.CERT_REQ_HEADER)) {
- // This is a PKCS10 Request
- Map certReqMap = CaUtils.processPKCS10Request(certreq);
- // Set the subject and publickey values to be shown in subsequent screens
- response.setRenderParameter("subject", certReqMap.get(CaUtils.CERT_REQ_SUBJECT).toString());
- response.setRenderParameter("publickey", certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ).toString());
- } else {
- // This is a custom request containing SPKAC and X509Name attributes received through web browser
- Properties csrProps = new Properties();
- csrProps.load(new ByteArrayInputStream(certreq.getBytes()));
- String spkac = csrProps.getProperty("SPKAC");
- String cn = csrProps.getProperty("CN");
- String ou = csrProps.getProperty("OU");
- String o = csrProps.getProperty("O");
- String l = csrProps.getProperty("L");
- String st = csrProps.getProperty("ST");
- String c = csrProps.getProperty("C");
- X509Name subject = CaUtils.getX509Name(cn, ou, o, l, st, c);
- Map certReqMap = CaUtils.processSPKAC(spkac);
- // Set the subject and publickey values to be shown in subsequent screens
- response.setRenderParameter("subject", subject.toString());
- response.setRenderParameter("publickey", certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ).toString());
- }
- return CONFIRM_CERT_REQ_MODE+BEFORE_ACTION;
- } catch(Exception e) {
- errorMsg = e.toString();
- log.error("Errors while verifying Certificate Request. id="+requestId, e);
- }
- response.setRenderParameter(ERROR_MSG, errorMsg);
- return getMode()+BEFORE_ACTION;
- }
-}
+/**
+ *
+ * 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.geronimo.console.ca;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.management.geronimo.CertificateRequestStore;
+import org.apache.geronimo.util.CaUtils;
+import org.apache.geronimo.util.asn1.x509.X509Name;
+
+/**
+ * Handler for "Requests to be verified" screen.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ListRequestsVerifyHandler extends BaseCAHandler {
+ private final static Log log = LogFactory.getLog(ListRequestsVerifyHandler.class);
+ public ListRequestsVerifyHandler() {
+ super(LIST_REQUESTS_VERIFY_MODE, "/WEB-INF/view/ca/listRequestsVerify.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG};
+ for(int i = 0; i < params.length; ++i) {
+ String value = request.getParameter(params[i]);
+ if(value != null) response.setRenderParameter(params[i], value);
+ }
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG};
+ for(int i = 0; i < params.length; ++i) {
+ String value = request.getParameter(params[i]);
+ if(value != null) request.setAttribute(params[i], value);
+ }
+ CertificateRequestStore csrStore = getCertificateRequestStore(request);
+ String[] csrIds = csrStore.getVerificatonDueRequestIds();
+ request.setAttribute("csrIds", csrIds);
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String errorMsg = null;
+ String requestId = request.getParameter("requestId");
+ try {
+ response.setRenderParameter("requestId", requestId);
+ // Retrieve the request info based on the requestId
+ String certreq = getCertificateRequestStore(request).getRequest(requestId);
+ if(certreq.startsWith(CaUtils.CERT_REQ_HEADER)) {
+ // This is a PKCS10 Request
+ Map certReqMap = CaUtils.processPKCS10Request(certreq);
+ // Set the subject and publickey values to be shown in subsequent screens
+ response.setRenderParameter("subject", certReqMap.get(CaUtils.CERT_REQ_SUBJECT).toString());
+ response.setRenderParameter("publickey", certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ).toString());
+ } else {
+ // This is a custom request containing SPKAC and X509Name attributes received through web browser
+ Properties csrProps = new Properties();
+ csrProps.load(new ByteArrayInputStream(certreq.getBytes()));
+ String spkac = csrProps.getProperty("SPKAC");
+ String cn = csrProps.getProperty("CN");
+ String ou = csrProps.getProperty("OU");
+ String o = csrProps.getProperty("O");
+ String l = csrProps.getProperty("L");
+ String st = csrProps.getProperty("ST");
+ String c = csrProps.getProperty("C");
+ X509Name subject = CaUtils.getX509Name(cn, ou, o, l, st, c);
+ Map certReqMap = CaUtils.processSPKAC(spkac);
+ // Set the subject and publickey values to be shown in subsequent screens
+ response.setRenderParameter("subject", subject.toString());
+ response.setRenderParameter("publickey", certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ).toString());
+ }
+ return CONFIRM_CERT_REQ_MODE+BEFORE_ACTION;
+ } catch(Exception e) {
+ errorMsg = e.toString();
+ log.error("Errors while verifying Certificate Request. id="+requestId, e);
+ }
+ response.setRenderParameter(ERROR_MSG, errorMsg);
+ return getMode()+BEFORE_ACTION;
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsVerifyHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsVerifyHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ListRequestsVerifyHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ProcessCSRHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ProcessCSRHandler.java?view=diff&rev=476291&r1=476290&r2=476291
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ProcessCSRHandler.java (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ProcessCSRHandler.java Fri Nov 17 12:05:24 2006
@@ -1,80 +1,80 @@
-/**
- *
- * 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.geronimo.console.ca;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.util.CaUtils;
-
-/**
- * Handler for process CSR screen.
- *
- * @version $Rev$ $Date$
- */
-public class ProcessCSRHandler extends BaseCAHandler {
- private final static Log log = LogFactory.getLog(ProcessCSRHandler.class);
- public ProcessCSRHandler() {
- super(PROCESS_CSR_MODE, "/WEB-INF/view/ca/processCSR.jsp");
- }
-
- public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG};
- for(int i = 0; i < params.length; ++i) {
- String value = request.getParameter(params[i]);
- if(value != null) response.setRenderParameter(params[i], value);
- }
- return getMode();
- }
-
- public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG};
- for(int i = 0; i < params.length; ++i) {
- Object value = request.getParameter(params[i]);
- if(value != null) request.setAttribute(params[i], value);
- }
- }
-
- public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String errorMsg = null;
- try {
- // Process the PKCS10 Certificate Request
- String pkcs10certreq = request.getParameter("pkcs10certreq");
- Map certReqMap = CaUtils.processPKCS10Request(pkcs10certreq);
- response.setRenderParameter("pkcs10certreq", pkcs10certreq);
- // Set the subject and publickey values to be shown in subsequent screens
- response.setRenderParameter("subject", certReqMap.get(CaUtils.CERT_REQ_SUBJECT).toString());
- response.setRenderParameter("publickey", certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ).toString());
- return CERT_REQ_DETAILS_MODE+BEFORE_ACTION;
- } catch(Exception e) {
- errorMsg = e.toString();
- log.error("Errors while processing a CSR.", e);
- }
- response.setRenderParameter(ERROR_MSG, errorMsg);
- return getMode()+BEFORE_ACTION;
- }
-}
+/**
+ *
+ * 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.geronimo.console.ca;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.util.CaUtils;
+
+/**
+ * Handler for process CSR screen.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProcessCSRHandler extends BaseCAHandler {
+ private final static Log log = LogFactory.getLog(ProcessCSRHandler.class);
+ public ProcessCSRHandler() {
+ super(PROCESS_CSR_MODE, "/WEB-INF/view/ca/processCSR.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG};
+ for(int i = 0; i < params.length; ++i) {
+ String value = request.getParameter(params[i]);
+ if(value != null) response.setRenderParameter(params[i], value);
+ }
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG};
+ for(int i = 0; i < params.length; ++i) {
+ Object value = request.getParameter(params[i]);
+ if(value != null) request.setAttribute(params[i], value);
+ }
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String errorMsg = null;
+ try {
+ // Process the PKCS10 Certificate Request
+ String pkcs10certreq = request.getParameter("pkcs10certreq");
+ Map certReqMap = CaUtils.processPKCS10Request(pkcs10certreq);
+ response.setRenderParameter("pkcs10certreq", pkcs10certreq);
+ // Set the subject and publickey values to be shown in subsequent screens
+ response.setRenderParameter("subject", certReqMap.get(CaUtils.CERT_REQ_SUBJECT).toString());
+ response.setRenderParameter("publickey", certReqMap.get(CaUtils.CERT_REQ_PUBLICKEY_OBJ).toString());
+ return CERT_REQ_DETAILS_MODE+BEFORE_ACTION;
+ } catch(Exception e) {
+ errorMsg = e.toString();
+ log.error("Errors while processing a CSR.", e);
+ }
+ response.setRenderParameter(ERROR_MSG, errorMsg);
+ return getMode()+BEFORE_ACTION;
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ProcessCSRHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ProcessCSRHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/ProcessCSRHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/SetupCAHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/SetupCAHandler.java?view=diff&rev=476291&r1=476290&r2=476291
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/SetupCAHandler.java (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/SetupCAHandler.java Fri Nov 17 12:05:24 2006
@@ -1,111 +1,111 @@
-/**
- *
- * 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.geronimo.console.ca;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.console.MultiPageModel;
-
-/**
- * Handler for Setup CA screen to get CA details from user.
- *
- * @version $Rev$ $Date$
- */
-public class SetupCAHandler extends BaseCAHandler {
- private final static Log log = LogFactory.getLog(SetupCAHandler.class);
- public SetupCAHandler() {
- super(SETUPCA_MODE, "/WEB-INF/view/ca/setupCA.jsp");
- }
-
- public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG, "caCN", "caOU", "caO", "caL", "caST", "caC", "alias", "keyAlgorithm", "keySize", "algorithm", "validFrom", "validTo", "sNo", "password"};
- for(int i = 0; i < params.length; ++i) {
- String value = request.getParameter(params[i]);
- if(value != null) response.setRenderParameter(params[i], value);
- }
- return getMode();
- }
-
- public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG, "caCN", "caOU", "caO", "caL", "caST", "caC", "alias", "keyAlgorithm", "keySize", "algorithm", "validFrom", "validTo", "sNo", "password"};
- for(int i = 0; i < params.length; ++i) {
- Object value = request.getParameter(params[i]);
- if(value != null) request.setAttribute(params[i], value);
- }
- }
-
- public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String errorMsg = null;
- try {
- // Validate the Serial Number
- String sNo = request.getParameter("sNo");
- new BigInteger(sNo.trim());
-
- // Validate the from and to dates
- String validFrom = request.getParameter("validFrom");
- String validTo = request.getParameter("validTo");
- // Check if the from date format is MM/DD/YYYY
- DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
- Date validFromDate = df.parse(validFrom);
- Calendar calendar = new GregorianCalendar();
- calendar.setTime(validFromDate);
- String mmddyyyy = (calendar.get(Calendar.MONTH) < 9 ? "0":"") + (calendar.get(Calendar.MONTH)+1);
- mmddyyyy += "/"+(calendar.get(Calendar.DAY_OF_MONTH) < 10 ? "0":"") + (calendar.get(Calendar.DAY_OF_MONTH));
- mmddyyyy += "/"+calendar.get(Calendar.YEAR);
- if(!mmddyyyy.equals(validFrom)) {
- throw new Exception("validFrom must be a date in MM/DD/YYYY format.");
- }
- // Check if the to date format is MM/DD/YYYY
- Date validToDate = df.parse(validTo);
- calendar.setTime(validToDate);
- mmddyyyy = (calendar.get(Calendar.MONTH) < 9 ? "0":"") + (calendar.get(Calendar.MONTH)+1);
- mmddyyyy += "/"+(calendar.get(Calendar.DAY_OF_MONTH) < 10 ? "0":"") + (calendar.get(Calendar.DAY_OF_MONTH));
- mmddyyyy += "/"+calendar.get(Calendar.YEAR);
- if(!mmddyyyy.equals(validTo)) {
- throw new Exception("validTo must be a date in MM/DD/YYYY format.");
- }
- // Check if the from date is before the to date
- if(validFromDate.after(validToDate)) {
- throw new Exception("Validity: From date '"+validFrom+"' is before the To date '"+validTo+"'.");
- }
-
- // Load page to confirm CA details
- return CONFIRM_CA_MODE+BEFORE_ACTION;
- } catch(Exception e) {
- errorMsg = e.toString();
- log.error("Error in user input during CA Setup.", e);
- }
- if(errorMsg != null) response.setRenderParameter(ERROR_MSG, errorMsg);
- return getMode()+BEFORE_ACTION;
- }
-
-}
+/**
+ *
+ * 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.geronimo.console.ca;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+
+/**
+ * Handler for Setup CA screen to get CA details from user.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SetupCAHandler extends BaseCAHandler {
+ private final static Log log = LogFactory.getLog(SetupCAHandler.class);
+ public SetupCAHandler() {
+ super(SETUPCA_MODE, "/WEB-INF/view/ca/setupCA.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG, "caCN", "caOU", "caO", "caL", "caST", "caC", "alias", "keyAlgorithm", "keySize", "algorithm", "validFrom", "validTo", "sNo", "password"};
+ for(int i = 0; i < params.length; ++i) {
+ String value = request.getParameter(params[i]);
+ if(value != null) response.setRenderParameter(params[i], value);
+ }
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG, "caCN", "caOU", "caO", "caL", "caST", "caC", "alias", "keyAlgorithm", "keySize", "algorithm", "validFrom", "validTo", "sNo", "password"};
+ for(int i = 0; i < params.length; ++i) {
+ Object value = request.getParameter(params[i]);
+ if(value != null) request.setAttribute(params[i], value);
+ }
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String errorMsg = null;
+ try {
+ // Validate the Serial Number
+ String sNo = request.getParameter("sNo");
+ new BigInteger(sNo.trim());
+
+ // Validate the from and to dates
+ String validFrom = request.getParameter("validFrom");
+ String validTo = request.getParameter("validTo");
+ // Check if the from date format is MM/DD/YYYY
+ DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
+ Date validFromDate = df.parse(validFrom);
+ Calendar calendar = new GregorianCalendar();
+ calendar.setTime(validFromDate);
+ String mmddyyyy = (calendar.get(Calendar.MONTH) < 9 ? "0":"") + (calendar.get(Calendar.MONTH)+1);
+ mmddyyyy += "/"+(calendar.get(Calendar.DAY_OF_MONTH) < 10 ? "0":"") + (calendar.get(Calendar.DAY_OF_MONTH));
+ mmddyyyy += "/"+calendar.get(Calendar.YEAR);
+ if(!mmddyyyy.equals(validFrom)) {
+ throw new Exception("validFrom must be a date in MM/DD/YYYY format.");
+ }
+ // Check if the to date format is MM/DD/YYYY
+ Date validToDate = df.parse(validTo);
+ calendar.setTime(validToDate);
+ mmddyyyy = (calendar.get(Calendar.MONTH) < 9 ? "0":"") + (calendar.get(Calendar.MONTH)+1);
+ mmddyyyy += "/"+(calendar.get(Calendar.DAY_OF_MONTH) < 10 ? "0":"") + (calendar.get(Calendar.DAY_OF_MONTH));
+ mmddyyyy += "/"+calendar.get(Calendar.YEAR);
+ if(!mmddyyyy.equals(validTo)) {
+ throw new Exception("validTo must be a date in MM/DD/YYYY format.");
+ }
+ // Check if the from date is before the to date
+ if(validFromDate.after(validToDate)) {
+ throw new Exception("Validity: From date '"+validFrom+"' is before the To date '"+validTo+"'.");
+ }
+
+ // Load page to confirm CA details
+ return CONFIRM_CA_MODE+BEFORE_ACTION;
+ } catch(Exception e) {
+ errorMsg = e.toString();
+ log.error("Error in user input during CA Setup.", e);
+ }
+ if(errorMsg != null) response.setRenderParameter(ERROR_MSG, errorMsg);
+ return getMode()+BEFORE_ACTION;
+ }
+
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/SetupCAHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/SetupCAHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/SetupCAHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/UnlockCAHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/UnlockCAHandler.java?view=diff&rev=476291&r1=476290&r2=476291
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/UnlockCAHandler.java (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/UnlockCAHandler.java Fri Nov 17 12:05:24 2006
@@ -1,86 +1,86 @@
-/**
- *
- * 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.geronimo.console.ca;
-
-import java.io.IOException;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.console.MultiPageModel;
-import org.apache.geronimo.management.geronimo.CertificationAuthority;
-
-/**
- * Handler for unlock CA screen.
- *
- * @version $Rev$ $Date$
- */
-public class UnlockCAHandler extends BaseCAHandler {
- private final static Log log = LogFactory.getLog(UnlockCAHandler.class);
- public UnlockCAHandler() {
- super(UNLOCKCA_MODE, "/WEB-INF/view/ca/unlockCA.jsp");
- }
-
- public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG};
- for(int i = 0; i < params.length; ++i) {
- String value = request.getParameter(params[i]);
- if(value != null) response.setRenderParameter(params[i], value);
- }
- return getMode();
- }
-
- public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
- String[] params = {ERROR_MSG, INFO_MSG};
- for(int i = 0; i < params.length; ++i) {
- Object value = request.getParameter(params[i]);
- if(value != null) request.setAttribute(params[i], value);
- }
- }
-
- public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
- String errorMsg = null;
- try {
- String password = request.getParameter("password");
- if(password == null) {
- throw new Exception("Password is null.");
- }
- CertificationAuthority ca = getCertificationAuthority(request);
- if(ca == null) {
- throw new Exception("CA is not running. CA may not have been initialized.");
- }
- ca.unlock(password.toCharArray());
-
- // Return to CA's index page
- response.setRenderParameter(INFO_MSG, "CA has been unlocked successfully!");
- log.info("CA has been unlocked successfully!");
- return INDEX_MODE+BEFORE_ACTION;
- } catch(Exception e) {
- errorMsg = e.toString();
- log.error("Errors in unlocking CA.", e);
- }
- // An error occurred. Set the error message and load the page again.
- response.setRenderParameter(ERROR_MSG, errorMsg);
- return getMode()+BEFORE_ACTION;
- }
-}
+/**
+ *
+ * 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.geronimo.console.ca;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.MultiPageModel;
+import org.apache.geronimo.management.geronimo.CertificationAuthority;
+
+/**
+ * Handler for unlock CA screen.
+ *
+ * @version $Rev$ $Date$
+ */
+public class UnlockCAHandler extends BaseCAHandler {
+ private final static Log log = LogFactory.getLog(UnlockCAHandler.class);
+ public UnlockCAHandler() {
+ super(UNLOCKCA_MODE, "/WEB-INF/view/ca/unlockCA.jsp");
+ }
+
+ public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG};
+ for(int i = 0; i < params.length; ++i) {
+ String value = request.getParameter(params[i]);
+ if(value != null) response.setRenderParameter(params[i], value);
+ }
+ return getMode();
+ }
+
+ public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
+ String[] params = {ERROR_MSG, INFO_MSG};
+ for(int i = 0; i < params.length; ++i) {
+ Object value = request.getParameter(params[i]);
+ if(value != null) request.setAttribute(params[i], value);
+ }
+ }
+
+ public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
+ String errorMsg = null;
+ try {
+ String password = request.getParameter("password");
+ if(password == null) {
+ throw new Exception("Password is null.");
+ }
+ CertificationAuthority ca = getCertificationAuthority(request);
+ if(ca == null) {
+ throw new Exception("CA is not running. CA may not have been initialized.");
+ }
+ ca.unlock(password.toCharArray());
+
+ // Return to CA's index page
+ response.setRenderParameter(INFO_MSG, "CA has been unlocked successfully!");
+ log.info("CA has been unlocked successfully!");
+ return INDEX_MODE+BEFORE_ACTION;
+ } catch(Exception e) {
+ errorMsg = e.toString();
+ log.error("Errors in unlocking CA.", e);
+ }
+ // An error occurred. Set the error message and load the page again.
+ response.setRenderParameter(ERROR_MSG, errorMsg);
+ return getMode()+BEFORE_ACTION;
+ }
+}
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/UnlockCAHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/UnlockCAHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/ca/UnlockCAHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain