Coder Social home page Coder Social logo

Comments (5)

EvanDarwin avatar EvanDarwin commented on June 12, 2024 1

@adiroiban And what if I don't want to use an .htpasswd file?

from http-auth.

gevorg avatar gevorg commented on June 12, 2024 1

btw extension for digest authentication is not .htpasswd, but .htdigest :)

from http-auth.

adiroiban avatar adiroiban commented on June 12, 2024

Here is my take on this

const auth = require('http-auth');
const auth_method = auth.digest({
    realm: 'assistant-relay',
    file: __dirname + '/path/to/your/users.htpasswd'
});

const app = express();
// http-auth should be the first middleware to use.
app.use(auth.connect(auth_method));

Then in users.htpasswd store the HA1 hash.
The documentation is wrong about passHash as this is not the password hash but

HA1 = MD5(username:realm:password)

To create the hash do: $ echo -n USER-NAME:REAL-NAME:PASSWORD-CLEAR | md5sum

I will try to submit a PR for this :)

from http-auth.

adiroiban avatar adiroiban commented on June 12, 2024

The current API only has the local file path option.
there is no option to pass a stream or delegate to other function.

@gevorg thanks :) good point :)

from http-auth.

gevorg avatar gevorg commented on June 12, 2024

The current API only has the local file path option.
there is no option to pass a stream or delegate to other function.

@gevorg thanks :) good point :)

Did you check https://github.com/http-auth/http-auth/blob/master/examples/digest_nofile.js ?

from http-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.