From 9457bf88079a23d28011ff7c65faa56a548b7817 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 21 Mar 2016 11:56:33 +0100 Subject: OAuth server: first draft --- server/controllers/api/v1/index.js | 2 ++ server/controllers/api/v1/users.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 server/controllers/api/v1/users.js (limited to 'server/controllers/api') diff --git a/server/controllers/api/v1/index.js b/server/controllers/api/v1/index.js index 45f07ae1f..7b3ec32c0 100644 --- a/server/controllers/api/v1/index.js +++ b/server/controllers/api/v1/index.js @@ -6,10 +6,12 @@ const router = express.Router() const podsController = require('./pods') const remoteVideosController = require('./remoteVideos') +const usersController = require('./users') const videosController = require('./videos') router.use('/pods', podsController) router.use('/remotevideos', remoteVideosController) +router.use('/users', usersController) router.use('/videos', videosController) router.use('/*', badRequest) diff --git a/server/controllers/api/v1/users.js b/server/controllers/api/v1/users.js new file mode 100644 index 000000000..acb860c66 --- /dev/null +++ b/server/controllers/api/v1/users.js @@ -0,0 +1,22 @@ +'use strict' + +var express = require('express') +var oAuth2 = require('../../../middlewares/oauth2') + +const middleware = require('../../../middlewares') +const cacheMiddleware = middleware.cache + +const router = express.Router() + +router.post('/token', cacheMiddleware.cache(false), oAuth2.token(), success) +router.get('/authenticate', cacheMiddleware.cache(false), oAuth2.authenticate(), success) + +// --------------------------------------------------------------------------- + +module.exports = router + +// --------------------------------------------------------------------------- + +function success (req, res, next) { + res.end() +} -- cgit v1.2.3