changeset 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 c1e7821d3c68
children beb7e0f48242
files webapp/src/main/webapp/jquery/digilib-ann.html webapp/src/main/webapp/jquery/jquery.digilib.annotator.js
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/digilib-ann.html	Tue Nov 13 17:35:32 2012 +0100
+++ b/webapp/src/main/webapp/jquery/digilib-ann.html	Tue Nov 13 19:29:23 2012 +0100
@@ -43,6 +43,8 @@
                     'annotationsReadOnly' : false,
                     // URL of authentication token server
                     'annotationTokenUrl' : 'http://libcoll.mpiwg-berlin.mpg.de/libviewa/template/token/getLoginToken',
+                    // URL of safe authentication token server
+                    'annotationSafeTokenUrl' : 'https://libcoll.mpiwg-berlin.mpg.de/libviewa/template/token/getLoginToken',
                     //'annotationTokenUrl' : 'http://localhost:8080/test/docuviewa/template/token/getLoginToken',
                     // list of Annotator plugins
                     'annotatorPlugins' : ['Auth', 'Permissions', 'Store', 'Markdown', 'DigilibIntegrator']
--- 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