From: Jason Skomorowski Date: Mon, 7 Jul 2014 23:30:04 +0000 (-0400) Subject: Merge branch 'master' into templateallthemarkup X-Git-Tag: 1.0.0~324^2~58 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=cda7d85862a85b0841478d87a086582cb02ba002;hp=24a2e08e37e327c7db67d2c3a26dc6f88e73856b Merge branch 'master' into templateallthemarkup Conflicts: src/.gitignore src/mkws-core.js src/mkws-team.js src/mkws-widget-termlists.js tools/htdocs/Makefile --- diff --git a/Makefile b/Makefile index 9504c36..32309e5 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ # Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com all: - ${MAKE} -C./src $@ - ${MAKE} -C./doc $@ + ${MAKE} -C./tools/htdocs $@ + ${MAKE} -C./doc install clean distclean: - ${MAKE} -C./src $@ + ${MAKE} -C./tools/htdocs $@ ${MAKE} -C./doc $@ ${MAKE} -C./examples/htdocs $@ ${MAKE} -C./test $@ @@ -18,12 +18,9 @@ phantomjs p: # must be called once after GIT checkout setup: -#why? ${MAKE} -C./tools/htdocs mkws-js-min ${MAKE} -C./test node-modules -check: setup check-js - @echo "" - @echo "To run jasmine regression tests, type: make phantomjs" +check: setup check-js phantomjs help: @echo "make [ all | setup | clean | distclean ]" diff --git a/README b/README index 92df4ce..7aacc48 100644 --- a/README +++ b/README @@ -21,7 +21,7 @@ Required devel tools ==================== On debian, you will need: -$ sudo apt-get install curl git-core pandoc yui-compressor node-js +$ sudo apt-get install curl git-core pandoc yui-compressor node-js libbsd-resource-perl On Debian 7 (wheezy), you do not need git-core, plain git will do, but you probably have that on a development box already. Unfortunately, node-js diff --git a/doc/Makefile b/doc/Makefile index 75a9e2d..34dc62e 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -14,7 +14,7 @@ uninstall: ../tools/htdocs/%: % rm -f $@ cp -p $? $@ - chmod -w $@ + chmod ugo-w $@ all: $(DOCS) diff --git a/doc/library-configuration.txt b/doc/library-configuration.txt index 7abcfc0..5132887 100644 --- a/doc/library-configuration.txt +++ b/doc/library-configuration.txt @@ -2,72 +2,112 @@ MKWS Target Selection ===================== +MKWS accesses targets using the Pazpar2 metasearching engine, almost +always fronted by the Service Proxy to manage target selection. This +document assumes the SP is used, and so that a library of targets is +available, maintained using an instance of MKAdmin (often +http://mkc-admin.indexdata.com/console/) + + 1. Selecting targets within the library --------------------------------------- -MKWS applications can choose what subset of the available targets to +MKWS applications can choose what subset of the library's targets to use, by means of several alternative settings on individual widgets or in the mkws_config structure: * targets -- contains a Pazpar2 targets string, typically of the form "pz:id=" or "pz:id~" followed by a pipe-separated list of low-level - target IDs. At present, these IDs are based on ZURLs, so a typical - value would be something like: - pz:id~josiah.brown.edu:210/innopac|connect.indexdata.com:9000/mit_opencourseware' + target IDs. + + At present, these IDs can take one of two forms, depending on the + configuration of the Service Proxy being used: they may be based on + ZURLs, so a typical value would be something like: + pz:id=josiah.brown.edu:210/innopac|lui.indexdata.com:8080/solr4/select?fq=database:4902 + Or they may be UDBs, so a typical value would be something like: + pz:id=brown|artstor * targetfilter -- contains a CQL query which is used to find relevant targets from the relvant library. For example, udb==Google_Images + Or + categories=news * target -- contains a single UDB, that of the sole target to be used. For example Google_Images + This is merely syntactic sugar for "targetfilter" with the query + udb==NAME -2. Changing the library ------------------------ +2. Authenticating onto the library +---------------------------------- -Some MKWS applications will want to define their own library providing -a different range of available targets. This is particularly important -in the case of applications that authenticate onto subscription -resources by means of credentials stored in MKAdmin, in that such -library accounts need to prohibit unauthorised access. +Some MKWS applications will be content to use the default library with +its selection of targets. Most, though, will want to define their own +library providing a different range of available targets. An important +case is that of applications that authenticate onto subscription +resources by means of credentials stored in MKAdmin: precautions must +be taken so that such library accounts do not allow unauthorised +access. -Setting up such a library is a two-stage process. +Setting up such a library is a two, three or four-stage process. -Stage A (on MKAdmin) +Stage A: create the library -Create the library: +Use MKAdmin to create the library: - Make a new library on http://mkc-admin.indexdata.com/console/ - Select relevant targets - - Add authentication credentials as necessary + - Add authentication credentials to the targets as necessary - Create an end-user account - - Set its username and password - -Stage B (on the application's web-server): - -Authentication onto the library can be achieved by a single HTTP GET -to the relevant Service Proxy, passing in the credentials and thereby -initiating an HTTP session. This can most simply be done just by -setting service_proxy_auth to a URL such as - http://mkws.indexdata.com/service-proxy/?command=auth&action=login&username=MIKE&password=SWORDFISH - -However, doing so reveals the the credentials to public view -- to -anyone who does View Source on the MKWS application. This may be -acceptable for some libraries, but is intolerable for those which -provide authenticated access to subscription resources. For such -circumstances, a more elaborate approach is necessary. The idea is to -make a local URL that is used for authentication onto the Service -Proxy, hiding the credentials, and to use local mechanisms to limit -access to that local authentication URL. Here is one way to do it when -Apache2 is the application's web-server: + - Depending on what authentication method it be used, set the + end-user account's username and password, or IP-address + range, or referring URL, or hostname. + +Stage B: tell the application to use the library + +In the HTML of the application, tell MKWS to authenticate on to the +Service Proxy. When IP-based, referer-based or hostname-based +authentication is used, this is very simple: + + + +And ensure that access to the MWKS application is from the correct +IP-range, referer or hostname. + +Stage C (optional): embed credentials for access to the library + +When credential-based authentication is in use (username and +password), it's necessary to pass these credentials into the Service +Proxy when establishing the session. This can most simply be done just +by setting the service_proxy_auth configuration item to a URL such as + http://mkws.indexdata.com/service-proxy/?command=auth&action=check,login&username=MIKE&password=SWORDFISH + +Stage D (optional): conceal credentials from HTML source + +Using a Service-Proxy authentication URL such as the one above reveals +the the credentials to public view -- to anyone who does View Source +on the MKWS application. This may be acceptable for some libraries, +but is intolerable for those which provide authenticated access to +subscription resources. + +In these circumstances, a more elaborate approach is necessary. The +idea is to make a local URL that is used for authentication onto the +Service Proxy, hiding the credentials, and to use local mechanisms to +limit access to that local authentication URL. Here is one way to do +it when Apache2 is the application's web-server, which we will call +example.com: - Add a rewriting authentication alias to the configuration: RewriteEngine on - RewriteRule /spauth/ http://mkws.indexdata.com/service-proxy/?command=auth&action=login&username=U&password=PW [P] - - Extend the MKWS configuration to set service_proxy_auth: - http://application.com/spauth/ - - Protect access to /apauth/ (e.g. using a .htaccess file). + RewriteRule /spauth/ http://mkws.indexdata.com/service-proxy/?command=auth&action=check,login&username=U&password=PW [P] + - Set thwe MKWS configuration item "service_proxy_auth" to: + http://example.com/spauth/ + - Protect access to the local path http://example.com/spauth/ + (e.g. using a .htaccess file). Once such a library has been set up, and access to it established, target selection within the set that it makes available can be done diff --git a/examples/apache2/mkws-examples b/examples/apache2/mkws-examples index 472071b..42f0673 100644 --- a/examples/apache2/mkws-examples +++ b/examples/apache2/mkws-examples @@ -3,6 +3,10 @@ ServerName example.indexdata.com DocumentRoot /home/indexdata/mkws/examples/htdocs/ + Alias /tools/htdocs/ /home/indexdata/mkws/tools/htdocs/ + Alias /src/ /home/indexdata/mkws/src/ + Alias /jasmine/ /home/indexdata/mkws/examples/jasmine/ + Alias /test/ /home/indexdata/mkws/test/ ErrorLog /var/log/apache2/mkws-examples-error.log CustomLog /var/log/apache2/mkws-examples-access.log combined diff --git a/examples/apache2/mkws-examples-mike b/examples/apache2/mkws-examples-mike index c867600..4167584 100644 --- a/examples/apache2/mkws-examples-mike +++ b/examples/apache2/mkws-examples-mike @@ -3,6 +3,9 @@ DocumentRoot /usr/local/src/git/mkws/examples/htdocs/ Alias /tools/htdocs/ /usr/local/src/git/mkws/tools/htdocs/ Alias /src/ /usr/local/src/git/mkws/src/ + Alias /jasmine/ /usr/local/src/git/mkws/examples/jasmine/ + Alias /test/ /usr/local/src/git/mkws/test/ + ErrorLog /var/log/apache2/mkws-examples-error.log CustomLog /var/log/apache2/mkws-examples-access.log combined diff --git a/examples/htdocs/auto3.html b/examples/htdocs/auto3.html index 6f60df0..4fef994 100644 --- a/examples/htdocs/auto3.html +++ b/examples/htdocs/auto3.html @@ -38,7 +38,7 @@
PLOS ONE articles will appear here
@@ -46,7 +46,7 @@
Free e-books will appear here
@@ -54,7 +54,7 @@
Library catalog entries will appear here
diff --git a/examples/htdocs/jasmine-cors-popup.html b/examples/htdocs/jasmine-cors-popup.html new file mode 100644 index 0000000..d7d1a7a --- /dev/null +++ b/examples/htdocs/jasmine-cors-popup.html @@ -0,0 +1,95 @@ + + + + MKWS demo: jQuery popup plugin with jasmine test framework + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

