diff options
author | Endi S. Dewata <edewata@redhat.com> | 2015-04-08 02:21:56 -0400 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2015-04-08 18:08:11 -0400 |
commit | 94ab251fd231919db05cf2e928102c15a5f2fc3c (patch) | |
tree | e0924f225b404b37f0deeb8bd17f8fbe94d1a707 /base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java | |
parent | b2082c227af0b3f27162ead335cd46bd145dba35 (diff) | |
download | pki-94ab251fd231919db05cf2e928102c15a5f2fc3c.tar.gz pki-94ab251fd231919db05cf2e928102c15a5f2fc3c.tar.xz pki-94ab251fd231919db05cf2e928102c15a5f2fc3c.zip |
Fixed problem with TPS profile default status.
The base class of ProfileDatabase (i.e. CSCfgDatabase) has been
modified to return the correct default value (i.e. Enabled) if the
status parameter doesn't exist. The TPSProcessor has been modified
to use ProfileDatabase and other TPS codes have also been changed
to use constants instead of string literals to ensure consistency.
https://fedorahosted.org/pki/ticket/1270
Diffstat (limited to 'base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java')
-rw-r--r-- | base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java b/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java index f9a0445d6..500dad412 100644 --- a/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java +++ b/base/tps/src/org/dogtagpki/server/tps/processor/TPSProcessor.java @@ -47,6 +47,7 @@ import org.dogtagpki.server.tps.cms.TKSComputeRandomDataResponse; import org.dogtagpki.server.tps.cms.TKSComputeSessionKeyResponse; import org.dogtagpki.server.tps.cms.TKSEncryptDataResponse; import org.dogtagpki.server.tps.cms.TKSRemoteRequestHandler; +import org.dogtagpki.server.tps.config.ProfileDatabase; import org.dogtagpki.server.tps.dbs.ActivityDatabase; import org.dogtagpki.server.tps.dbs.TPSCertRecord; import org.dogtagpki.server.tps.dbs.TokenRecord; @@ -88,6 +89,7 @@ import com.netscape.certsrv.authentication.IAuthToken; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.EPropertyNotFound; import com.netscape.certsrv.base.IConfigStore; +import com.netscape.certsrv.common.Constants; import com.netscape.certsrv.tps.token.TokenStatus; import com.netscape.symkey.SessionKey; @@ -125,6 +127,8 @@ public class TPSProcessor { protected BeginOpMsg beginMsg; private PlatformAndSecChannelProtoInfo platProtInfo; + ProfileDatabase profileDatabase = new ProfileDatabase(); + public TPSProcessor(TPSSession session) { setSession(session); } @@ -2110,22 +2114,18 @@ public class TPSProcessor { void checkProfileStateOK() throws TPSException { - IConfigStore configStore = CMS.getConfigStore(); + CMS.debug("TPSProcessor.checkProfileStateOK()"); - String profileConfig = "config.Profiles." + selectedTokenType + ".state"; String profileState = null; - - CMS.debug("TPSProcessor.checkProfileStateOK: config value to check: " + profileConfig); - try { - profileState = configStore.getString(profileConfig, TPSEngine.CFG_ENABLED); + profileState = profileDatabase.getRecordStatus(selectedTokenType); } catch (EBaseException e) { //Default TPSException will return a "contact admin" error code. throw new TPSException( "TPSProcessor.checkProfileStateOK: internal error in getting profile state from config."); } - if (!profileState.equals(TPSEngine.CFG_ENABLED)) { + if (!profileState.equals(Constants.CFG_ENABLED)) { CMS.debug("TPSProcessor.checkProfileStateOK: profile specifically disabled."); throw new TPSException("TPSProcessor.checkProfileStateOK: profile disabled!"); } |