summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2011-12-08 21:15:59 -0500
committerAde Lee <alee@redhat.com>2011-12-08 21:15:59 -0500
commit171aaece4f23709d33d180cf36eb3af5e454b0c9 (patch)
tree1485f9f0a7bd10de4ff25030db575dbb8dafae74 /pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java
parentadad2fcee8a29fdb82376fbce07dedb11fccc182 (diff)
downloadpki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.gz
pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.xz
pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.zip
Revert "Formatting"
This reverts commit 32150d3ee32f8ac27118af7c792794b538c78a2f.
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, 59 insertions, 47 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 71b7a97c..1eaf476b 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,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Enumeration;
import java.util.Locale;
import java.util.Vector;
@@ -40,14 +41,16 @@ 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();
@@ -55,12 +58,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;
}
@@ -71,17 +74,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
*/
@@ -89,21 +92,23 @@ 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);
}
@@ -123,7 +128,8 @@ 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 {
@@ -135,7 +141,7 @@ public abstract class EnrollInput implements IProfileInput {
try {
if (mConfig == null) {
return null;
- }
+ }
if (mConfig.getSubStore("params") != null) {
return mConfig.getSubStore("params").getString(name);
}
@@ -149,7 +155,7 @@ public abstract class EnrollInput implements IProfileInput {
}
public String getValue(String name, Locale locale, IRequest request)
- throws EProfileException {
+ throws EProfileException {
return request.getExtDataInString(name);
}
@@ -157,14 +163,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);
}
@@ -175,16 +181,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();
@@ -196,53 +202,54 @@ 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) {
@@ -253,17 +260,21 @@ 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() {
@@ -278,7 +289,8 @@ 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();