01: /**
02: *
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */package org.apache.geronimo.console.ca;
18:
19: import java.io.IOException;
20:
21: import javax.portlet.ActionRequest;
22: import javax.portlet.ActionResponse;
23: import javax.portlet.PortletException;
24: import javax.portlet.RenderRequest;
25: import javax.portlet.RenderResponse;
26:
27: import org.apache.geronimo.console.MultiPageModel;
28:
29: /**
30: * Handler for the Confirm Certificate Request screen.
31: *
32: * @version $Rev: 514091 $ $Date: 2007-03-02 22:26:39 -0800 (Fri, 02 Mar 2007) $
33: */
34: public class ConfirmCertReqHandler extends BaseCAHandler {
35: public ConfirmCertReqHandler() {
36: super (CONFIRM_CERT_REQ_MODE,
37: "/WEB-INF/view/ca/confirmCertReq.jsp");
38: }
39:
40: public String actionBeforeView(ActionRequest request,
41: ActionResponse response, MultiPageModel model)
42: throws PortletException, IOException {
43: String[] params = { ERROR_MSG, INFO_MSG, "subject",
44: "publickey", "requestId" };
45: for (int i = 0; i < params.length; ++i) {
46: String value = request.getParameter(params[i]);
47: if (value != null)
48: response.setRenderParameter(params[i], value);
49: }
50: return getMode();
51: }
52:
53: public void renderView(RenderRequest request,
54: RenderResponse response, MultiPageModel model)
55: throws PortletException, IOException {
56: String[] params = { ERROR_MSG, INFO_MSG, "subject",
57: "publickey", "requestId" };
58: for (int i = 0; i < params.length; ++i) {
59: String value = request.getParameter(params[i]);
60: if (value != null)
61: request.setAttribute(params[i], value);
62: }
63: }
64:
65: public String actionAfterView(ActionRequest request,
66: ActionResponse response, MultiPageModel model)
67: throws PortletException, IOException {
68: String requestId = request.getParameter("requestId");
69: String approve = request.getParameter("approve");
70: String reject = request.getParameter("reject");
71: if (approve != null) {
72: getCertificateRequestStore(request).setRequestVerified(
73: requestId);
74: response.setRenderParameter(INFO_MSG, "Approved CSR. id = "
75: + requestId);
76: } else if (reject != null) {
77: getCertificateRequestStore(request)
78: .deleteRequest(requestId);
79: response.setRenderParameter(INFO_MSG,
80: "Rejected and deleted CSR. id = " + requestId);
81: }
82: return LIST_REQUESTS_VERIFY_MODE + BEFORE_ACTION;
83: }
84: }
|