Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let moduleExports = function (app: App) {
const config = app.get('authentication');
// !code: func_init // !end
// Set up authentication with the secret
app.configure(authentication(config));
app.configure(jwt());
app.configure(local());
// !code: loc_1 // !end
app.configure(oauth2(Object.assign({
name: 'auth0',
Strategy: Auth0Strategy,
// !code: auth0_options // !end
}, config.auth0)));
app.configure(oauth2(Object.assign({
name: 'google',
Strategy: GoogleStrategy,
// !code: google_options // !end
}, config.google)));
let moduleExports = function (app: App) {
const config = app.get('authentication');
// Set up authentication with the secret
app.configure(authentication(config));
app.configure(jwt());
app.configure(local());
// !code: loc_1 // !end
app.configure(oauth2(Object.assign({
name: 'auth0',
Strategy: Auth0Strategy
}, config.auth0)));
app.configure(oauth2(Object.assign({
name: 'google',
Strategy: GoogleStrategy
}, config.google)));
app.configure(oauth2(Object.assign({
name: 'facebook',
app.configure(socketio({}, function(io) {
io.origins(corsResolver)
io.use(function(socket, next) {
sessionMiddleware(socket.request, socket.request.res, next)
})
io.use(function(socket, next) {
socket.feathers.request = socket.request
next()
})
}))
app.configure(authentication({
session: true,
secret: REST_AUTH_SECRET || 'secret',
service: REST_AUTH_SERVICE || 'users',
cookie: {
enabled: true,
name: COOKIE_NAME,
httpOnly: false,
secure: false
},
jwt: {
header: { typ: 'access' },
audience: ORIGIN,
subject: 'authentication',
issuer: 'frontless',
algorithm: 'HS256',
expiresIn: '10d' // the access token expiry
app.use(express.json());
app.use(express.urlencoded({extended: true}));
app.configure(express.rest());
app.configure(socketio({}, function(io) {
// io.use(function(socket, next) {
// corsMiddleware(socket.request, socket.request.res, next);
// });
io.use(function(socket, next) {
sessionMiddleware(socket.request, socket.request.res, next);
});
io.use(function(socket, next) {
socket.feathers.request = socket.request;
next();
});
}));
app.configure(authentication({
session: true,
secret: process.env.REST_AUTH_SECRET,
service: process.env.REST_AUTH_SERVICE,
}));
app.configure(local());
configure(app, express);
app.use('/*', FrontLessMidleware);
services(app);
return app;
};
app.use(cors());
app.use(sessionMiddleware);
app.use(express.json());
app.use(express.urlencoded({extended: true}));
app.configure(express.rest());
app.configure(socketio({}, function(io) {
io.use(function(socket, next) {
sessionMiddleware(socket.request, socket.request.res, next);
});
io.use(function(socket, next) {
socket.feathers.request = socket.request;
next();
});
}));
app.configure(authentication({
session: true,
secret: '123sd234sdfsdf',
service: 'users',
}));
app.configure(local());
/**
* FrontLess express middleware.
* Provides methods for parsing frontless HTTP requests and valid responces
* @param {Object} req - express request
* @param {Object} res - express response
* @param {Function} next - express callback
* @async
*/
export async function FrontLessMidleware(req, res, next) {
io.use(function(socket, next) {
socket.feathers.request = socket.request;
next();
})
}))
app.use('/assets', express.static('assets'))
app.use(corsMiddleware)
app.use(sessionMiddleware)
app.use(express.json())
app.use(express.urlencoded({extended: true}))
app.configure(express.rest())
app.configure(authentication({
session: true,
secret: process.env.REST_AUTH_SECRET,
service: process.env.REST_AUTH_SERVICE,
}))
app.configure(local())
app.use(function (req, res, next) {
if ('EIO' in req.query)
return next();
if (req.headers.accept &&
req.headers.accept.includes('/json')) {
return next();
}
if (req.feathers &&