OpenComponents plugin for validating JSON Web Token (JWT) inside OC components.
Requirements
- Node version: min 6
- OC Registry
Install
npm i oc-plugin-jwt --save
Registry setup
More info about integrating OC plugins: here
Registering using the simple in-memory keystore.
const registry = oc; registry; registrystartcallback;
Or custom using a custom keystore
const registry = oc; registry; registrystartcallback;
Using it inside components
Example for a component's server.js:
moduleexports { const exampleToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImtleS1pZC0yIn0.' + 'eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.' + 'bQVxleqAX7NQzI_RkIPFVfTl44-iEY0UYPUBm10789o'; contextplugins;};