0.1.0 • Published 6 years ago

drachtio-mw-auth-parser v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

drachtio-mw-auth-parser Build Status NPM version

drachtio middleware for parsing SIP Authorization header, supporting Digest and Basic authorization

Usage

const Srf = require('drachtio-srf');
const srf = new Srf();
const authParser = require('drachtio-mw-auth-parser') ;

srf.connect({...}) ;

srf.use(authParser) ;

srf.register(( req, res ) => {
  console.log(req.authorization) ;
  /*
    Digest: username="103482",realm="sip.drachtio.org",nonce="df24fd41-4fc5-416f-b163-90f774ca0358" \
      uri="sip:73.15.46.10:6060",algorithm=MD5,response="a4881ad854cc0677158206ac9fa90e3b", \
      qop=auth,nc=00000032,cnonce="ea5cec20"

    console.log =>
    {
      scheme: 'digest',
      username: '103482',
      realm: 'sip.drachtio.org',
      nonce: 'df24fd41-4fc5-416f-b163-90f774ca0358',
      uri: 'sip:72.1.46.10:6060',
      algorithm: 'MD5',
      response: 'a4881ad854cc0677158206ac9fa90e3b',
      qop: 'auth',
      nc: '00000032',
      cnonce: 'ea5cec20'
    }
   */
}) ;