/
dimono39
/
education-analytics
Обзор
Документация
Войти
/
dimono39
/
education-analytics
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
node_modules/http-auth/src/server/hapi.js
32 строки
928 B
dimono39
добавил файлы
08 дек 2025, 15:17
08 дек 2025, 15:17
40ee2bb
Код
Авторство
О чём код?
"use strict"; // HTTP authentication scheme. const httpScheme = (server, auth) => { return { authenticate: (request, reply) => { // Is auth. auth.isAuthenticated(request, (result) => { if (result instanceof Error) { return reply(result, null, { credentials: null }); } else if (!result.pass) { let header = auth.generateHeader(result); return reply(auth.options.msg401).code(401).header('WWW-Authenticate', header); } else { return reply.continue({credentials: { name: result.user }}); } }); } } }; // Export plugin. exports.register = (plugin, options, next) => { plugin.auth.scheme('http', httpScheme); next(); }; // Export attributes. exports.register.attributes = { pkg: require('../../package.json') };