1 18 package org.apache.geronimo.console.ca; 19 20 import javax.portlet.ActionResponse; 21 import javax.portlet.PortletRequest; 22 import javax.portlet.PortletSession; 23 24 import org.apache.commons.logging.Log; 25 import org.apache.commons.logging.LogFactory; 26 import org.apache.geronimo.console.MultiPageAbstractHandler; 27 import org.apache.geronimo.console.MultiPageModel; 28 import org.apache.geronimo.console.util.PortletManager; 29 import org.apache.geronimo.management.geronimo.CertificateRequestStore; 30 import org.apache.geronimo.management.geronimo.CertificateStore; 31 import org.apache.geronimo.management.geronimo.CertificationAuthority; 32 import org.apache.geronimo.management.geronimo.KeystoreException; 33 import org.apache.geronimo.management.geronimo.KeystoreInstance; 34 35 40 public abstract class BaseCAHandler extends MultiPageAbstractHandler { 41 private final static Log log = LogFactory.getLog(BaseCAHandler.class); 42 43 protected static final String INDEX_MODE = "index"; 44 protected static final String SETUPCA_MODE = "setupCA"; 45 protected static final String CONFIRM_CA_MODE = "confirmCA"; 46 protected static final String CADETAILS_MODE = "caDetails"; 47 protected static final String UNLOCKCA_MODE = "unlockCA"; 48 protected static final String PROCESS_CSR_MODE = "processCSR"; 49 protected static final String CERT_REQ_DETAILS_MODE = "certReqDetails"; 50 protected static final String CONFIRM_CLIENT_CERT_MODE = "confirmClientCert"; 51 protected static final String VIEW_CERT_MODE = "viewCert"; 52 protected static final String LIST_REQUESTS_ISSUE_MODE = "listRequestsIssue"; 53 protected static final String LIST_REQUESTS_VERIFY_MODE = "listRequestsVerify"; 54 protected static final String CONFIRM_CERT_REQ_MODE = "confirmCertReq"; 55 56 protected static final String defaultKeyAlgorithm = "RSA"; 58 protected static final String defaultCAKeystore = "ca-keystore"; 61 protected static final String defaultCAStoreDir = "var/security/ca/certs"; 63 protected static final String defaultCSRStoreDir = "var/security/ca/requests"; 65 66 protected static final String ERROR_MSG = "errorMsg"; 68 protected static final String INFO_MSG = "infoMsg"; 70 71 74 protected BaseCAHandler(String mode, String viewName) { 75 super(mode, viewName); 76 } 77 78 public final static class CAModel implements MultiPageModel { 79 public CAModel(PortletRequest request) { 80 } 81 82 public void save(ActionResponse response, PortletSession session) { 83 } 84 } 85 86 91 protected CertificationAuthority getCertificationAuthority(PortletRequest request) { 92 Object [] cas = PortletManager.getManagementHelper(request).getGBeansImplementing(CertificationAuthority.class); 93 return (CertificationAuthority)(cas != null && cas.length > 0 ? cas[0] : null); 94 } 95 96 102 protected KeystoreInstance createCAKeystoreInstance(PortletRequest request, String password) throws KeystoreException { 103 return PortletManager.getCurrentServer(request).getKeystoreManager().createKeystore(defaultCAKeystore, password.toCharArray()); 104 } 105 106 111 protected CertificateRequestStore getCertificateRequestStore(PortletRequest request) { 112 Object [] crs = PortletManager.getManagementHelper(request).getGBeansImplementing(CertificateRequestStore.class); 113 return (CertificateRequestStore)(crs != null && crs.length > 0 ? crs[0] : null); 114 } 115 116 121 protected CertificateStore getCertificateStore(PortletRequest request) { 122 Object [] cs = PortletManager.getManagementHelper(request).getGBeansImplementing(CertificateStore.class); 123 return (CertificateStore)(cs != null && cs.length > 0 ? cs[0] : null); 124 } 125 } 126 | Popular Tags |