diff --git a/android/Pubnub-Android-3.5.2.jar b/android/Pubnub-Android-3.5.2.jar index eea437a9d..3055b4fb1 100644 Binary files a/android/Pubnub-Android-3.5.2.jar and b/android/Pubnub-Android-3.5.2.jar differ diff --git a/android/examples/PubnubExample/libs/Pubnub-Android-3.5.2.jar b/android/examples/PubnubExample/libs/Pubnub-Android-3.5.2.jar index eea437a9d..3055b4fb1 100644 Binary files a/android/examples/PubnubExample/libs/Pubnub-Android-3.5.2.jar and b/android/examples/PubnubExample/libs/Pubnub-Android-3.5.2.jar differ diff --git a/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.2.jar b/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.2.jar index eea437a9d..3055b4fb1 100644 Binary files a/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.2.jar and b/android/examples/SubscribeAtBoot/libs/Pubnub-Android-3.5.2.jar differ diff --git a/blackberry/Pubnub-BlackBerry-3.5.2.jar b/blackberry/Pubnub-BlackBerry-3.5.2.jar index 3acf8010d..6762768d8 100644 Binary files a/blackberry/Pubnub-BlackBerry-3.5.2.jar and b/blackberry/Pubnub-BlackBerry-3.5.2.jar differ diff --git a/codenameone/pubnub-codenameone-3.5.2.cn1lib b/codenameone/pubnub-codenameone-3.5.2.cn1lib index ca180e8aa..7fd81f996 100644 Binary files a/codenameone/pubnub-codenameone-3.5.2.cn1lib and b/codenameone/pubnub-codenameone-3.5.2.cn1lib differ diff --git a/j2me/Pubnub-MicroEdition-3.5.2.jar b/j2me/Pubnub-MicroEdition-3.5.2.jar index f44c27e41..0b3b57cde 100644 Binary files a/j2me/Pubnub-MicroEdition-3.5.2.jar and b/j2me/Pubnub-MicroEdition-3.5.2.jar differ diff --git a/j2me/src1/com/pubnub/api/HttpClientCore.java b/j2me/src1/com/pubnub/api/HttpClientCore.java index be0b564d4..c66d3744c 100644 --- a/j2me/src1/com/pubnub/api/HttpClientCore.java +++ b/j2me/src1/com/pubnub/api/HttpClientCore.java @@ -11,6 +11,8 @@ import com.tinyline.util.GZIPInputStream; +import org.json.me.*; + public class HttpClientCore extends HttpClient { private int requestTimeout = 310000; private int connectionTimeout = 5000; @@ -89,11 +91,11 @@ public boolean checkResponse(int rc) { return (rc == HttpConnection.HTTP_OK || isRedirect(rc)); } - public HttpResponse fetch(String url) throws IOException { + public HttpResponse fetch(String url) throws PubnubException, IOException { return fetch(url, null); } - public HttpResponse fetch(String url, Hashtable headers) throws IOException { + public HttpResponse fetch(String url, Hashtable headers) throws PubnubException, IOException { if (url == null) throw new IOException("Invalid Url"); @@ -159,6 +161,37 @@ public HttpResponse fetch(String url, Hashtable headers) throws IOException { } response = readResponse(hc); + switch (rc) { + case HttpUtil.HTTP_FORBIDDEN: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_FORBIDDEN, response)); + case HttpUtil.HTTP_UNAUTHORIZED: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_UNAUTHORIZED, response)); + case HttpUtil.HTTP_BAD_REQUEST: + try { + JSONArray jsarr = new JSONArray(response); + String error = jsarr.get(1).toString(); + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_BAD_REQUEST, 1, error)); + } catch (JSONException e) { + JSONObject jso; + try { + jso = new JSONObject(response); + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_BAD_REQUEST, 2, jso.toString())); + } catch (JSONException e1) { + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_INVALID_JSON, 2)); + } + } + case HttpUtil.HTTP_BAD_GATEWAY: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_BAD_GATEWAY, url)); + case HttpUtil.HTTP_CLIENT_TIMEOUT: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_CLIENT_TIMEOUT, url)); + case HttpUtil.HTTP_GATEWAY_TIMEOUT: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_GATEWAY_TIMEOUT, url)); + case HttpUtil.HTTP_INTERNAL_ERROR: + throw new PubnubException(PubnubError.getErrorObject(PubnubError.PNERROBJ_INTERNAL_ERROR, url)); + default: + break; + } + hc.close(); return new HttpResponse(rc, response); } diff --git a/j2me/src1/com/pubnub/api/SubscribeWorker.java b/j2me/src1/com/pubnub/api/SubscribeWorker.java index 33c387cf0..ffde6b11d 100644 --- a/j2me/src1/com/pubnub/api/SubscribeWorker.java +++ b/j2me/src1/com/pubnub/api/SubscribeWorker.java @@ -5,6 +5,8 @@ class SubscribeWorker extends AbstractSubscribeWorker { + private Exception excp = null; + SubscribeWorker(Vector _requestQueue, int connectionTimeout, int requestTimeout, int maxRetries, int retryInterval, Hashtable headers) { super(_requestQueue, connectionTimeout, requestTimeout, @@ -33,7 +35,22 @@ void process(HttpRequest hreq) { } break; - } */catch (Exception e) { + }*/catch (PubnubException e) { + excp = e; + switch (e.getPubnubError().errorCode) { + case PubnubError.PNERR_FORBIDDEN: + case PubnubError.PNERR_UNAUTHORIZED: + log.verbose("Authentication Failure : " + e.toString()); + currentRetryAttempt = maxRetries + 1; + break; + default: + log.verbose("Retry Attempt : " + ((currentRetryAttempt == maxRetries)?"last":String.valueOf(currentRetryAttempt)) + + " Exception in Fetch : " + e.toString()); + currentRetryAttempt++; + break; + } + + } catch (Exception e) { log.verbose("Retry Attempt : " + ((currentRetryAttempt == maxRetries)?"last":String.valueOf(currentRetryAttempt)) + " Exception in Fetch : " + e.toString()); currentRetryAttempt++; diff --git a/java/Pubnub-StandardEdition-3.5.2.jar b/java/Pubnub-StandardEdition-3.5.2.jar index d6e9981cf..1d7540326 100644 Binary files a/java/Pubnub-StandardEdition-3.5.2.jar and b/java/Pubnub-StandardEdition-3.5.2.jar differ diff --git a/java/doc/allclasses-frame.html b/java/doc/allclasses-frame.html index c3533a592..cb6a40441 100644 --- a/java/doc/allclasses-frame.html +++ b/java/doc/allclasses-frame.html @@ -2,7 +2,7 @@ - + All Classes diff --git a/java/doc/allclasses-noframe.html b/java/doc/allclasses-noframe.html index b37ab577a..e730e8232 100644 --- a/java/doc/allclasses-noframe.html +++ b/java/doc/allclasses-noframe.html @@ -2,7 +2,7 @@ - + All Classes diff --git a/java/doc/com/pubnub/api/Callback.html b/java/doc/com/pubnub/api/Callback.html index a9ea5ecf1..6774c5779 100644 --- a/java/doc/com/pubnub/api/Callback.html +++ b/java/doc/com/pubnub/api/Callback.html @@ -2,7 +2,7 @@ - + Callback diff --git a/java/doc/com/pubnub/api/HttpUtil.html b/java/doc/com/pubnub/api/HttpUtil.html index 09d88197f..afe9660a6 100644 --- a/java/doc/com/pubnub/api/HttpUtil.html +++ b/java/doc/com/pubnub/api/HttpUtil.html @@ -2,7 +2,7 @@ - + HttpUtil diff --git a/java/doc/com/pubnub/api/Pubnub.html b/java/doc/com/pubnub/api/Pubnub.html index 2b085649c..090099682 100644 --- a/java/doc/com/pubnub/api/Pubnub.html +++ b/java/doc/com/pubnub/api/Pubnub.html @@ -2,7 +2,7 @@ - + Pubnub @@ -492,6 +492,68 @@

 void +pamAudit(Callback callback) + +
+          ULS Audit + + + + void +pamAudit(java.lang.String channel, + Callback callback) + +
+          ULS audit by channel + + + + void +pamAudit(java.lang.String channel, + java.lang.String auth_key, + Callback callback) + +
+          ULS audit by channel and auth key + + + + void +pamGrant(java.lang.String channel, + java.lang.String auth_key, + boolean read, + boolean write, + Callback callback) + +
+          Grant r/w access based on channel and auth key + + + + void +pamGrant(java.lang.String channel, + java.lang.String auth_key, + boolean read, + boolean write, + int ttl, + Callback callback) + +
+          Grant r/w access based on channel and auth key + + + + void +pamRevoke(java.lang.String channel, + java.lang.String auth_key, + Callback callback) + +
+          ULS revoke by channel and auth key + + + + void presence(java.lang.String channel, Callback callback) @@ -752,55 +814,6 @@

 void -ulsAudit(Callback callback) - -
-          ULS Audit - - - - void -ulsAudit(java.lang.String channel, - Callback callback) - -
-          ULS audit by channel - - - - void -ulsAudit(java.lang.String channel, - java.lang.String auth_key, - Callback callback) - -
-          ULS audit by channel and auth key - - - - void -ulsGrant(java.lang.String channel, - java.lang.String auth_key, - boolean read, - boolean write, - Callback callback) - -
-          Grant r/w access based on channel and auth key - - - - void -ulsRevoke(java.lang.String channel, - java.lang.String auth_key, - Callback callback) - -
-          ULS revoke by channel and auth key - - - - void unsetAuthKey()
@@ -1421,13 +1434,31 @@


-

-ulsGrant

+

+pamGrant

+
+public void pamGrant(java.lang.String channel,
+                     java.lang.String auth_key,
+                     boolean read,
+                     boolean write,
+                     Callback callback)
+
+
Grant r/w access based on channel and auth key +

+

+
Parameters:
channel -
auth_key -
read -
write -
callback -
+
+
+
+ +

+pamGrant

-public void ulsGrant(java.lang.String channel,
+public void pamGrant(java.lang.String channel,
                      java.lang.String auth_key,
                      boolean read,
                      boolean write,
+                     int ttl,
                      Callback callback)
Grant r/w access based on channel and auth key @@ -1438,10 +1469,10 @@


-

-ulsAudit

+

+pamAudit

-public void ulsAudit(Callback callback)
+public void pamAudit(Callback callback)
ULS Audit

@@ -1451,10 +1482,10 @@


-

-ulsAudit

+

+pamAudit

-public void ulsAudit(java.lang.String channel,
+public void pamAudit(java.lang.String channel,
                      Callback callback)
ULS audit by channel @@ -1465,10 +1496,10 @@


-

-ulsAudit

+

+pamAudit

-public void ulsAudit(java.lang.String channel,
+public void pamAudit(java.lang.String channel,
                      java.lang.String auth_key,
                      Callback callback)
@@ -1480,10 +1511,10 @@


-

-ulsRevoke

+

+pamRevoke

-public void ulsRevoke(java.lang.String channel,
+public void pamRevoke(java.lang.String channel,
                       java.lang.String auth_key,
                       Callback callback)
diff --git a/java/doc/com/pubnub/api/PubnubError.html b/java/doc/com/pubnub/api/PubnubError.html index ae58e949a..884024581 100644 --- a/java/doc/com/pubnub/api/PubnubError.html +++ b/java/doc/com/pubnub/api/PubnubError.html @@ -2,7 +2,7 @@ - + PubnubError diff --git a/java/doc/com/pubnub/api/PubnubException.html b/java/doc/com/pubnub/api/PubnubException.html index fe367feee..d51be5515 100644 --- a/java/doc/com/pubnub/api/PubnubException.html +++ b/java/doc/com/pubnub/api/PubnubException.html @@ -2,7 +2,7 @@ - + PubnubException diff --git a/java/doc/com/pubnub/api/PubnubUtil.html b/java/doc/com/pubnub/api/PubnubUtil.html index 745329424..f7f64c147 100644 --- a/java/doc/com/pubnub/api/PubnubUtil.html +++ b/java/doc/com/pubnub/api/PubnubUtil.html @@ -2,7 +2,7 @@ - + PubnubUtil diff --git a/java/doc/com/pubnub/api/package-frame.html b/java/doc/com/pubnub/api/package-frame.html index 44807cb7e..0d5188933 100644 --- a/java/doc/com/pubnub/api/package-frame.html +++ b/java/doc/com/pubnub/api/package-frame.html @@ -2,7 +2,7 @@ - + com.pubnub.api diff --git a/java/doc/com/pubnub/api/package-summary.html b/java/doc/com/pubnub/api/package-summary.html index 3bd674a1f..225e0cafd 100644 --- a/java/doc/com/pubnub/api/package-summary.html +++ b/java/doc/com/pubnub/api/package-summary.html @@ -2,7 +2,7 @@ - + com.pubnub.api diff --git a/java/doc/com/pubnub/api/package-tree.html b/java/doc/com/pubnub/api/package-tree.html index d7ecc24fc..fb275bead 100644 --- a/java/doc/com/pubnub/api/package-tree.html +++ b/java/doc/com/pubnub/api/package-tree.html @@ -2,7 +2,7 @@ - + com.pubnub.api Class Hierarchy diff --git a/java/doc/constant-values.html b/java/doc/constant-values.html index d75f2fdbe..31f9bffbc 100644 --- a/java/doc/constant-values.html +++ b/java/doc/constant-values.html @@ -2,7 +2,7 @@ - + Constant Field Values diff --git a/java/doc/deprecated-list.html b/java/doc/deprecated-list.html index 56b8fc64d..341d92b21 100644 --- a/java/doc/deprecated-list.html +++ b/java/doc/deprecated-list.html @@ -2,7 +2,7 @@ - + Deprecated List diff --git a/java/doc/help-doc.html b/java/doc/help-doc.html index e3ac23686..9502ee6ef 100644 --- a/java/doc/help-doc.html +++ b/java/doc/help-doc.html @@ -2,7 +2,7 @@ - + API Help diff --git a/java/doc/index-all.html b/java/doc/index-all.html index c475f658b..5833431cf 100644 --- a/java/doc/index-all.html +++ b/java/doc/index-all.html @@ -2,7 +2,7 @@ - + Index @@ -249,6 +249,24 @@

P

+
pamAudit(Callback) - +Method in class com.pubnub.api.Pubnub +
ULS Audit +
pamAudit(String, Callback) - +Method in class com.pubnub.api.Pubnub +
ULS audit by channel +
pamAudit(String, String, Callback) - +Method in class com.pubnub.api.Pubnub +
ULS audit by channel and auth key +
pamGrant(String, String, boolean, boolean, Callback) - +Method in class com.pubnub.api.Pubnub +
Grant r/w access based on channel and auth key +
pamGrant(String, String, boolean, boolean, int, Callback) - +Method in class com.pubnub.api.Pubnub +
Grant r/w access based on channel and auth key +
pamRevoke(String, String, Callback) - +Method in class com.pubnub.api.Pubnub +
ULS revoke by channel and auth key
PNERR_CLIENT_TIMEOUT - Static variable in class com.pubnub.api.PubnubError
Client Timeout . @@ -390,21 +408,6 @@

U

-
ulsAudit(Callback) - -Method in class com.pubnub.api.Pubnub -
ULS Audit -
ulsAudit(String, Callback) - -Method in class com.pubnub.api.Pubnub -
ULS audit by channel -
ulsAudit(String, String, Callback) - -Method in class com.pubnub.api.Pubnub -
ULS audit by channel and auth key -
ulsGrant(String, String, boolean, boolean, Callback) - -Method in class com.pubnub.api.Pubnub -
Grant r/w access based on channel and auth key -
ulsRevoke(String, String, Callback) - -Method in class com.pubnub.api.Pubnub -
ULS revoke by channel and auth key
unsubscribe(Hashtable) - Method in class com.pubnub.api.Pubnub
Deprecated. as of version 3.5.2 and will be removed with 3.6.0 . Methods diff --git a/java/doc/index.html b/java/doc/index.html index b9b5e4827..ac452c1b6 100644 --- a/java/doc/index.html +++ b/java/doc/index.html @@ -2,7 +2,7 @@ - + Generated Documentation (Untitled) diff --git a/java/doc/overview-tree.html b/java/doc/overview-tree.html index 8611282ac..8e2c4e836 100644 --- a/java/doc/overview-tree.html +++ b/java/doc/overview-tree.html @@ -2,7 +2,7 @@ - + Class Hierarchy diff --git a/java/doc/serialized-form.html b/java/doc/serialized-form.html index c29493da5..0f8bab30e 100644 --- a/java/doc/serialized-form.html +++ b/java/doc/serialized-form.html @@ -2,7 +2,7 @@ - + Serialized Form diff --git a/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java b/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java index 79f83537a..fa84c3a85 100644 --- a/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java +++ b/java/examples/src/com/pubnub/examples/PubnubDemoConsole.java @@ -312,13 +312,13 @@ public void startDemo() { pubnub.setAuthKey(authKey); break; case 18: - ulsGrant(); + pamGrant(); break; case 19: - ulsRevoke(); + pamRevoke(); break; case 20: - ulsAudit(); + pamAudit(); break; case 21: pubnub.setOrigin(getStringFromConsole("Origin")); @@ -407,13 +407,14 @@ private boolean getBooleanFromConsole(String message) { return getBooleanFromConsole(message, false); } - private void ulsGrant() { + private void pamGrant() { String channel = getStringFromConsole("Channel"); String auth_key = getStringFromConsole("Auth Key"); boolean read = getBooleanFromConsole("Read"); boolean write = getBooleanFromConsole("Write"); + int ttl = getIntFromConsole("TTL"); - pubnub.ulsGrant(channel, auth_key, read, write, new Callback() { + pubnub.pamGrant(channel, auth_key, read, write, ttl, new Callback() { @Override public void successCallback(String channel, Object message) { @@ -428,7 +429,7 @@ public void errorCallback(String channel, PubnubError error) { }); } - private void ulsAudit() { + private void pamAudit() { String channel = getStringFromConsole("Channel", true); String auth_key = getStringFromConsole("Auth Key", true); @@ -446,21 +447,21 @@ public void errorCallback(String channel, PubnubError error) { if (channel != null && channel.length() > 0) { if (auth_key != null && auth_key.length() != 0) { - pubnub.ulsAudit(channel, auth_key, cb); + pubnub.pamAudit(channel, auth_key, cb); } else { - pubnub.ulsAudit(channel, cb); + pubnub.pamAudit(channel, cb); } } else { - pubnub.ulsAudit(cb); + pubnub.pamAudit(cb); } } - private void ulsRevoke() { + private void pamRevoke() { String channel = getStringFromConsole("Enter Channel"); String auth_key = getStringFromConsole("Auth Key"); - pubnub.ulsRevoke(channel, auth_key, new Callback() { + pubnub.pamRevoke(channel, auth_key, new Callback() { @Override public void successCallback(String channel, Object message) { @@ -511,9 +512,9 @@ private void displayMenuOptions() { notifyUser("ENTER 15 FOR Setting Subscribe Timeout ( current: " + pubnub.getSubscribeTimeout() + " milliseconds )"); notifyUser("ENTER 16 FOR Setting Non Subscribe Timeout ( current: " + pubnub.getNonSubscribeTimeout() + " milliseconds )"); notifyUser("ENTER 17 FOR Setting/Unsetting auth key ( current: " + pubnub.getAuthKey() + " )"); - notifyUser("ENTER 18 FOR ULS grant"); - notifyUser("ENTER 19 FOR ULS revoke"); - notifyUser("ENTER 20 FOR ULS Audit"); + notifyUser("ENTER 18 FOR PAM grant"); + notifyUser("ENTER 19 FOR PAM revoke"); + notifyUser("ENTER 20 FOR PAM Audit"); notifyUser("ENTER 21 FOR Setting Origin ( current: " + pubnub.getOrigin() + " )"); notifyUser("ENTER 22 FOR Setting Domain ( current: "+ pubnub.getDomain() + " )"); notifyUser("ENTER 23 FOR Enabling Cache Busting ( current: " + pubnub.getCacheBusting() + " )"); diff --git a/java/jars/Pubnub-UnitTests-3.5.2.jar b/java/jars/Pubnub-UnitTests-3.5.2.jar index 6e1948d99..3a5a398f3 100644 Binary files a/java/jars/Pubnub-UnitTests-3.5.2.jar and b/java/jars/Pubnub-UnitTests-3.5.2.jar differ diff --git a/java/jars/PubnubDemoConsole.jar b/java/jars/PubnubDemoConsole.jar index 3cd9fb550..9ac3d68d7 100644 Binary files a/java/jars/PubnubDemoConsole.jar and b/java/jars/PubnubDemoConsole.jar differ diff --git a/java/jars/PubnubExample.jar b/java/jars/PubnubExample.jar index 783d45506..1ddf96d19 100644 Binary files a/java/jars/PubnubExample.jar and b/java/jars/PubnubExample.jar differ diff --git a/java/src/com/pubnub/api/Pubnub.java b/java/src/com/pubnub/api/Pubnub.java index 288a08746..2b01ae4eb 100644 --- a/java/src/com/pubnub/api/Pubnub.java +++ b/java/src/com/pubnub/api/Pubnub.java @@ -524,7 +524,7 @@ public void subscribe(Hashtable args) throws PubnubException { super.subscribe(args); } - private String ulsSign(String key, String data) throws PubnubException { + private String pamSign(String key, String data) throws PubnubException { Mac sha256_HMAC; try { @@ -553,8 +553,20 @@ private String ulsSign(String key, String data) throws PubnubException { * @param write * @param callback */ - public void ulsGrant(final String channel, String auth_key, boolean read, + public void pamGrant(final String channel, String auth_key, boolean read, boolean write, final Callback callback) { + pamGrant(channel, auth_key, read, write, 0, callback); + } + + /** Grant r/w access based on channel and auth key + * @param channel + * @param auth_key + * @param read + * @param write + * @param callback + */ + public void pamGrant(final String channel, String auth_key, boolean read, + boolean write, int ttl, final Callback callback) { Hashtable parameters = hashtableClone(params); @@ -574,11 +586,12 @@ public void ulsGrant(final String channel, String auth_key, boolean read, String sign_input = this.SUBSCRIBE_KEY + "\n" + this.PUBLISH_KEY + "\n" + "grant" + "\n" + "auth=" + auth_key + "&" + "channel=" + channel + "&" + "r=" + r + "&" + "timestamp=" + timestamp + + ((ttl > 0)?"&" + "ttl=" + ttl:"") + "&" + "w=" + w; try { - signature = ulsSign(this.SECRET_KEY, sign_input); + signature = pamSign(this.SECRET_KEY, sign_input); } catch (PubnubException e1) { callback.errorCallback(channel, e1.getPubnubError()); @@ -592,8 +605,9 @@ public void ulsGrant(final String channel, String auth_key, boolean read, parameters.put("r", r); parameters.put("channel", channel); parameters.put("auth", auth_key); + if (ttl > 0) parameters.put("ttl", String.valueOf(ttl)); - String[] urlComponents = { getPubnubUrl(), "v2", "grant", "sub-key", + String[] urlComponents = { getPubnubUrl(), "v1", "auth", "grant", "sub-key", this.SUBSCRIBE_KEY }; @@ -625,7 +639,7 @@ public void handleError(HttpRequest hreq, PubnubError error) { /** ULS Audit * @param callback */ - public void ulsAudit(final Callback callback) { + public void pamAudit(final Callback callback) { Hashtable parameters = hashtableClone(params); @@ -645,7 +659,7 @@ public void ulsAudit(final Callback callback) { try { - signature = ulsSign(this.SECRET_KEY, sign_input); + signature = pamSign(this.SECRET_KEY, sign_input); } catch (PubnubException e1) { callback.errorCallback("", e1.getPubnubError()); @@ -655,7 +669,7 @@ public void ulsAudit(final Callback callback) { parameters.put("timestamp", String.valueOf(timestamp)); parameters.put("signature", signature); - String[] urlComponents = { getPubnubUrl(), "v2", "audit", "sub-key", + String[] urlComponents = { getPubnubUrl(), "v1", "auth", "audit", "sub-key", this.SUBSCRIBE_KEY }; @@ -688,7 +702,7 @@ public void handleError(HttpRequest hreq, PubnubError error) { * @param channel * @param callback */ - public void ulsAudit(final String channel, + public void pamAudit(final String channel, final Callback callback) { Hashtable parameters = hashtableClone(params); @@ -708,7 +722,7 @@ public void ulsAudit(final String channel, + channel + "&" + "timestamp=" + timestamp; try { - signature = ulsSign(this.SECRET_KEY, sign_input); + signature = pamSign(this.SECRET_KEY, sign_input); } catch (PubnubException e1) { callback.errorCallback(channel, e1.getPubnubError()); @@ -719,7 +733,7 @@ public void ulsAudit(final String channel, parameters.put("signature", signature); parameters.put("channel", channel); - String[] urlComponents = { getPubnubUrl(), "v2", "audit", "sub-key", + String[] urlComponents = { getPubnubUrl(), "v1", "auth", "audit", "sub-key", this.SUBSCRIBE_KEY }; @@ -753,7 +767,7 @@ public void handleError(HttpRequest hreq, PubnubError error) { * @param auth_key * @param callback */ - public void ulsAudit(final String channel, String auth_key, + public void pamAudit(final String channel, String auth_key, final Callback callback) { Hashtable parameters = hashtableClone(params); @@ -774,7 +788,7 @@ public void ulsAudit(final String channel, String auth_key, try { - signature = ulsSign(this.SECRET_KEY, sign_input); + signature = pamSign(this.SECRET_KEY, sign_input); } catch (PubnubException e1) { callback.errorCallback(channel, e1.getPubnubError()); @@ -786,7 +800,7 @@ public void ulsAudit(final String channel, String auth_key, parameters.put("channel", channel); parameters.put("auth", auth_key); - String[] urlComponents = { getPubnubUrl(), "v2", "audit", "sub-key", + String[] urlComponents = { getPubnubUrl(), "v1", "auth", "audit", "sub-key", this.SUBSCRIBE_KEY }; @@ -820,8 +834,8 @@ public void handleError(HttpRequest hreq, PubnubError error) { * @param auth_key * @param callback */ - public void ulsRevoke(String channel, String auth_key, Callback callback) { - ulsGrant(channel, auth_key, false, false, callback); + public void pamRevoke(String channel, String auth_key, Callback callback) { + pamGrant(channel, auth_key, false, false, callback); } } diff --git a/java/srcTest/com/pubnub/api/PubnubTest.java b/java/srcTest/com/pubnub/api/PubnubTest.java index 181b3bb69..9cbff0087 100644 --- a/java/srcTest/com/pubnub/api/PubnubTest.java +++ b/java/srcTest/com/pubnub/api/PubnubTest.java @@ -1670,7 +1670,7 @@ public void testUlsGrantRW() { pubnub.setDomain("pubnub.co"); pubnub.setOrigin("uls-test"); pubnub.setCacheBusting(false); - pubnub.ulsGrant("hello-uls", "abcd", true, true, ulscb); + pubnub.pamGrant("hello-uls", "abcd", true, true, 1400, ulscb); try { latch.await(10, TimeUnit.SECONDS); @@ -1690,7 +1690,7 @@ public void testUlsAuditSubKey() { pubnub.setDomain("pubnub.co"); pubnub.setOrigin("uls-test"); pubnub.setCacheBusting(false); - pubnub.ulsAudit(ulscb); + pubnub.pamAudit(ulscb); try { latch.await(10, TimeUnit.SECONDS); @@ -1710,7 +1710,7 @@ public void testUlsAuditChannel() { pubnub.setDomain("pubnub.co"); pubnub.setOrigin("uls-test"); pubnub.setCacheBusting(false); - pubnub.ulsAudit("hello-uls", ulscb); + pubnub.pamAudit("hello-uls", ulscb); try { latch.await(10, TimeUnit.SECONDS); @@ -1730,7 +1730,7 @@ public void testUlsAuditAuth() { pubnub.setDomain("pubnub.co"); pubnub.setOrigin("uls-test"); pubnub.setCacheBusting(false); - pubnub.ulsAudit("hello-uls", "abcd", ulscb); + pubnub.pamAudit("hello-uls", "abcd", ulscb); try { latch.await(10, TimeUnit.SECONDS); @@ -1750,7 +1750,7 @@ public void testUlsRevoke() { pubnub.setDomain("pubnub.co"); pubnub.setOrigin("uls-test"); pubnub.setCacheBusting(false); - pubnub.ulsRevoke("hello-uls", "abcd", ulscb); + pubnub.pamRevoke("hello-uls", "abcd", ulscb); try { latch.await(10, TimeUnit.SECONDS); diff --git a/scala/src/com/pubnub/examples/PubnubDevConsole.scala b/scala/src/com/pubnub/examples/PubnubDevConsole.scala index 0abd10798..65ca172d4 100644 --- a/scala/src/com/pubnub/examples/PubnubDevConsole.scala +++ b/scala/src/com/pubnub/examples/PubnubDevConsole.scala @@ -237,14 +237,14 @@ object PubnubDevConsole { pubnub.unsubscribePresence(channel) } - def ulsGrant() { + def pamGrant() { var channel = getStringFromConsole("Channel") var auth_key = getStringFromConsole("Auth Key") var read = getBooleanFromConsole("Read") var write = getBooleanFromConsole("Write") - pubnub.ulsGrant(channel, auth_key, read, write, new Callback() { + pubnub.pamGrant(channel, auth_key, read, write, new Callback() { override def successCallback(channel: String, message: Object) { notifyUser("CHANNEL : " + channel + " , " + message.toString()) @@ -257,11 +257,11 @@ object PubnubDevConsole { }) } - def ulsRevoke() { + def pamRevoke() { var channel = getStringFromConsole("Enter Channel") var auth_key = getStringFromConsole("Auth Key") - pubnub.ulsRevoke(channel, auth_key, new Callback() { + pubnub.pamRevoke(channel, auth_key, new Callback() { override def successCallback(channel: String, message: Object) { notifyUser("CHANNEL : " + channel + " , " + message.toString()) @@ -274,7 +274,7 @@ object PubnubDevConsole { }) } - def ulsAudit() { + def pamAudit() { var channel = getStringFromConsole("Channel", true) var auth_key = getStringFromConsole("Auth Key", true) @@ -292,12 +292,12 @@ object PubnubDevConsole { if (channel != null && channel.length() > 0) { if (auth_key != null && auth_key.length() != 0) { - pubnub.ulsAudit(channel, auth_key, cb) + pubnub.pamAudit(channel, auth_key, cb) } else { - pubnub.ulsAudit(channel, cb) + pubnub.pamAudit(channel, cb) } } else { - pubnub.ulsAudit(cb) + pubnub.pamAudit(cb) } } def startDemo() { @@ -387,11 +387,11 @@ object PubnubDevConsole { var authKey = getStringFromConsole("Auth Key") pubnub.setAuthKey(authKey) case 18 => - ulsGrant() + pamGrant() case 19 => - ulsRevoke() + pamRevoke() case 20 => - ulsAudit() + pamAudit() case 21 => pubnub.setOrigin(getStringFromConsole("Origin")) case 22 => @@ -428,9 +428,9 @@ object PubnubDevConsole { println("ENTER 15 FOR Setting Subscribe Timeout ( current: " + pubnub.getSubscribeTimeout() + " milliseconds )") println("ENTER 16 FOR Setting Non Subscribe Timeout ( current: " + pubnub.getNonSubscribeTimeout() + " milliseconds )") println("ENTER 17 FOR Setting/Unsetting auth key ( current: " + pubnub.getAuthKey() + " )") - println("ENTER 18 FOR ULS grant") - println("ENTER 19 FOR ULS revoke") - println("ENTER 20 FOR ULS Audit") + println("ENTER 18 FOR PAM grant") + println("ENTER 19 FOR PAM revoke") + println("ENTER 20 FOR PAM Audit") println("ENTER 21 FOR setting origin ( current: " + pubnub.getOrigin() + " )") println("ENTER 22 FOR setting domain ( current: "+ pubnub.getDomain() + " )") println("ENTER 23 FOR enabling Cache Busting ( current: " + pubnub.getCacheBusting() + " )")