This package forms part of the suite of OpenID Connect helper libraries and tools used within the Test Suite. The other packages are:
OpenID Connect is one of the authentication and authorization strategies facilitated by the Open Booking API (spec: OpenID Connect Booking Partner Authentication for Multiple Seller Systems).
This Node.js library provides a test client for connecting to an OpenID Provider. It caches tokens retrieved to allow them to be reused across tests, and can connect to endpoints provided by openactive-openid-browser-automation in order to exercise a target booking system's OpenID Provider implementation according to the spec.
The OAuth Redirect URI defaults to http://localhost:3000/cb
, so make sure that your OpenID Connect Server is configured to allow this Redirect URI.
The library is documented using JSDoc. The library entry point is lib/index.js
, so you should be able to view the documentation by following the links within that index file.
At time of writing, the library's documentation is not complete. We welcome any contributions to complete it 😊.
The code is written in native JS, but uses TypeScript to check for type errors. TypeScript uses JSDoc annotations to determine types (See: Type Checking JavaScript Files) from our native .js files.
In order for these types to be used by other projects, they must be saved to TypeScript Declaration files. This is enabled by our tsconfig.json, which specifies that declaration files are to be generated and saved to built-types/
(As an aside, the reason that the package's types must be saved to .d.ts files is due to TypeScript not automatically using JS defined types from libraries. There is a good reason for this and proposals to allow it to work at least for certain packages. See some of the discussion here: microsoft/TypeScript#33136).
For this reason, TypeScript types should be generated after code changes to make sure that consumers of this library can use the new types. The openactive-test-suite project does this automatically in its pre-commit hook, which calls npm run gen-types
TypeScript-related scripts:
-
check-types
: This uses thetsconfig.check.json
config, which does not emit any TS declaration files - all it does is check that there are no type errors. This is used for code tests. -
gen-types
: This uses thetsconfig.gen.json
config, which emits TS declaration files intobuilt-types/
.Additionally, it copies programmer-created
.d.ts
files from our source code (e.g.src/types/Criteria.d.ts
) intobuilt-types/
. This is because our code references these types, so they must be in thebuilt-types/
directory so that the relative paths match (e.g. so thatimport('../types/Criteria').Criteria
works).