diff options
author | Endi S. Dewata <edewata@redhat.com> | 2016-02-02 04:15:02 +0100 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2016-02-03 01:57:21 +0100 |
commit | ce872456a09f5c5d146c6cb465b2466ad3ddc73d (patch) | |
tree | e0575b424ebc4cbd46577a1b02a0ef5a3ae7727c /base/common/src/com/netscape/certsrv/tps | |
parent | d42f39334ce4b4f5fa89707bfb6145039ff04579 (diff) | |
download | pki-ce872456a09f5c5d146c6cb465b2466ad3ddc73d.tar.gz pki-ce872456a09f5c5d146c6cb465b2466ad3ddc73d.tar.xz pki-ce872456a09f5c5d146c6cb465b2466ad3ddc73d.zip |
Fixed TPS token state transitions.
The TPS service has been modified to provide a list of allowed
state transitions based on the current token state. The TPS UI
was modified to display only the allowed state transitions when
changing the token status.
The allowed state transition list has been modified to remove
invalid token transitions including:
* UNINITIALIZED -> FOUND
* UNINITIALIZED -> TEMP_LOST_PERM_LOST
The token FOUND state has been renamed to ACTIVE for clarity.
The token TEMP_LOST_PERM_LOST state has been merged into
PERM_LOST since they are identical in the database.
https://fedorahosted.org/pki/ticket/1289
https://fedorahosted.org/pki/ticket/1291
https://fedorahosted.org/pki/ticket/1684
Diffstat (limited to 'base/common/src/com/netscape/certsrv/tps')
-rw-r--r-- | base/common/src/com/netscape/certsrv/tps/token/TokenClient.java | 5 | ||||
-rw-r--r-- | base/common/src/com/netscape/certsrv/tps/token/TokenData.java | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/base/common/src/com/netscape/certsrv/tps/token/TokenClient.java b/base/common/src/com/netscape/certsrv/tps/token/TokenClient.java index 32a56b3d4..a62e71cf8 100644 --- a/base/common/src/com/netscape/certsrv/tps/token/TokenClient.java +++ b/base/common/src/com/netscape/certsrv/tps/token/TokenClient.java @@ -60,6 +60,11 @@ public class TokenClient extends Client { return client.getEntity(response, TokenData.class); } + public TokenData changeTokenStatus(String tokenID, TokenStatus tokenStatus) { + Response response = resource.changeTokenStatus(tokenID, tokenStatus); + return client.getEntity(response, TokenData.class); + } + public void removeToken(String tokenID) { Response response = resource.removeToken(tokenID); client.getEntity(response, Void.class); 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 235e86fea..9947bf658 100644 --- a/base/common/src/com/netscape/certsrv/tps/token/TokenData.java +++ b/base/common/src/com/netscape/certsrv/tps/token/TokenData.java @@ -20,6 +20,7 @@ package com.netscape.certsrv.tps.token; import java.io.StringReader; import java.io.StringWriter; +import java.util.Collection; import java.util.Date; import javax.xml.bind.JAXBContext; @@ -54,7 +55,10 @@ public class TokenData { String tokenID; String userID; String type; + TokenStatus status; + Collection<TokenStatus> nextStates; + String appletID; String keyInfo; String policy; @@ -108,6 +112,15 @@ public class TokenData { this.status = status; } + @XmlElement(name="NextStates") + public Collection<TokenStatus> getNextStates() { + return nextStates; + } + + public void setNextStates(Collection<TokenStatus> nextStates) { + this.nextStates = nextStates; + } + @XmlElement(name="AppletID") public String getAppletID() { return appletID; @@ -172,6 +185,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 + ((nextStates == null) ? 0 : nextStates.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()); @@ -219,6 +233,11 @@ public class TokenData { return false; } else if (!modifyTimestamp.equals(other.modifyTimestamp)) return false; + if (nextStates == null) { + if (other.nextStates != null) + return false; + } else if (!nextStates.equals(other.nextStates)) + return false; if (policy == null) { if (other.policy != null) return false; |