Home

Awesome

iiif-auth-server

A demo server implementation of all apsects of the IIIF Authentication specification. It shows:

This is a work in progress, please raise issues! It is intended to assist client development by providing a live implementation to test against.

It uses https://github.com/rogerhoward/iiify as base simple server. It's a Flask app that uses Pillow via iiif2 to generate image tiles. iiif-auth-server adds an IIIF auth implementation to demonstrate the different interaction patterns, the cookie services, and the token service.

The latest version of this application should be running at https://iiifauth.digtest.co.uk/.

There is an accompanying JavaScript client application to run against the server demo at https://github.com/digirati-co-uk/iiif-auth-client.

This is not a production application! A typical institutional implementation would likely protect many thousands of images with the same cookie and token services, whereas this demo makes you authenticate for most of the sample images separately. It also gives access to everyone's session for diagnostic purposes, has one hardcoded username and password for Login pattern cookie services, and so on. However, it should exercise every part of the specification.

Usage

  1. Clone this repo
  2. (optional) In the iiif-auth-server directory, set up a virtualenv:
python3 -m venv venv
  1. To install for development:
pip install --editable .
  1. to run for local development with an ad-hoc SSL cert:
export FLASK_APP=iiifauth
export FLASK_DEBUG=true
flask run --cert=adhoc

or

. runflask.sh

This will give nasty warnings about the SSL but works without having to do anything further. It must be run over https, even locally, otherwise SameSite, Secure cookies will be ignored by browsers.

  1. Token information is stored in a sqllite3 db which should initialise itself

Problems - you will need to install jpeg support for pillow if you don't already have it, e.g., on Ubuntu

# install libjpeg-dev with apt
sudo apt-get install libjpeg-dev
# if you're on Ubuntu 14.04, also install this
sudo apt-get install libjpeg8-dev

# reinstall pillow
pip install --no-cache-dir -I pillow

(from http://stackoverflow.com/questions/8915296)