]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/npm-registry-client/lib/logout.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / npm-registry-client / lib / logout.js
1 module.exports = logout
2
3 var assert = require('assert')
4 var url = require('url')
5
6 function logout (uri, params, cb) {
7   assert(typeof uri === 'string', 'must pass registry URI to logout')
8   assert(params && typeof params === 'object', 'must pass params to logout')
9   assert(typeof cb === 'function', 'must pass callback to star')
10
11   var auth = params.auth
12   assert(auth && typeof auth === 'object', 'must pass auth to logout')
13   assert(typeof auth.token === 'string', 'can only log out for token auth')
14
15   uri = url.resolve(uri, '-/user/token/' + auth.token)
16   var options = {
17     method: 'DELETE',
18     auth: auth
19   }
20
21   this.log.verbose('logout', 'invalidating session token for user')
22   this.request(uri, options, cb)
23 }