MKWS Jasmine regression tests

+ +
+
+
+
+
+
+
+
+ + + + + + diff --git a/examples/htdocs/jasmine-local-popup.html b/examples/htdocs/jasmine-local-popup.html index 02f1863..3a85e82 100644 --- a/examples/htdocs/jasmine-local-popup.html +++ b/examples/htdocs/jasmine-local-popup.html @@ -6,12 +6,11 @@ - + - - - - + + + @@ -55,8 +54,9 @@ var jasmine_config = { search_query: "netbsd", expected_hits: 10, - // active_clients: 17, + active_clients: 13, check_motd: false, + check_sortby: true, show_record_url: true }; @@ -67,14 +67,8 @@ }); -
-An embryonic MasterKey Widget Set
-=================================
-
-This directory contains an embryonic MasterKey Widget Set, based
-initially on "jsdemo" though now far removed from those beginnnings.
-[...]
-    
+

MKWS Jasmine regression tests

+

diff --git a/examples/htdocs/jasmine-popup.html b/examples/htdocs/jasmine-popup.html index f00cd84..c27e0f4 100644 --- a/examples/htdocs/jasmine-popup.html +++ b/examples/htdocs/jasmine-popup.html @@ -6,13 +6,11 @@ - + - - - - - + + + @@ -21,12 +19,10 @@ - - + - @@ -40,6 +36,10 @@ + + @@ -47,23 +47,31 @@ -

Jasmine test of MKWS

-
This is the mkwsMOTD div
+

MKWS Jasmine regression tests

+

+ diff --git a/examples/htdocs/jasmine-pp2.html b/examples/htdocs/jasmine-pp2.html index 60aa55f..0e106bb 100644 --- a/examples/htdocs/jasmine-pp2.html +++ b/examples/htdocs/jasmine-pp2.html @@ -15,10 +15,10 @@ }; - - - - + + + +