summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java')
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java106
1 files changed, 47 insertions, 59 deletions
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java b/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java
index 1eaf476b9..71b7a97cd 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
-
import java.util.Enumeration;
import java.util.Locale;
import java.util.Vector;
@@ -41,16 +40,14 @@ import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cms.profile.common.EnrollProfile;
-
/**
* This class implements the base enrollment input.
- *
+ *
* @version $Revision$, $Date$
*/
-public abstract class EnrollInput implements IProfileInput {
+public abstract class EnrollInput implements IProfileInput {
- private final static String LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION =
- "LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION_2";
+ private final static String LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION = "LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION_2";
protected IConfigStore mConfig = null;
protected Vector mValueNames = new Vector();
@@ -58,12 +55,12 @@ public abstract class EnrollInput implements IProfileInput {
protected IProfile mProfile = null;
protected ILogger mSignedAuditLogger = CMS.getSignedAuditLogger();
-
+
/**
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
mConfig = config;
mProfile = profile;
}
@@ -74,17 +71,17 @@ public abstract class EnrollInput implements IProfileInput {
/**
* Populates the request with this policy default.
- *
+ *
* @param ctx profile context
* @param request request
* @exception EProfileException failed to populate
*/
public abstract void populate(IProfileContext ctx, IRequest request)
- throws EProfileException;
+ throws EProfileException;
/**
* Retrieves the localizable name of this policy.
- *
+ *
* @param locale user locale
* @return localized input name
*/
@@ -92,23 +89,21 @@ public abstract class EnrollInput implements IProfileInput {
/**
* Retrieves the localizable description of this policy.
- *
+ *
* @param locale user locale
* @return localized input description
*/
public abstract String getText(Locale locale);
/**
- * Retrieves the descriptor of the given value
- * property by name.
- *
+ * Retrieves the descriptor of the given value property by name.
+ *
* @param locale user locale
* @param name property name
* @return descriptor of the property
*/
public abstract IDescriptor getValueDescriptor(Locale locale, String name);
-
public void addValueName(String name) {
mValueNames.addElement(name);
}
@@ -128,8 +123,7 @@ public abstract class EnrollInput implements IProfileInput {
return mConfigNames.elements();
}
- public void setConfig(String name, String value)
- throws EPropertyException {
+ public void setConfig(String name, String value) throws EPropertyException {
if (mConfig.getSubStore("params") == null) {
//
} else {
@@ -141,7 +135,7 @@ public abstract class EnrollInput implements IProfileInput {
try {
if (mConfig == null) {
return null;
- }
+ }
if (mConfig.getSubStore("params") != null) {
return mConfig.getSubStore("params").getString(name);
}
@@ -155,7 +149,7 @@ public abstract class EnrollInput implements IProfileInput {
}
public String getValue(String name, Locale locale, IRequest request)
- throws EProfileException {
+ throws EProfileException {
return request.getExtDataInString(name);
}
@@ -163,14 +157,14 @@ public abstract class EnrollInput implements IProfileInput {
* Sets the value of the given value parameter by name.
*/
public void setValue(String name, Locale locale, IRequest request,
- String value) throws EPropertyException {
+ String value) throws EPropertyException {
request.setExtData(name, value);
}
public Locale getLocale(IRequest request) {
Locale locale = null;
- String language = request.getExtDataInString(
- EnrollProfile.REQUEST_LOCALE);
+ String language = request
+ .getExtDataInString(EnrollProfile.REQUEST_LOCALE);
if (language != null) {
locale = new Locale(language);
}
@@ -181,16 +175,16 @@ public abstract class EnrollInput implements IProfileInput {
return null;
}
- public void verifyPOP(Locale locale, CertReqMsg certReqMsg)
- throws EProfileException {
- CMS.debug("EnrollInput ::in verifyPOP");
+ public void verifyPOP(Locale locale, CertReqMsg certReqMsg)
+ throws EProfileException {
+ CMS.debug("EnrollInput ::in verifyPOP");
String auditMessage = null;
String auditSubjectID = auditSubjectID();
- if (!certReqMsg.hasPop()) {
+ if (!certReqMsg.hasPop()) {
CMS.debug("CertReqMsg has not POP, return");
- return;
+ return;
}
ProofOfPossession pop = certReqMsg.getPop();
ProofOfPossession.Type popType = pop.getType();
@@ -202,54 +196,53 @@ public abstract class EnrollInput implements IProfileInput {
try {
if (CMS.getConfigStore().getBoolean("cms.skipPOPVerify", false)) {
- CMS.debug("skipPOPVerify on, return");
- return;
+ CMS.debug("skipPOPVerify on, return");
+ return;
}
CMS.debug("POP verification begins:");
CryptoManager cm = CryptoManager.getInstance();
CryptoToken verifyToken = null;
- String tokenName = CMS.getConfigStore().getString("ca.requestVerify.token", "internal");
+ String tokenName = CMS.getConfigStore().getString(
+ "ca.requestVerify.token", "internal");
if (tokenName.equals("internal")) {
CMS.debug("POP verification using internal token");
certReqMsg.verify();
} else {
- CMS.debug("POP verification using token:"+ tokenName);
+ CMS.debug("POP verification using token:" + tokenName);
verifyToken = cm.getTokenByName(tokenName);
certReqMsg.verify(verifyToken);
}
// store a message in the signed audit log file
auditMessage = CMS.getLogMessage(
- LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION,
- auditSubjectID,
- ILogger.SUCCESS );
- audit( auditMessage );
+ LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION, auditSubjectID,
+ ILogger.SUCCESS);
+ audit(auditMessage);
} catch (Exception e) {
- CMS.debug("Failed POP verify! "+e.toString());
+ CMS.debug("Failed POP verify! " + e.toString());
CMS.debug(e);
// store a message in the signed audit log file
auditMessage = CMS.getLogMessage(
- LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION,
- auditSubjectID,
- ILogger.FAILURE );
+ LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION, auditSubjectID,
+ ILogger.FAILURE);
- audit( auditMessage );
+ audit(auditMessage);
- throw new EProfileException(CMS.getUserMessage(locale,
- "CMS_POP_VERIFICATION_ERROR"));
+ throw new EProfileException(CMS.getUserMessage(locale,
+ "CMS_POP_VERIFICATION_ERROR"));
}
}
/**
* Signed Audit Log
- *
- * This method is inherited by all extended "CMSServlet"s,
- * and is called to store messages to the signed audit log.
+ *
+ * This method is inherited by all extended "CMSServlet"s, and is called to
+ * store messages to the signed audit log.
* <P>
- *
+ *
* @param msg signed audit log message
*/
protected void audit(String msg) {
@@ -260,21 +253,17 @@ public abstract class EnrollInput implements IProfileInput {
return;
}
- mSignedAuditLogger.log(ILogger.EV_SIGNED_AUDIT,
- null,
- ILogger.S_SIGNED_AUDIT,
- ILogger.LL_SECURITY,
- msg);
+ mSignedAuditLogger.log(ILogger.EV_SIGNED_AUDIT, null,
+ ILogger.S_SIGNED_AUDIT, ILogger.LL_SECURITY, msg);
}
/**
* 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.
+ *
+ * This method is inherited by all extended "CMSServlet"s, and is called to
+ * obtain the "SubjectID" for a signed audit log message.
* <P>
- *
+ *
* @return id string containing the signed audit log message SubjectID
*/
protected String auditSubjectID() {
@@ -289,8 +278,7 @@ public abstract class EnrollInput implements IProfileInput {
SessionContext auditContext = SessionContext.getExistingContext();
if (auditContext != null) {
- subjectID = (String)
- auditContext.get(SessionContext.USER_ID);
+ subjectID = (String) auditContext.get(SessionContext.USER_ID);
if (subjectID != null) {
subjectID = subjectID.trim();