authweiler
Version:
A full-flegded 0Auth2.0 HTTP proxy server
28 lines (27 loc) • 951 B
JavaScript
const fastify = require('fastify');
const logger = require('../utils/logger');
const helmet = require('fastify-helmet');
const Store = require('../data/store')
/**
*
* @param proxy
* @param options
* @returns {Promise<void>}
*/
const clientRegistration = async function (proxy, options) {
proxy.store
proxy.post('/api/auth/client')
}
/**
*
* @param options
* @returns {fastify.FastifyInstance<http2.Http2SecureServer, http2.Http2ServerRequest, http2.Http2ServerResponse>|fastify.FastifyInstance<http2.Http2Server, http2.Http2ServerRequest, http2.Http2ServerResponse>|fastify.FastifyInstance<https.Server, http.IncomingMessage, http.ServerResponse>|fastify.FastifyInstance<http.Server, http.IncomingMessage, http.ServerResponse>}
*/
module.exports = function (options = {}) {
const proxy = fastify({
logging: options.enableRequestLogging || true
});
proxy.register(clientRegistration)
proxy.register(helmet())
return proxy
}