简体   繁体   English

CubeJS 初始调用以初始化 JWT 的授予

[英]CubeJS initial call to initialize granting of JWT

directory structure目录结构

|_ jwks.json |_ jwks.json
|_ cube.js |_ 立方体.js
|_ package.json |_ 包.json

The cube docs give config for cube.js :立方体文档给出了 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?换句话说,客户端如何在 vanilla Javascript 中进行初始调用以使用 /.well_known/jwks.json 启动令牌过程?

在此处输入图片说明

Cube.js does not support token creation because Cube.js is a microservice for analytics. Cube.js 不支持令牌创建,因为 Cube.js 是用于分析的微服务。

You can generate JWT:您可以生成 JWT:

  • In your application在您的应用程序中
  • Use auth services (auth0, keycloak, etc.)使用身份验证服务(auth0、keycloak 等)

PS There is support for token creation, but it's only for development mode. PS 支持创建令牌,但仅适用于开发模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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