Click or drag to resize

Telogis.GeoBase.Authenticator

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release

Used to provide authentication services with GeoStream servers using only JavaScript. Necessary when providing GeoStream authentication from non .NET environments or services.

Functions
NameDescription
getAuthToken (Object config)

Used to asynchronously retrieve an authentication token for a GeoStream server. Username and password must match with a username and password on the server (set in GeoBase.setService: 'users.Config' configuration file).

JavaScript
function main() {
       Telogis.GeoBase.Authenticator.getAuthToken({
           server: "http://domain.com/geostream/",
           username: "myUsername",
           password: "myPassword",
           expiry: 600, // duration in seconds: ten minutes
           success: function(authInfo){
               GeoBase.setAuthToken(authInfo.token);
               alert("Authentication successful" +
               "\n\nThe 32-character string representing this token is: " + authInfo.token +
               "\n\nThis token will expire in: " + Math.round(authInfo.expiry / 1000) + " seconds" +
               "\n\nThe IP mask this token is valid for is: " + authInfo.mask);
           },
           error: function(){
               alert("Failed to authenticate");
           }
       });
       // The tasks that require authentication to proceed
}
Arguments
  • config (Object) - Configuration options

    Properties
    NameTypeDescription
    errorCallback

    An arbitrary function to call if GeoStream authentication fails (that is, no token is returned by getAuthToken).

    expiryNumber

    Optional. The authentication duration in seconds. The maximum length of time is set by the server. If the requested time is greater than this time then it is shortened to the server's maximum. Defaults to server's maximum.

    maskNumber

    Optional. The client's IP mask. Defaults to 0.

    passwordString

    The client's password.

    serverString

    The full path to the GeoStream server in the format "http://domain.com/geostream/".

    successCallback

    An arbitrary function to call if GeoStream authentication succeeds and a token is returned by getAuthToken.

    usernameString

    The client's username.

Returns

authToken - The authentication token, and an object containing authentication information returned by the server (authInfo). This object contains the token ('token') as a 32-character string representing the GUID, the length of time in milliseconds that the token is valid for ('expiry') from the time of the token's creation, and the IP bit mask that this token is valid for ('mask') as a string.