Commit 7659c576 authored by Kamron Aroonrua's avatar Kamron Aroonrua 💬

Merge branch 'ondev-gcs' into 'dev'

http jwt decode

See merge request !43
parents e4741edd b3ef9e80
BIGSTREAM_IMG=bigstream:test
BIGSTREAM_IMG=bigstream:jwt
BS_SECRET=bigstream-server
REDIS_TAG=4
PREFIX_NO=19
......
#Changelog
## [1.2.5dev] - 2021-08-11
## [1.2.5dev] - 2021-10-07
### Added
- DOCKER :: TZ Data
- STORAGE :: Wirdcard Subscribe
- PLUGIN :: dt-jwt-verify
- TRIGGER :: http-listener add query meta
### Fixed
- PLUGIN :: dt-mysql port param
## [1.2.4] - 2021-06-21
......
......@@ -30,6 +30,7 @@ var process_req = function(req, res ,method) {
'object_type' : 'httpdata',
'headers': req.headers,
'method' : method,
'query' : reqHelper.getQuery(),
'data' : {}
}
......
......@@ -20,6 +20,7 @@ function perform_function(context,response){
if(param.http_meta){
input_meta.http_headers = htdata.headers;
input_meta.http_method = htdata.method;
input_meta.http_query = htdata.query;
}
if(typeof htdata.data == 'object' && htdata.data.type == 'Buffer'){
data = Buffer.from(htdata.data);
......
var util = require('util');
var DTPlugin = require('../dt-plugin');
function DTTask(context,request){
DTPlugin.call(this,context,request);
this.name = "jwt-verify";
this.output_type = "";
}
util.inherits(DTTask,DTPlugin);
DTTask.prototype.perform = require('./perform');
module.exports = DTTask;
\ No newline at end of file
var jwt = require('jsonwebtoken');
var ctx = require('../../../context');
var Utils = ctx.getLib('lib/util/plugin-utils');
function perform_function(context,request,response){
var job_id = context.jobconfig.job_id;
var transaction_id = context.transaction.id;
var param = context.task.config.param || {};
var memstore = context.task.memstore
var output_type = request.input_type;
var data = request.data;
var meta = request.meta || {};
var req_token = param.token || ""
var req_secret = param.secret || ""
var env = {
'type' : output_type,
'data' : data,
'meta' : meta
}
req_secret = Utils.vm_execute_text(env,req_secret);
req_token = Utils.vm_execute_text(env,req_token);
var jwtout = {
"error":true,
"decode":{}
}
jwt.verify(req_token, req_secret, function(err, decoded) {
if(!err){
jwtout.error=false;
jwtout.decode=decoded;
}
meta.jwt = jwtout
response.meta = meta;
response.success(data,output_type);
});
//response.success();
//response.reject();
//response.error("error message")
}
module.exports = perform_function;
{
"version":"1.2.5dev",
"build":"202108110000"
"build":"202110070030"
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment