diff options
8 files changed, 111 insertions, 32 deletions
diff --git a/base/common/src/com/netscape/certsrv/tps/token/TokenData.java b/base/common/src/com/netscape/certsrv/tps/token/TokenData.java index 27ee1fa20..235e86fea 100644 --- a/base/common/src/com/netscape/certsrv/tps/token/TokenData.java +++ b/base/common/src/com/netscape/certsrv/tps/token/TokenData.java @@ -57,6 +57,7 @@ public class TokenData { TokenStatus status; String appletID; String keyInfo; + String policy; Date createTimestamp; Date modifyTimestamp; @@ -125,6 +126,15 @@ public class TokenData { this.keyInfo = keyInfo; } + @XmlElement(name="Policy") + public String getPolicy() { + return policy; + } + + public void setPolicy(String policy) { + this.policy = policy; + } + @XmlElement(name="CreateTimestamp") public Date getCreateTimestamp() { return createTimestamp; @@ -162,6 +172,7 @@ public class TokenData { result = prime * result + ((keyInfo == null) ? 0 : keyInfo.hashCode()); result = prime * result + ((link == null) ? 0 : link.hashCode()); result = prime * result + ((modifyTimestamp == null) ? 0 : modifyTimestamp.hashCode()); + result = prime * result + ((policy == null) ? 0 : policy.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((tokenID == null) ? 0 : tokenID.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); @@ -208,6 +219,11 @@ public class TokenData { 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 (status != other.status) return false; if (tokenID == null) { @@ -256,6 +272,7 @@ public class TokenData { before.setStatus(TokenStatus.ACTIVE); before.setAppletID("APPLET1234"); before.setKeyInfo("key info"); + before.setPolicy("FORCE_FORMAT=YES"); before.setCreateTimestamp(new Date()); before.setModifyTimestamp(new Date()); diff --git a/base/java-tools/src/com/netscape/cmstools/tps/token/TokenCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/token/TokenCLI.java index df3ab2890..40d1f9447 100644 --- a/base/java-tools/src/com/netscape/cmstools/tps/token/TokenCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/tps/token/TokenCLI.java @@ -56,6 +56,7 @@ public class TokenCLI extends CLI { if (token.getStatus() != null) System.out.println(" Status: " + token.getStatus()); if (token.getAppletID() != null) System.out.println(" Applet ID: " + token.getAppletID()); if (token.getKeyInfo() != null) System.out.println(" Key Info: " + token.getKeyInfo()); + if (token.getPolicy() != null) System.out.println(" Policy: " + token.getPolicy()); if (token.getCreateTimestamp() != null) System.out.println(" Date Created: " + token.getCreateTimestamp()); if (token.getModifyTimestamp() != null) System.out.println(" Date Modified: " + token.getModifyTimestamp()); diff --git a/base/tps-tomcat/shared/webapps/tps/js/token.js b/base/tps-tomcat/shared/webapps/tps/js/token.js index 085003a1e..2ea17714e 100644 --- a/base/tps-tomcat/shared/webapps/tps/js/token.js +++ b/base/tps-tomcat/shared/webapps/tps/js/token.js @@ -40,6 +40,7 @@ var TokenModel = Model.extend({ statusLabel: TokenStatus[response.Status], appletID: response.AppletID, keyInfo: response.KeyInfo, + policy: response.Policy, createTimestamp: response.CreateTimestamp, modifyTimestamp: response.ModifyTimestamp }; @@ -53,6 +54,7 @@ var TokenModel = Model.extend({ Status: attributes.status, AppletID: attributes.appletID, KeyInfo: attributes.keyInfo, + Policy: attributes.policy, CreateTimestamp: attributes.createTimestamp, ModifyTimestamp: attributes.modifyTimestamp }; @@ -91,6 +93,7 @@ var TokenCollection = Collection.extend({ statusLabel: TokenStatus[entry.Status], appletID: entry.AppletID, keyInfo: entry.KeyInfo, + policy: entry.Policy, createTimestamp: entry.CreateTimestamp, modifyTimestamp: entry.ModifyTimestamp }); @@ -191,7 +194,8 @@ var TokenTableItem = TableItem.extend({ el: $("#token-status-dialog"), title: "Change Token Status", readonly: ["tokenID", "userID", "type", - "appletID", "keyInfo", "createTimestamp", "modifyTimestamp"], + "appletID", "keyInfo", "policy", + "createTimestamp", "modifyTimestamp"], actions: ["cancel", "save"] }); diff --git a/base/tps-tomcat/shared/webapps/tps/ui/index.html b/base/tps-tomcat/shared/webapps/tps/ui/index.html index d1fa78b67..eddceefd7 100644 --- a/base/tps-tomcat/shared/webapps/tps/ui/index.html +++ b/base/tps-tomcat/shared/webapps/tps/ui/index.html @@ -272,7 +272,7 @@ $(function() { el: content, url: "token.html", model: new TokenModel({ id: id }), - editable: ["userID", "type", "appletID", "keyInfo"] + editable: ["userID", "type", "appletID", "keyInfo", "policy"] }).open(); }); @@ -283,7 +283,7 @@ $(function() { model: new TokenModel(), mode: "add", title: "New Token", - editable: ["tokenID", "userID", "type", "appletID", "keyInfo"], + editable: ["tokenID", "userID", "type", "appletID", "keyInfo", "policy"], parentHash: "#tokens" }).open(); }); diff --git a/base/tps-tomcat/shared/webapps/tps/ui/token.html b/base/tps-tomcat/shared/webapps/tps/ui/token.html index 6d34af5d2..78384acfe 100644 --- a/base/tps-tomcat/shared/webapps/tps/ui/token.html +++ b/base/tps-tomcat/shared/webapps/tps/ui/token.html @@ -54,6 +54,8 @@ <input name="appletID" readonly="readonly"><br> <label>Key Info</label> <input name="keyInfo" readonly="readonly"><br> + <label>Policy</label> + <input name="policy" readonly="readonly"><br> <label>Created</label> <input name="createTimestamp" readonly="readonly"><br> <label>Modified</label> diff --git a/base/tps-tomcat/shared/webapps/tps/ui/tokens.html b/base/tps-tomcat/shared/webapps/tps/ui/tokens.html index 98ae769aa..aca579a68 100644 --- a/base/tps-tomcat/shared/webapps/tps/ui/tokens.html +++ b/base/tps-tomcat/shared/webapps/tps/ui/tokens.html @@ -27,7 +27,7 @@ <table name="tokens"> <thead> <tr> - <th class="pki-table-actions" colspan="9"> + <th class="pki-table-actions" colspan="10"> <span name="search"> <input name="search" type="text" placeholder="Search..."> </span> @@ -45,6 +45,7 @@ <th>Status</th> <th>Applet ID</th> <th>Key Info</th> + <th>Policy</th> <th>Created</th> <th>Modified</th> </tr> @@ -58,13 +59,14 @@ <td name="status"><a href="#tokens/${id}/status">${statusLabel}</a></td> <td name="appletID">${appletID}</td> <td name="keyInfo">${keyInfo}</td> + <td name="policy">${policy}</td> <td name="created">${createTimestamp}</td> <td name="modified">${modifyTimestamp}</td> </tr> </tbody> <tfoot> <tr> - <th class="pki-table-actions" colspan="9"> + <th class="pki-table-actions" colspan="10"> <div class="pki-table-info"> Total: <span name="totalEntries">0</span> entries </div> @@ -96,35 +98,37 @@ <h4 class="modal-title">Change Token Status</h4> </div> <div class="modal-body"> - <fieldset> - <label>Token ID</label> - <input name="tokenID" readonly="readonly"><br> - <label>User ID</label> - <input name="userID" readonly="readonly"><br> - <label>Type</label> - <input name="type" readonly="readonly"><br> - <label>Status</label> - <select name="status"> - <option value="UNINITIALIZED">Uninitialized</option> - <option value="ACTIVE">Active</option> - <option value="TEMP_LOST">Temporarily lost</option> - <option value="PERM_LOST">Permanently lost</option> - <option value="DAMAGED">Physically damaged</option> - <option value="TERMINATED">Terminated</option> - </select><br> - <label>Applet ID</label> - <input name="appletID" readonly="readonly"><br> - <label>Key Info</label> - <input name="keyInfo" readonly="readonly"><br> - <label>Created</label> - <input name="createTimestamp" readonly="readonly"><br> - <label>Modified</label> - <input name="modifyTimestamp" readonly="readonly"><br> - </fieldset> + <fieldset> + <label>Token ID</label> + <input name="tokenID" readonly="readonly"><br> + <label>User ID</label> + <input name="userID" readonly="readonly"><br> + <label>Type</label> + <input name="type" readonly="readonly"><br> + <label>Status</label> + <select name="status"> + <option value="UNINITIALIZED">Uninitialized</option> + <option value="ACTIVE">Active</option> + <option value="TEMP_LOST">Temporarily lost</option> + <option value="PERM_LOST">Permanently lost</option> + <option value="DAMAGED">Physically damaged</option> + <option value="TERMINATED">Terminated</option> + </select><br> + <label>Applet ID</label> + <input name="appletID" readonly="readonly"><br> + <label>Key Info</label> + <input name="keyInfo" readonly="readonly"><br> + <label>Policy</label> + <input name="policy" readonly="readonly"><br> + <label>Created</label> + <input name="createTimestamp" readonly="readonly"><br> + <label>Modified</label> + <input name="modifyTimestamp" readonly="readonly"><br> + </fieldset> </div> <div class="modal-footer"> - <button name="save" class="btn btn-primary">Save</button> - <button name="cancel" class="btn btn-default" data-dismiss="modal">Cancel</button> + <button name="save" class="btn btn-primary">Save</button> + <button name="cancel" class="btn btn-default" data-dismiss="modal">Cancel</button> </div> </div> </div> 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", |