diff options
Diffstat (limited to 'base/tps-tomcat/src')
-rw-r--r-- | base/tps-tomcat/src/org/dogtagpki/server/tps/dbs/TokenRecord.java | 42 | ||||
-rw-r--r-- | base/tps-tomcat/src/org/dogtagpki/server/tps/rest/TokenService.java | 9 |
2 files changed, 51 insertions, 0 deletions
diff --git a/base/tps-tomcat/src/org/dogtagpki/server/tps/dbs/TokenRecord.java b/base/tps-tomcat/src/org/dogtagpki/server/tps/dbs/TokenRecord.java index 11fecce58..a1aef5720 100644 --- a/base/tps-tomcat/src/org/dogtagpki/server/tps/dbs/TokenRecord.java +++ b/base/tps-tomcat/src/org/dogtagpki/server/tps/dbs/TokenRecord.java @@ -33,6 +33,32 @@ public class TokenRecord extends DBRecord { private static final long serialVersionUID = 1L; + /** + * objectClasses: ( tokenRecord-oid + * NAME 'tokenRecord' + * DESC 'CMS defined class' + * SUP top + * STRUCTURAL + * MUST cn + * MAY ( + * dateOfCreate $ + * dateOfModify $ + * modified $ (unused) + * tokenReason $ + * tokenUserID $ + * tokenStatus $ + * tokenAppletID $ + * keyInfo $ + * tokenPolicy $ + * extensions $ (unused) + * numberOfResets $ (unused) + * numberOfEnrollments $ (unused) + * numberOfRenewals $ (unused) + * numberOfRecoveries $ (unused) + * userCertificate $ (unused) + * tokenType ) + * X-ORIGIN 'user defined' ) + */ String id; String userID; String type; @@ -40,6 +66,7 @@ public class TokenRecord extends DBRecord { String reason; String appletID; String keyInfo; + String policy; Date createTimestamp; Date modifyTimestamp; @@ -106,6 +133,15 @@ public class TokenRecord extends DBRecord { this.keyInfo = keyInfo; } + @DBAttribute("tokenPolicy") + public String getPolicy() { + return policy; + } + + public void setPolicy(String policy) { + this.policy = policy; + } + @DBAttribute("dateOfCreate") public Date getCreateTimestamp() { return createTimestamp; @@ -133,6 +169,7 @@ public class TokenRecord extends DBRecord { result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((keyInfo == null) ? 0 : keyInfo.hashCode()); result = prime * result + ((modifyTimestamp == null) ? 0 : modifyTimestamp.hashCode()); + result = prime * result + ((policy == null) ? 0 : policy.hashCode()); result = prime * result + ((reason == null) ? 0 : reason.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); @@ -174,6 +211,11 @@ public class TokenRecord extends DBRecord { return false; } else if (!modifyTimestamp.equals(other.modifyTimestamp)) return false; + if (policy == null) { + if (other.policy != null) + return false; + } else if (!policy.equals(other.policy)) + return false; if (reason == null) { if (other.reason != null) return false; diff --git a/base/tps-tomcat/src/org/dogtagpki/server/tps/rest/TokenService.java b/base/tps-tomcat/src/org/dogtagpki/server/tps/rest/TokenService.java index 09adf5491..84046a964 100644 --- a/base/tps-tomcat/src/org/dogtagpki/server/tps/rest/TokenService.java +++ b/base/tps-tomcat/src/org/dogtagpki/server/tps/rest/TokenService.java @@ -164,6 +164,7 @@ public class TokenService extends PKIService implements TokenResource { tokenData.setStatus(getTokenStatus(tokenRecord)); tokenData.setAppletID(tokenRecord.getAppletID()); tokenData.setKeyInfo(tokenRecord.getKeyInfo()); + tokenData.setPolicy(tokenRecord.getPolicy()); tokenData.setCreateTimestamp(tokenRecord.getCreateTimestamp()); tokenData.setModifyTimestamp(tokenRecord.getModifyTimestamp()); @@ -190,6 +191,7 @@ public class TokenService extends PKIService implements TokenResource { setTokenStatus(tokenRecord, tokenData.getStatus()); tokenRecord.setAppletID(tokenData.getAppletID()); tokenRecord.setKeyInfo(tokenData.getKeyInfo()); + tokenRecord.setPolicy(tokenData.getPolicy()); tokenRecord.setCreateTimestamp(tokenData.getCreateTimestamp()); tokenRecord.setModifyTimestamp(tokenData.getModifyTimestamp()); @@ -330,6 +332,7 @@ public class TokenService extends PKIService implements TokenResource { tokenRecord.setType(tokenData.getType()); tokenRecord.setAppletID(tokenData.getAppletID()); tokenRecord.setKeyInfo(tokenData.getKeyInfo()); + tokenRecord.setPolicy(tokenData.getPolicy()); database.updateRecord(tokenID, tokenRecord); subsystem.tdb.tdbActivity(subsystem, ActivityDatabase.OP_DO_TOKEN, tokenRecord, ipAddress, msg, "success", @@ -393,6 +396,12 @@ public class TokenService extends PKIService implements TokenResource { tokenRecord.setKeyInfo(keyInfo); } + // update policy if specified + String policy = tokenData.getPolicy(); + if (policy != null) { + tokenRecord.setPolicy(policy); + } + database.updateRecord(tokenID, tokenRecord); subsystem.tdb.tdbActivity(subsystem, ActivityDatabase.OP_DO_TOKEN, tokenRecord, ipAddress, msg, "success", |