mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(auth) add currify
This commit is contained in:
parent
20e76dfc1c
commit
185460341e
1 changed files with 10 additions and 10 deletions
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
const httpAuth = require('http-auth');
|
||||
const criton = require('criton');
|
||||
const currify = require('currify');
|
||||
const middle = currify(_middle);
|
||||
|
||||
const config = require('./config');
|
||||
|
||||
|
|
@ -13,16 +15,14 @@ module.exports = () => {
|
|||
return middle(auth);
|
||||
};
|
||||
|
||||
function middle(authentication) {
|
||||
return (req, res, next) => {
|
||||
const is = config('auth');
|
||||
|
||||
if (!is)
|
||||
return next();
|
||||
|
||||
const success = () => next(/* success */);
|
||||
authentication.check(req, res, success);
|
||||
};
|
||||
function _middle(authentication, req, res, next) {
|
||||
const is = config('auth');
|
||||
|
||||
if (!is)
|
||||
return next();
|
||||
|
||||
const success = () => next(/* success */);
|
||||
authentication.check(req, res, success);
|
||||
}
|
||||
|
||||
function check(username, password, callback) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue