public abstract class CMSServlet
extends javax.servlet.http.HttpServlet
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
ADMIN_GROUP |
static java.lang.String |
AUTH_FAILURE |
protected static java.lang.String |
AUTHMGR_PARAM |
static java.lang.String |
AUTHZ_CONFIG_STORE |
static java.lang.String |
AUTHZ_MGR_BASIC |
static java.lang.String |
AUTHZ_MGR_LDAP |
static java.lang.String |
AUTHZ_SRC_LDAP |
static java.lang.String |
AUTHZ_SRC_TYPE |
static java.lang.String |
AUTHZ_SRC_XML |
protected static java.lang.String |
CA_AGENT_GROUP |
static java.lang.String |
CERT_ATTR |
protected ICertificateAuthority |
certAuthority |
static java.lang.String |
ERROR_MSG_TOKEN |
protected static java.lang.String |
ERROR_TEMPLATE |
protected static java.lang.String |
EXCEPTION_TEMPLATE |
static java.lang.String |
FAILURE |
static java.lang.String |
FINAL_ERROR_MSG |
static java.lang.String |
FULL_ENROLLMENT_REQUEST |
static java.lang.String |
FULL_ENROLLMENT_RESPONSE |
static java.lang.String |
FULL_RESPONSE
handy routine to check if client want full enrollment response
|
protected static java.lang.String |
KRA_AGENT_GROUP |
protected java.lang.String |
mAclMethod |
protected java.lang.String |
mAuthMgr |
protected IAuthority |
mAuthority |
protected IAuthzSubsystem |
mAuthz |
protected java.lang.String |
mAuthzResourceName |
protected IConfigStore |
mConfig |
protected java.util.Vector<java.lang.String> |
mDontSaveHttpParams |
protected java.lang.String |
mFinalErrorMsg |
protected java.lang.String |
mGetClientCert |
protected java.lang.String |
mId |
protected int |
mLogCategory |
protected ILogger |
mLogger |
protected java.lang.String |
mOutputTemplatePath |
protected boolean |
mRenderResult |
protected IRequestQueue |
mRequestQueue |
protected java.util.Vector<java.lang.String> |
mSaveHttpHeaders |
protected javax.servlet.ServletConfig |
mServletConfig |
protected javax.servlet.ServletContext |
mServletContext |
protected ILogger |
mSignedAuditLogger |
protected java.util.Hashtable<java.lang.Integer,CMSLoadTemplate> |
mTemplates |
protected static java.lang.String |
OCSP_AGENT_GROUP |
protected static java.lang.String |
PENDING_TEMPLATE |
static java.lang.String |
PFX_AUTH_TOKEN |
static java.lang.String |
PFX_HTTP_HEADER |
static java.lang.String |
PFX_HTTP_PARAM |
static java.lang.String |
PROP_ACL |
static java.lang.String |
PROP_AUTHMGR |
static java.lang.String |
PROP_AUTHORITY |
static java.lang.String |
PROP_AUTHORITYID |
static java.lang.String |
PROP_AUTHZ_MGR |
static java.lang.String |
PROP_CLIENTAUTH |
protected static java.lang.String |
PROP_ERROR_TEMPLATE |
protected static java.lang.String |
PROP_EXCEPTION_TEMPLATE |
static java.lang.String |
PROP_FINAL_ERROR_MSG |
static java.lang.String |
PROP_ID |
protected static java.lang.String |
PROP_PENDING_TEMPLATE |
protected static java.lang.String |
PROP_REJECTED_TEMPLATE |
static java.lang.String |
PROP_RESOURCEID |
protected static java.lang.String |
PROP_SUCCESS_TEMPLATE |
protected static java.lang.String |
PROP_SUCCESS_TEMPLATE_FILLER |
protected static java.lang.String |
PROP_SVC_PENDING_TEMPLATE |
protected static java.lang.String |
PROP_UNAUTHORIZED_TEMPLATE |
protected static java.lang.String |
RA_AGENT_GROUP |
protected static java.lang.String |
REJECTED_TEMPLATE |
protected javax.servlet.ServletConfig |
servletConfig |
static java.lang.String |
SIMPLE_ENROLLMENT_REQUEST |
static java.lang.String |
SIMPLE_ENROLLMENT_RESPONSE |
static java.lang.String |
SUCCESS |
protected static java.lang.String |
SUCCESS_TEMPLATE |
protected static java.lang.String |
SVC_PENDING_TEMPLATE |
static java.lang.String |
TEMPLATE_NAME |
protected static java.lang.String |
TRUSTED_RA_GROUP |
protected static java.lang.String |
UNAUTHORIZED_TEMPLATE |
Constructor and Description |
---|
CMSServlet() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
areCertsFromCA(java.security.cert.X509Certificate[] certs)
handy routine for checking if a list of certs is from this CA.
|
protected void |
audit(java.lang.String msg)
Signed Audit Log
This method is inherited by all extended "CMSServlet"s,
and is called to store messages to the signed audit log.
|
protected java.lang.String |
auditGroupID()
Signed Audit Log Group ID
This method is inherited by all extended "CMSServlet"s,
and is called to obtain the "gid" for
a signed audit log message.
|
protected java.lang.String |
auditSubjectID()
Signed Audit Log Subject ID
This method is inherited by all extended "CMSServlet"s,
and is called to obtain the "SubjectID" for
a signed audit log message.
|
IAuthToken |
authenticate(CMSRequest req) |
IAuthToken |
authenticate(CMSRequest req,
java.lang.String authMgrName) |
IAuthToken |
authenticate(javax.servlet.http.HttpServletRequest httpReq) |
IAuthToken |
authenticate(javax.servlet.http.HttpServletRequest httpReq,
java.lang.String authMgrName)
Authentication
|
AuthzToken |
authorize(java.lang.String authzMgrName,
IAuthToken authToken,
java.lang.String resource,
java.lang.String operation)
Authorize must occur after Authenticate
|
AuthzToken |
authorize(java.lang.String authzMgrName,
java.lang.String resource,
IAuthToken authToken,
java.lang.String exp) |
protected boolean |
certIsRevoked(java.math.BigInteger serialNum)
check if a certificate (serial number) is revoked on a CA.
|
protected boolean |
checkImportCertToNav(javax.servlet.http.HttpServletResponse httpResp,
IArgBlock httpParams,
netscape.security.x509.X509CertImpl cert) |
static boolean |
clientIsMSIE(javax.servlet.http.HttpServletRequest httpReq)
handy routine to check if client is msie based on user-agent.
|
static boolean |
clientIsNav(javax.servlet.http.HttpServletRequest httpReq)
handy routine to check if client is navigator based on user-agent.
|
protected static boolean |
connectionIsSSL(javax.servlet.http.HttpServletRequest httpReq) |
static boolean |
doCMMFResponse(IArgBlock httpParams) |
static boolean |
doFullResponse(IArgBlock httpParams) |
protected netscape.security.x509.RevokedCertImpl |
formCRLEntry(java.math.BigInteger serialNo,
netscape.security.x509.RevocationReason reason)
make a CRL entry from a serial number and revocation reason.
|
static java.lang.String |
generateSalt() |
static AuthCredentials |
getAuthCreds(IAuthManager authMgr,
IArgBlock argBlock,
java.security.cert.X509Certificate clientCert)
construct a authentication credentials to pass into authentication
manager.
|
java.lang.String |
getAuthMgr() |
protected IAuthToken |
getAuthToken(IRequest req) |
protected ICertRecord |
getCertRecord(java.math.BigInteger serialNo)
handy routine for getting a cert record given a serial number.
|
protected void |
getDontSaveHttpParams(javax.servlet.ServletConfig sc)
get http parameters not to save from configuration.
|
java.lang.String |
getId() |
static java.io.File |
getLangFile(javax.servlet.http.HttpServletRequest req,
java.io.File realpathFile,
java.util.Locale[] locale) |
protected java.util.Locale |
getLocale(javax.servlet.http.HttpServletRequest req)
Retrieves locale based on the request.
|
static java.util.Locale |
getLocale(java.lang.String lang) |
protected java.lang.String |
getRelPath(IAuthority authority)
handy routine for getting agent's relative path
|
protected void |
getSaveHttpHeaders(javax.servlet.ServletConfig sc)
get http headers to save from configuration.
|
protected java.security.cert.X509Certificate |
getSSLClientCertificate(javax.servlet.http.HttpServletRequest httpReq)
get ssl client authenticated certificate
|
protected CMSTemplate |
getTemplate(java.lang.String templateName,
javax.servlet.http.HttpServletRequest httpReq,
java.util.Locale[] locale)
get a template based on result status.
|
protected java.security.cert.X509Certificate |
getX509Certificate(java.math.BigInteger serialNo)
handy routine for getting a certificate from the certificate
repository.
|
protected java.lang.String |
hashPassword(java.lang.String pwd) |
void |
importCertToNav(javax.servlet.http.HttpServletResponse httpResp,
netscape.security.x509.X509CertImpl cert,
java.lang.String contentType,
boolean importCAChain)
handy routine to import cert to old navigator in nav mime type.
|
void |
init(javax.servlet.ServletConfig sc) |
protected static void |
invalidateSSLSession(javax.servlet.http.HttpServletRequest httpReq)
Invalidates a SSL Session.
|
protected boolean |
isCertFromCA(java.security.cert.X509Certificate cert)
handy routine for validating if a cert is from this CA.
|
boolean |
isClientCertRequired() |
protected boolean |
isSystemCertificate(java.math.BigInteger serialNo)
A system certificate such as the CA signing certificate
should not be allowed to delete.
|
protected void |
log(int event,
int level,
java.lang.String msg)
log according to authority category.
|
protected void |
log(int level,
java.lang.String msg) |
protected CMSRequest |
newCMSRequest()
Create a new CMSRequest object.
|
protected ICMSTemplateFiller |
newFillerObject(java.lang.String fillerClass)
instantiate a new filler from a class name,
|
protected void |
outputArgBlockAsXML(XMLObject xmlObj,
org.w3c.dom.Node parent,
java.lang.String argBlockName,
IArgBlock argBlock) |
protected void |
outputError(javax.servlet.http.HttpServletResponse httpResp,
java.lang.String errorString) |
protected void |
outputError(javax.servlet.http.HttpServletResponse httpResp,
java.lang.String errorString,
java.lang.String requestId) |
protected void |
outputError(javax.servlet.http.HttpServletResponse httpResp,
java.lang.String status,
java.lang.String errorString,
java.lang.String requestId) |
void |
outputHttpParameters(javax.servlet.http.HttpServletRequest httpReq) |
protected void |
outputResult(javax.servlet.http.HttpServletResponse httpResp,
java.lang.String contentType,
byte[] content) |
protected void |
outputXML(javax.servlet.http.HttpServletResponse httpResp,
CMSTemplateParams params) |
protected void |
process(CMSRequest cmsRequest)
process an HTTP request.
|
protected void |
renderException(CMSRequest cmsReq,
EBaseException e)
Output exception (unexpected error) template
This is different from other templates in that if an exception occurs
while rendering the exception a message is printed out directly.
|
void |
renderFinalError(CMSRequest cmsReq,
java.lang.Exception ex) |
protected void |
renderResult(CMSRequest cmsReq)
Output a template.
|
protected void |
renderTemplate(CMSRequest cmsReq,
java.lang.String templateName,
ICMSTemplateFiller filler) |
protected static void |
saveAuthToken(IAuthToken token,
IRequest req) |
protected void |
saveHttpHeaders(javax.servlet.http.HttpServletRequest httpReq,
IRequest req)
save http headers in a IRequest.
|
protected void |
saveHttpParams(IArgBlock httpParams,
IRequest req)
save http headers in a IRequest.
|
void |
service(javax.servlet.http.HttpServletRequest httpReq,
javax.servlet.http.HttpServletResponse httpResp) |
protected void |
setDefaultTemplates(javax.servlet.ServletConfig sc)
set default templates.
|
static java.util.Hashtable<java.lang.String,java.lang.String> |
toHashtable(javax.servlet.http.HttpServletRequest req) |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public static final java.lang.String SUCCESS
public static final java.lang.String FAILURE
public static final java.lang.String AUTH_FAILURE
public static final java.lang.String PROP_ID
public static final java.lang.String PROP_AUTHORITY
public static final java.lang.String PROP_AUTHORITYID
public static final java.lang.String PROP_AUTHMGR
public static final java.lang.String PROP_CLIENTAUTH
public static final java.lang.String PROP_RESOURCEID
public static final java.lang.String AUTHZ_SRC_LDAP
public static final java.lang.String AUTHZ_SRC_TYPE
public static final java.lang.String AUTHZ_CONFIG_STORE
public static final java.lang.String AUTHZ_SRC_XML
public static final java.lang.String PROP_AUTHZ_MGR
public static final java.lang.String PROP_ACL
public static final java.lang.String AUTHZ_MGR_BASIC
public static final java.lang.String AUTHZ_MGR_LDAP
public static final java.lang.String PROP_FINAL_ERROR_MSG
public static final java.lang.String ERROR_MSG_TOKEN
public static final java.lang.String FINAL_ERROR_MSG
protected static final java.lang.String PROP_UNAUTHORIZED_TEMPLATE
protected static final java.lang.String UNAUTHORIZED_TEMPLATE
protected static final java.lang.String PROP_SUCCESS_TEMPLATE
protected static final java.lang.String SUCCESS_TEMPLATE
protected static final java.lang.String PROP_PENDING_TEMPLATE
protected static final java.lang.String PENDING_TEMPLATE
protected static final java.lang.String PROP_SVC_PENDING_TEMPLATE
protected static final java.lang.String SVC_PENDING_TEMPLATE
protected static final java.lang.String PROP_REJECTED_TEMPLATE
protected static final java.lang.String REJECTED_TEMPLATE
protected static final java.lang.String PROP_ERROR_TEMPLATE
protected static final java.lang.String ERROR_TEMPLATE
protected static final java.lang.String PROP_EXCEPTION_TEMPLATE
protected static final java.lang.String EXCEPTION_TEMPLATE
protected static final java.lang.String PROP_SUCCESS_TEMPLATE_FILLER
protected static final java.lang.String RA_AGENT_GROUP
protected static final java.lang.String CA_AGENT_GROUP
protected static final java.lang.String KRA_AGENT_GROUP
protected static final java.lang.String OCSP_AGENT_GROUP
protected static final java.lang.String TRUSTED_RA_GROUP
protected static final java.lang.String ADMIN_GROUP
public static final java.lang.String PFX_HTTP_HEADER
public static final java.lang.String PFX_HTTP_PARAM
public static final java.lang.String PFX_AUTH_TOKEN
protected static final java.lang.String AUTHMGR_PARAM
public static final java.lang.String CERT_ATTR
protected javax.servlet.ServletConfig servletConfig
protected boolean mRenderResult
protected java.lang.String mFinalErrorMsg
protected java.util.Hashtable<java.lang.Integer,CMSLoadTemplate> mTemplates
protected javax.servlet.ServletConfig mServletConfig
protected javax.servlet.ServletContext mServletContext
protected java.util.Vector<java.lang.String> mDontSaveHttpParams
protected java.util.Vector<java.lang.String> mSaveHttpHeaders
protected java.lang.String mId
protected IConfigStore mConfig
protected IAuthority mAuthority
protected ICertificateAuthority certAuthority
protected IRequestQueue mRequestQueue
protected ILogger mLogger
protected int mLogCategory
protected java.lang.String mGetClientCert
protected java.lang.String mAuthMgr
protected IAuthzSubsystem mAuthz
protected java.lang.String mAclMethod
protected java.lang.String mAuthzResourceName
protected ILogger mSignedAuditLogger
protected java.lang.String mOutputTemplatePath
public static final java.lang.String TEMPLATE_NAME
public static final java.lang.String SIMPLE_ENROLLMENT_REQUEST
public static final java.lang.String SIMPLE_ENROLLMENT_RESPONSE
public static final java.lang.String FULL_ENROLLMENT_REQUEST
public static final java.lang.String FULL_ENROLLMENT_RESPONSE
public static java.lang.String FULL_RESPONSE
public static java.util.Hashtable<java.lang.String,java.lang.String> toHashtable(javax.servlet.http.HttpServletRequest req)
public void init(javax.servlet.ServletConfig sc) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
public java.lang.String getId()
public java.lang.String getAuthMgr()
public boolean isClientCertRequired()
public void outputHttpParameters(javax.servlet.http.HttpServletRequest httpReq)
public void service(javax.servlet.http.HttpServletRequest httpReq, javax.servlet.http.HttpServletResponse httpResp) throws javax.servlet.ServletException, java.io.IOException
service
in class javax.servlet.http.HttpServlet
javax.servlet.ServletException
java.io.IOException
protected CMSRequest newCMSRequest()
protected void process(CMSRequest cmsRequest) throws java.lang.Exception
EBaseException
- if the servlet was unable to satisfactorily
process the requestjava.lang.Exception
protected void renderResult(CMSRequest cmsReq) throws java.io.IOException
cmsReq
- the CS requestjava.io.IOException
protected void outputArgBlockAsXML(XMLObject xmlObj, org.w3c.dom.Node parent, java.lang.String argBlockName, IArgBlock argBlock)
protected void outputXML(javax.servlet.http.HttpServletResponse httpResp, CMSTemplateParams params)
protected void renderTemplate(CMSRequest cmsReq, java.lang.String templateName, ICMSTemplateFiller filler) throws java.io.IOException
java.io.IOException
protected void renderException(CMSRequest cmsReq, EBaseException e) throws java.io.IOException
cmsReq
- the CS request to pass to template filler if any.e
- the unexpected exceptionjava.io.IOException
public void renderFinalError(CMSRequest cmsReq, java.lang.Exception ex) throws java.io.IOException
java.io.IOException
protected static void invalidateSSLSession(javax.servlet.http.HttpServletRequest httpReq)
public static AuthCredentials getAuthCreds(IAuthManager authMgr, IArgBlock argBlock, java.security.cert.X509Certificate clientCert) throws EBaseException
EBaseException
protected java.security.cert.X509Certificate getSSLClientCertificate(javax.servlet.http.HttpServletRequest httpReq) throws EBaseException
EBaseException
protected CMSTemplate getTemplate(java.lang.String templateName, javax.servlet.http.HttpServletRequest httpReq, java.util.Locale[] locale) throws EBaseException, java.io.IOException
EBaseException
java.io.IOException
protected void log(int event, int level, java.lang.String msg)
protected void log(int level, java.lang.String msg)
protected void getDontSaveHttpParams(javax.servlet.ServletConfig sc)
protected void getSaveHttpHeaders(javax.servlet.ServletConfig sc)
protected void saveHttpHeaders(javax.servlet.http.HttpServletRequest httpReq, IRequest req) throws EBaseException
EBaseException
protected void saveHttpParams(IArgBlock httpParams, IRequest req)
protected ICertRecord getCertRecord(java.math.BigInteger serialNo)
protected boolean isCertFromCA(java.security.cert.X509Certificate cert)
protected boolean areCertsFromCA(java.security.cert.X509Certificate[] certs)
protected java.security.cert.X509Certificate getX509Certificate(java.math.BigInteger serialNo)
protected ICMSTemplateFiller newFillerObject(java.lang.String fillerClass)
protected void setDefaultTemplates(javax.servlet.ServletConfig sc)
public static boolean clientIsNav(javax.servlet.http.HttpServletRequest httpReq)
public static boolean clientIsMSIE(javax.servlet.http.HttpServletRequest httpReq)
public static boolean doCMMFResponse(IArgBlock httpParams)
public static boolean doFullResponse(IArgBlock httpParams)
protected boolean checkImportCertToNav(javax.servlet.http.HttpServletResponse httpResp, IArgBlock httpParams, netscape.security.x509.X509CertImpl cert) throws EBaseException
EBaseException
public void importCertToNav(javax.servlet.http.HttpServletResponse httpResp, netscape.security.x509.X509CertImpl cert, java.lang.String contentType, boolean importCAChain) throws EBaseException
EBaseException
protected static void saveAuthToken(IAuthToken token, IRequest req)
protected IAuthToken getAuthToken(IRequest req)
protected static boolean connectionIsSSL(javax.servlet.http.HttpServletRequest httpReq)
protected java.lang.String getRelPath(IAuthority authority)
protected boolean isSystemCertificate(java.math.BigInteger serialNo) throws EBaseException
EBaseException
protected netscape.security.x509.RevokedCertImpl formCRLEntry(java.math.BigInteger serialNo, netscape.security.x509.RevocationReason reason) throws EBaseException
EBaseException
protected boolean certIsRevoked(java.math.BigInteger serialNum) throws EBaseException
EBaseException
public static java.lang.String generateSalt()
protected java.lang.String hashPassword(java.lang.String pwd)
public static java.io.File getLangFile(javax.servlet.http.HttpServletRequest req, java.io.File realpathFile, java.util.Locale[] locale) throws java.io.IOException
req
- http servlet requestrealpathFile
- the file to get.locale
- array of at least one to be filled with locale found.java.io.IOException
public static java.util.Locale getLocale(java.lang.String lang)
public IAuthToken authenticate(CMSRequest req) throws EBaseException
EBaseException
public IAuthToken authenticate(javax.servlet.http.HttpServletRequest httpReq) throws EBaseException
EBaseException
public IAuthToken authenticate(CMSRequest req, java.lang.String authMgrName) throws EBaseException
EBaseException
public IAuthToken authenticate(javax.servlet.http.HttpServletRequest httpReq, java.lang.String authMgrName) throws EBaseException
EBaseException
- an error has occurredpublic AuthzToken authorize(java.lang.String authzMgrName, java.lang.String resource, IAuthToken authToken, java.lang.String exp) throws EBaseException
EBaseException
public AuthzToken authorize(java.lang.String authzMgrName, IAuthToken authToken, java.lang.String resource, java.lang.String operation) throws EBaseException
authzMgrName
- string representing the name of the authorization
managerauthToken
- the authentication tokenresource
- a string representing the ACL resource id as defined in
the ACL resource listoperation
- a string representing one of the operations as defined
within the ACL statement (e. g. - "read" for an ACL statement containing
"(read,write)")EBaseException
- an error has occurredprotected void audit(java.lang.String msg)
msg
- signed audit log messageprotected java.lang.String auditSubjectID()
protected java.lang.String auditGroupID()
protected java.util.Locale getLocale(javax.servlet.http.HttpServletRequest req)
protected void outputResult(javax.servlet.http.HttpServletResponse httpResp, java.lang.String contentType, byte[] content)
protected void outputError(javax.servlet.http.HttpServletResponse httpResp, java.lang.String errorString)
protected void outputError(javax.servlet.http.HttpServletResponse httpResp, java.lang.String errorString, java.lang.String requestId)
protected void outputError(javax.servlet.http.HttpServletResponse httpResp, java.lang.String status, java.lang.String errorString, java.lang.String requestId)