cozy-proxy
Version:
Cozy Proxy redirects requests properly to the right application of the Cozy platform depending on given path. It also handles authentication to the Cozy for users and devices.
122 lines (111 loc) • 2.63 kB
JavaScript
// Generated by CoffeeScript 1.10.0
var apps, auth, devices, disk, experiment, index, passport, sharing, utils;
index = require('./index');
auth = require('./authentication');
devices = require('./devices');
disk = require('./disk');
apps = require('./applications');
experiment = require('./experimental');
sharing = require('./sharing');
utils = require('../middlewares/authentication');
passport = require('passport');
module.exports = {
'routes': {
get: index.showRoutes
},
'routes/reset*': {
get: index.resetRoutes
},
'register/password': {
post: [auth.disallowAuthenticatedUser, auth.saveUnauthenticatedUser, utils.authenticate]
},
'register/:step': {
get: [utils.isNotAuthenticated, auth.onboarding]
},
'register': {
get: [utils.isNotRegistered, auth.onboarding],
post: [auth.disallowAuthenticatedUser, auth.saveUnauthenticatedUser],
put: [utils.isAuthenticated, utils.isNotRegistered, auth.saveAuthenticatedUser]
},
'login': {
get: [utils.isNotAuthenticated, auth.loginIndex],
post: utils.authenticate
},
'login/forgot': {
post: auth.forgotPassword
},
'logout': {
get: [utils.isAuthenticated, auth.logout]
},
'password/reset/:key': {
get: auth.resetPasswordIndex,
post: auth.resetPassword
},
'authenticated': {
get: auth.authenticated
},
'user': {
get: auth.user
},
'status': {
get: index.status
},
'public/:name/*': {
all: apps.publicApp
},
'public/:name*': {
all: apps.appWithSlash
},
'disk-space': {
get: disk.getSpace
},
'device': {
post: devices.create
},
'device/:login': {
put: devices.update,
"delete": devices.remove
},
'apps/:name/*': {
all: [utils.isAuthenticated, apps.app]
},
'apps/:name*': {
all: [utils.isAuthenticated, apps.appWithSlash]
},
'replication/*': {
all: devices.replication
},
'ds-api/*': {
all: devices.dsApi
},
'versions': {
get: devices.getVersions
},
'cozy/*': {
all: devices.oldReplication
},
'services/sharing/request': {
post: [sharing.rateLimiter, sharing.request]
},
'services/sharing': {
"delete": sharing.revoke
},
'services/sharing/target': {
"delete": sharing.revokeTarget
},
'services/sharing/answer': {
post: sharing.answer
},
'services/sharing/replication/*': {
all: sharing.replication
},
'.well-known/host-meta.?:ext': {
get: experiment.webfingerHostMeta
},
'.well-known/:module': {
all: experiment.webfingerAccount
},
'*': {
all: [utils.isRegistered, utils.isAuthenticated, index.defaultRedirect]
}
};