How to use the kerberos.Kerberos function in kerberos

To help you get started, weā€™ve selected a few kerberos examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anile / ad_kerberos_auth / index.js View on Github external
if (!req.headers.authorization) {
        res.set( 'WWW-Authenticate', 'Negotiate' );

        //
        console.log('-----response-----');
        console.log(res._headers);

        res.status(401).send();

    } else {

        // this code is only for Linux !

        var KerberosNative = require('kerberos').Kerberos;
        var kerberos = new KerberosNative();
        var ActiveDirectory = require('activedirectory');
        var ad = new ActiveDirectory({
            "url": "ldap://",
            "baseDN": "",
            "username": "",
            "password": ""});
        //cut phrase "Negotiate "
        var ticket = req.headers.authorization.substring(10);

        //init context
        kerberos.authGSSServerInit("HTTP", function(err, context) {
            //check ticket
            kerberos.authGSSServerStep(context, ticket, function(err) {
                //in success context contains username
                ad.findUser(context.username, function(err, user) {
                    //get user groups

kerberos

Kerberos library for Node.js

Apache-2.0
Latest version published 11 days ago

Package Health Score

86 / 100
Full package analysis