how to use express-ntlm to get windows user name without authentication using NODE.js?

后端 未结 1 1415
孤城傲影
孤城傲影 2021-01-16 18:26

I am trying to use express-ntlm to get windows user name without authentication.

in my app.js, i put the following:

var app = express();

// view eng         


        
相关标签:
1条回答
  • 2021-01-16 18:45

    UPDATE:

    Change to this in the app.js:

    app.use(ntlm()); 
    app.use('/', search);
    app.use('/', TT);
    app.use('/', KYEC_stat);
    app.use('/', ftc);
    app.use('/', volPerDevice);
    app.use('/', routes);
    

    And add '/vol' in the router in the topVolPerDevice file:

    var config = require('../config.json');
    var express = require('express');
    var query = require('pg-query');
    var assert = require('assert');
    var async = require('async');
    var url = require('url');
    var queryString = require('querystring');
    
    var router = express.Router();
    
    
    /* Display quantity tested per device id since 2011 using d3 */
    /* The query will first select all lot records and their earliest test date (which is the 'P' insertion incoming material quantity);
       then use {lotid, lotstartdate} to retrieve all 1st insertion lot records, then add up lots per device;
       then return the 1st 20 device id which tops inocming material quantity;
     */
    router.get('/vol', function(req, res) {
            query.connectionParameters = config.reportConnStr;      //connecting to localhost
            var deviceArray = new Array();
            var sqlstr =  "sdfsfdfsdsfds";
            query(sqlstr, function(err, rows, result) {
                assert.equal(rows, result.rows);
                for (var i = 0; i < rows.length; i++) {
                    var device = {};
                    device.name = rows[i].device;
                    device.value = rows[i].totalqtyout;
                    deviceArray.push(device);        
                }
                res.render('d3t1', {deviceArray:deviceArray});                      
            });
    });
    
    module.exports = router;
    
    0 讨论(0)
提交回复
热议问题