Class: GDCacheController

GDCacheController()

Use this class to control the secure authentication caches of the GDURLLoadingSystem and GDHttpRequest classes. (Currently, there are only two controls.) The secure authentication cache is used by these classes as follows:

GD URL Loading System
  • Stores credentials for all authentication methods.
  • Stores tickets for Kerberos authentication.
GD HTTP Request
  • Stores tickets for Kerberos authentication.

Methods

clearCredentialsForMethod(method, success, fail)

Call this function to clear the cached credentials for a particular authentication method, or to clear for all methods. Calling this function clears the session cache, and the permanent cache if present. (Currently, the BlackBerry Dynamics client library only has a permanent cache for Kerberos authentication tickets.)
Parameters:
Name Type Description
method string One of the following constants, specifying which cache or caches are to be cleared:
  • "HTTPBasic" clears Basic Authentication credentials
  • "Default" also clears Basic Authentication credentials
  • "HTTPDigest" clears Digest Authentication credentials
  • "NTLM" clears Kerberos Authentication credentials and tickets
  • "Negotiate" clears Kerberos Authentication credentials and tickets
  • "All" clears all of the above
success function Callback function to invoke upon successful completion of the request.
fail function Callback function to invoke if the request cannot be completed.
Source:
Example
<pre class="prettyprint"><code>
function gdccOnSuccess(response) {
 console.log("The function call succeeded.");
};

function gdccOnError(response) {
  console.log("The function call failed: " + response);
};

function clearCredential(){
 var method = "HTTPDigest";
 try {
     window.plugins.GDCacheController.clearCredentialsForMethod(method, gdccOnSuccess, gdccOnError);
 } catch(e) {
     throw new Error("A try catch error was caught on GDCacheController.clearCredentialsForMethod");
 };
}
 </code></pre>

kerberosAllowDelegation(allow, success, fail)

Call this function to allow or disallow Kerberos delegation within BlackBerry Dynamics secure communications. By default, Kerberos delegation is not allowed. When Kerberos delegation is allowed, the BlackBerry Dynamics run-time behaves as follows:
  • Kerberos requests will be for tickets that can be delegated.
  • Application servers that are trusted for delegation can be sent tickets that can be delegated, if such tickets were issued.
When Kerberos delegation is not allowed, the BlackBerry Dynamics run-time behaves as follows:
  • Kerberos requests will not be for tickets that can be delegated.
  • No application server will be sent tickets that can be delegated, even if such tickets were issued.
After this function has been called, delegation will remain allowed or disallowed until this function is called again with a different setting. When this function is called, the Kerberos ticket and credentials caches will be cleared. I.e. there is an effective call to the clearCredentialsForMethod: function with an NSURLAuthenticationMethodNegotiate parameter. Note: User and service configuration in the Kerberos Domain Controller (typically a Microsoft Active Directory server) is required in order for delegation to be successful. On its own, calling this function will not make Kerberos delegation work in the whole end-to-end application.
Parameters:
Name Type Description
allow boolean true to allow delegation, false to disallow.
success function Callback function to invoke upon successful completion of the request.
fail function Callback function to invoke if the request cannot be completed.
Source:
Example
<pre class="prettyprint"><code>
function gdccOnSuccess(response) {
 console.log("The function call succeeded.");
};

function gdccOnError(response) {
 console.log("The function call failed: " + response);
};

function clearCredential(){
 try {
     window.plugins.GDCacheController.kerberosAllowDelegation(true, gdccOnSuccess, gdccOnError);
 } catch(e) {
      throw new Error("A try catch error was caught on GDCacheController.kerberosAllowDelegation");
 };
}
</code></pre>