Class AdminServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.netscape.cms.servlet.admin.AdminServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable
- Direct Known Subclasses:
ACLAdminServlet, AuthAdminServlet, CMSAdminServlet, JobsAdminServlet, LogAdminServlet, PolicyAdminServlet, UsrGrpAdminServlet
public class AdminServlet
extends jakarta.servlet.http.HttpServlet
A class represents an administration servlet that
is responsible to serve administrative
operation such as configuration parameter updates.
Since each administration servlet needs to perform
authentication information parsing and response
formulation, it makes sense to encapsulate the
commonalities into this class.
By extending this serlvet, the subclass does not
need to re-implement the request parsing code
(i.e. authentication information parsing).
If a subsystem needs to expose configuration
parameters management, it should create an
administration servlet (i.e. CAAdminServlet)
and register it to RemoteAdmin subsystem.
public class CAAdminServlet extends AdminServlet {
...
}
- Version:
- $Revision$, $Date$
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected static Stringstatic final Stringstatic intstatic org.slf4j.Loggerprotected Stringprotected AuthzSubsystemprotected EngineConfigprotected Stringprotected AuthzTokenstatic final Stringstatic final Stringstatic final Stringstatic intprotected jakarta.servlet.ServletConfigprotected jakarta.servlet.ServletContextstatic intFields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringauditParams(jakarta.servlet.http.HttpServletRequest req) Signed Audit Parameters This method is inherited by all extended admin servlets and is called to extract parameters from the HttpServletRequest and return a string of name;;value pairs separated by a '+' if more than one name;;value pair exists.protected StringSigned 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.protected voidauthenticate(jakarta.servlet.http.HttpServletRequest req) Authenticates to the identity scope with the given userid and password via identity manager.protected AuthzTokenauthorize(jakarta.servlet.http.HttpServletRequest req) Authorize must occur after Authenticatebooleanauthorize a user based on its authentication credentials.protected voidcommit(boolean createBackup) FileConfigStorage functionality The original config file is moved to. . protected NameValuePairsstatic AuthCredentialsgetAuthCreds(AuthManager authMgr, X509Certificate clientCert) protected static IExtendedPluginInfogetClassByNameAsExtendedPluginInfo(String className) protected voidgetConfig(ConfigStore config, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Generic configuration store get operation.protected LocalegetLocale(jakarta.servlet.http.HttpServletRequest req) Retrieves locale based on the request.protected StringgetParameter(jakarta.servlet.http.HttpServletRequest req, String name) voidinit(jakarta.servlet.ServletConfig sc) Initializes the servlet.protected voidlistConfig(ConfigStore config, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Lists configuration store.voidoutputHttpParameters(jakarta.servlet.http.HttpServletRequest httpReq) protected voidsendResponse(int returnCode, String errorMsg, NameValuePairs params, jakarta.servlet.http.HttpServletResponse resp) Sends response.voidservice(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Serves HTTP admin request.protected voidsetConfig(ConfigStore config, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) Generic configuration store set operation.protected StringURL decodes the given string.Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
logger
public static org.slf4j.Logger logger -
servletConfig
protected jakarta.servlet.ServletConfig servletConfig -
servletContext
protected jakarta.servlet.ServletContext servletContext -
mConfig
-
mAuthz
-
mAclMethod
-
mOp
-
AUTHZ_RES_NAME
-
mToken
-
PROP_AUTHZ_MGR
- See Also:
-
PROP_ACL
- See Also:
-
AUTHZ_MGR_BASIC
- See Also:
-
AUTHZ_MGR_LDAP
- See Also:
-
PROP_ID
- See Also:
-
CERT_ATTR
- See Also:
-
SUCCESS
public static int SUCCESS -
ERROR
public static int ERROR -
RESTART
public static int RESTART
-
-
Constructor Details
-
AdminServlet
public AdminServlet()Constructs generic administration servlet.
-
-
Method Details
-
getCMSEngine
-
init
public void init(jakarta.servlet.ServletConfig sc) throws jakarta.servlet.ServletException Initializes the servlet.- Specified by:
initin interfacejakarta.servlet.Servlet- Overrides:
initin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletException
-
outputHttpParameters
public void outputHttpParameters(jakarta.servlet.http.HttpServletRequest httpReq) -
service
public void service(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException Serves HTTP admin request.- Overrides:
servicein classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
authenticate
Authenticates to the identity scope with the given userid and password via identity manager.- signed.audit LOGGING_SIGNED_AUDIT_AUTH_FAIL used when authentication fails (in case of SSL-client auth, only webserver env can pick up the SSL violation; CMS authMgr can pick up cert mis-match, so this event is used)
- signed.audit LOGGING_SIGNED_AUDIT_AUTH_SUCCESS used when authentication succeeded
- Throws:
IOException- an input/output error has occurred
-
getAuthCreds
public static AuthCredentials getAuthCreds(AuthManager authMgr, X509Certificate clientCert) throws EBaseException - Throws:
EBaseException
-
authorize
Authorize must occur after Authenticate- signed.audit LOGGING_SIGNED_AUDIT_AUTHZ_FAIL used when authorization has failed
- signed.audit LOGGING_SIGNED_AUDIT_AUTHZ_SUCCESS used when authorization is successful
- signed.audit LOGGING_SIGNED_AUDIT_ROLE_ASSUME used when user assumes a role (in current CMS that's when one accesses a role port)
- Parameters:
req- HTTP servlet request- Returns:
- the authorization token
-
getLocale
Retrieves locale based on the request. -
sendResponse
protected void sendResponse(int returnCode, String errorMsg, NameValuePairs params, jakarta.servlet.http.HttpServletResponse resp) throws IOException Sends response.- Parameters:
returnCode- return codeerrorMsg- localized error messageparams- result parametersresp- HTTP servlet response- Throws:
IOException
-
URLdecode
-
getParameter
-
getConfig
protected void getConfig(ConfigStore config, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException, EBaseException Generic configuration store get operation.- Throws:
jakarta.servlet.ServletExceptionIOExceptionEBaseException
-
setConfig
protected void setConfig(ConfigStore config, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException, EBaseException Generic configuration store set operation. The caller is responsible to do validiation before calling this, and commit changes after this call.- Throws:
jakarta.servlet.ServletExceptionIOExceptionEBaseException
-
listConfig
protected void listConfig(ConfigStore config, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException, EBaseException Lists configuration store.- Throws:
jakarta.servlet.ServletExceptionIOExceptionEBaseException
-
authorize
authorize a user based on its authentication credentials.- Throws:
EBaseException
-
commit
FileConfigStorage functionality The original config file is moved to. . Commits the current properties to the configuration file. - Parameters:
createBackup- true if a backup file should be created- Throws:
EBaseException
-
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.- Returns:
- id string containing the signed audit log message SubjectID
-
auditParams
Signed Audit Parameters This method is inherited by all extended admin servlets and is called to extract parameters from the HttpServletRequest and return a string of name;;value pairs separated by a '+' if more than one name;;value pair exists.- Parameters:
req- HTTP servlet request- Returns:
- a delimited string of one or more delimited name/value pairs
-
convertStringArrayToNVPairs
-
getClassByNameAsExtendedPluginInfo
-