TN-SWEKEY-003

Getting notified when a Swekey is unplugged

Targeted Audience

This document is intended for web masters who want to use Swekey Authentication in their web sites. 
This document assumes that the following Tech Notes have been read:

Introduction

Once your web site has authenticated a swekey, you may want to know when the authenticated swekey gets unplugged to end your session.
A very simple solution consists in poling the presence of the Swekey using the Java Script function at regular intervals.
This technique may not work if you need to be notified even if all your web pages are closed.
This document explains how to set, one or more, URLs  notification in such a case.

URL notification

The URL notification technique consists in associating a set of URLs (on your server) to a plugged Swekey. When the Swekey gets unplugged, all the associated URLs are started silently.
The pages returned by those URLs are ignored, so you don’t need to return anything when your server receives the URL requests.

How does it work ?

To associate an unplugged URL to the Swekey, you should use the Swekey_SetUnplugUrl(swkid, key, url) Java Script API where:
Example: "
Swekey_SetUnplugUrl(00000000000000000000000000000023", "myApp" ,"http://www.mydomain.com/unplugged.php?id=23");

Changing the URL

To change the URL associated with a Swekey, just call Swekey_SetUnplugUrl again with the same key and the new url.

Removing the URL

To remove the URL associated with a Swekey, just call Swekey_SetUnplugUrl again with the same key and "" (empty string) as the url.

Adding a new URL

To associate multiple URL the Swekey (maximum is 16), just call Swekey_SetUnplugUrl again with a new key and the new url.