Skip to content

create, sign, read and verify JSON Web Tokens in existdb

License

Notifications You must be signed in to change notification settings

eXistSolutions/exist-jwt

Repository files navigation

exist-JWT

Semantic Release semantic-release JWT compatible

eXist-db library to create and read JSON Web Tokens with arbitrary payloads.

Can be used to authorise requests with restxq and controller.xql.

As long as you keep your secret you can trust the information in valid tokens.

Usage

exist-JWT is implemented as an XQuery module and packaged as an eXist-db xar package which will be installed alongside your app.

Install the XAR and

import module namespace jwt="http://existsolutions.com/ns/jwt";

For more details look at examples and tests.

Requirements

  • eXist-db version 5.0.0+
  • eXist-db crypto lib 1.0.0+

Testing

Command line

Prequisites:

  • node 10+
  • a running exist-db at localhost:8080

Clone this repository and

  1. Install dev dependencies
    • npm install
  2. Build and install the XAR package in your exist-db instance
    • npm start
  3. Run the testsuite
    • npm test

eXide

Prequisites:

  • a running exist-db with jwt installed

Evaluate test/runner.xq

Getting and using a token

This interaction diagram shows how a token is created and used to access a restricted resource.