diff options
author | Endi S. Dewata <edewata@redhat.com> | 2014-03-27 21:42:38 -0400 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2014-03-29 18:20:55 -0400 |
commit | c6a220a439404409904fd2f7526fab30295a3ee4 (patch) | |
tree | 428f66606d56723c617c34cdc852558654d19e4d /base/common/src/com/netscape/certsrv/tps | |
parent | ef56ae955857d607f04e5298bf200c755d1d0ca5 (diff) | |
download | pki-c6a220a439404409904fd2f7526fab30295a3ee4.tar.gz pki-c6a220a439404409904fd2f7526fab30295a3ee4.tar.xz pki-c6a220a439404409904fd2f7526fab30295a3ee4.zip |
Refactored TPS authenticators.
The TPS authenticators has been modified to use PATCH for update operation
as required by Backbone. The AuthenticatorData class has been modified to
accept null properties to indicate that the properties are not being
updated. The AuthenticatorModel class has been modified to use JSON data
type for enable and disable operations.
Ticket #654
Diffstat (limited to 'base/common/src/com/netscape/certsrv/tps')
-rw-r--r-- | base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorData.java | 29 | ||||
-rw-r--r-- | base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorResource.java | 4 |
2 files changed, 9 insertions, 24 deletions
diff --git a/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorData.java b/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorData.java index d55dde126..2984d66eb 100644 --- a/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorData.java +++ b/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorData.java @@ -21,7 +21,6 @@ package com.netscape.certsrv.tps.authenticator; import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; -import java.util.Collection; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -62,7 +61,7 @@ public class AuthenticatorData { String id; String status; - Map<String, String> properties = new LinkedHashMap<String, String>(); + Map<String, String> properties; Link link; @@ -91,24 +90,7 @@ public class AuthenticatorData { } public void setProperties(Map<String, String> properties) { - this.properties.clear(); - this.properties.putAll(properties); - } - - public Collection<String> getPropertyNames() { - return properties.keySet(); - } - - public String getProperty(String name) { - return properties.get(name); - } - - public void setProperty(String name, String value) { - properties.put(name, value); - } - - public String removeProperty(String name) { - return properties.remove(name); + this.properties = properties; } public static class MapAdapter extends XmlAdapter<PropertyList, Map<String, String>> { @@ -223,8 +205,11 @@ public class AuthenticatorData { AuthenticatorData before = new AuthenticatorData(); before.setID("authenticator1"); before.setStatus("ENABLED"); - before.setProperty("param1", "value1"); - before.setProperty("param2", "value2"); + + Map<String, String> properties = new LinkedHashMap<String, String>(); + properties.put("param1", "value1"); + properties.put("param2", "value2"); + before.setProperties(properties); String string = before.toString(); System.out.println(string); diff --git a/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorResource.java b/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorResource.java index 457549eca..d21ad552c 100644 --- a/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorResource.java +++ b/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorResource.java @@ -20,7 +20,6 @@ package com.netscape.certsrv.tps.authenticator; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; -import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; @@ -30,6 +29,7 @@ import org.jboss.resteasy.annotations.ClientResponseType; import com.netscape.certsrv.acls.ACLMapping; import com.netscape.certsrv.authentication.AuthMethodMapping; +import com.netscape.certsrv.base.PATCH; /** @@ -57,7 +57,7 @@ public interface AuthenticatorResource { @ClientResponseType(entityType=AuthenticatorData.class) public Response addAuthenticator(AuthenticatorData authenticatorData); - @PUT + @PATCH @Path("{authenticatorID}") @ACLMapping("authenticators.modify") @ClientResponseType(entityType=AuthenticatorData.class) |