diff webapp/src/main/webapp/jquery/jquery.digilib.annotator.js @ 1132:d47513632da5

additional annotationSafeTokenUrl for https url, used with passwords. we don't always use https for issues with self-signed certs.
author robcast
date Tue, 13 Nov 2012 19:29:23 +0100
parents 9e85efcfbb0c
children beb7e0f48242
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js	Tue Nov 13 17:35:32 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js	Tue Nov 13 19:29:23 2012 +0100
@@ -49,6 +49,8 @@
         'annotationsReadOnly' : false,
         // URL of authentication token server e.g. 'http://libcoll.mpiwg-berlin.mpg.de/libviewa/template/token'
         'annotationTokenUrl' : null,
+        // URL of safe authentication token server e.g. 'https://libcoll.mpiwg-berlin.mpg.de/libviewa/template/token'
+        'annotationSafeTokenUrl' : null,
         // annotation user name
         'annotationUser' : 'anonymous',
 		// list of Annotator plugins
@@ -188,10 +190,20 @@
 	            password = window.prompt("Please authenticate: Password", '');
 	            // set params for Auth plugin
 	         	auth.options.requestData.password = password;   
+	    		// try to use the safe url for the password
+    			if (data.settings.annotationSafeTokenUrl != null) {
+    				auth.options.tokenUrl = data.settings.annotationSafeTokenUrl;
+    			} else {
+    				console.warn("Sending token password over standard-URL!");
+    			}
 	        } else {
 	        	// use anonymous user
 	        	user = 'anonymous';
 	         	delete auth.options.requestData.password; 
+    			if (data.settings.annotationSafeTokenUrl != null) {
+    				// reset url to unsafe
+    				auth.options.tokenUrl = data.settings.annotationTokenUrl;
+    			}
 	        }
         }
         // set user in digilib