简体   繁体   中英

CubeJS initial call to initialize granting of JWT

directory structure

|_ jwks.json
|_ cube.js
|_ package.json

The cube docs give config for cube.js :

const fs = require("fs");
const jwt = require("jsonwebtoken");
const jwkToPem = require("jwk-to-pem");
const jwks = JSON.parse(fs.readFileSync("jwks.json"));
const _ = require("lodash");

module.exports = {
  checkAuth: async (req, auth) => {
    const decoded = jwt.decode(auth, { complete: true });
    const jwk = _.find(jwks.keys, x => x.kid === decoded.header.kid);
    const pem = jwkToPem(jwk);
    req.authInfo = jwt.verify(auth, pem);
  },
  contextToAppId: ({ authInfo }) => `APP_${authInfo.userId}`,
  preAggregationsSchema: ({ authInfo }) => "pre_aggregations_${authInfo.userId}"
};

Question: If this is the model used (image below) how does one initialize the process to acquire a token. In other words how does the client go about making the initial call in vanilla Javascript to start the token process using /.well_known/jwks.json?

在此处输入图片说明

Cube.js does not support token creation because Cube.js is a microservice for analytics.

You can generate JWT:

  • In your application
  • Use auth services (auth0, keycloak, etc.)

PS There is support for token creation, but it's only for development mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM