diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-03-21 11:56:33 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-03-21 11:56:33 +0100 |
commit | 9457bf88079a23d28011ff7c65faa56a548b7817 (patch) | |
tree | f4507aa5ad04b7fca4ab49acee5aa97c6c962f6c /server/controllers/api/v1 | |
parent | 233d12d8b1916eae5bae230dc965045adb89a173 (diff) | |
download | PeerTube-9457bf88079a23d28011ff7c65faa56a548b7817.tar.gz PeerTube-9457bf88079a23d28011ff7c65faa56a548b7817.tar.zst PeerTube-9457bf88079a23d28011ff7c65faa56a548b7817.zip |
OAuth server: first draft
Diffstat (limited to 'server/controllers/api/v1')
-rw-r--r-- | server/controllers/api/v1/index.js | 2 | ||||
-rw-r--r-- | server/controllers/api/v1/users.js | 22 |
2 files changed, 24 insertions, 0 deletions
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() | |||
6 | 6 | ||
7 | const podsController = require('./pods') | 7 | const podsController = require('./pods') |
8 | const remoteVideosController = require('./remoteVideos') | 8 | const remoteVideosController = require('./remoteVideos') |
9 | const usersController = require('./users') | ||
9 | const videosController = require('./videos') | 10 | const videosController = require('./videos') |
10 | 11 | ||
11 | router.use('/pods', podsController) | 12 | router.use('/pods', podsController) |
12 | router.use('/remotevideos', remoteVideosController) | 13 | router.use('/remotevideos', remoteVideosController) |
14 | router.use('/users', usersController) | ||
13 | router.use('/videos', videosController) | 15 | router.use('/videos', videosController) |
14 | router.use('/*', badRequest) | 16 | router.use('/*', badRequest) |
15 | 17 | ||
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 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | var express = require('express') | ||
4 | var oAuth2 = require('../../../middlewares/oauth2') | ||
5 | |||
6 | const middleware = require('../../../middlewares') | ||
7 | const cacheMiddleware = middleware.cache | ||
8 | |||
9 | const router = express.Router() | ||
10 | |||
11 | router.post('/token', cacheMiddleware.cache(false), oAuth2.token(), success) | ||
12 | router.get('/authenticate', cacheMiddleware.cache(false), oAuth2.authenticate(), success) | ||
13 | |||
14 | // --------------------------------------------------------------------------- | ||
15 | |||
16 | module.exports = router | ||
17 | |||
18 | // --------------------------------------------------------------------------- | ||
19 | |||
20 | function success (req, res, next) { | ||
21 | res.end() | ||
22 | } | ||