diff options
author | Chocobozzz <chocobozzz@framasoft.org> | 2020-11-20 15:36:43 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@framasoft.org> | 2020-11-20 15:36:43 +0100 |
commit | 74fd2643b43057c25558b3da79398efe104e2660 (patch) | |
tree | 4fd7dd84775780eed82bc4b3caaa328c3526a14c /server/tests/fixtures | |
parent | 8f3ad70874f8769f5340632754dc2ca7f4c82733 (diff) | |
download | PeerTube-74fd2643b43057c25558b3da79398efe104e2660.tar.gz PeerTube-74fd2643b43057c25558b3da79398efe104e2660.tar.zst PeerTube-74fd2643b43057c25558b3da79398efe104e2660.zip |
Provide express request to onLogout call
+ pluginInfo related changes
Diffstat (limited to 'server/tests/fixtures')
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test-external-auth-three/main.js | 53 | ||||
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test-external-auth-three/package.json | 20 |
2 files changed, 73 insertions, 0 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-three/main.js b/server/tests/fixtures/peertube-plugin-test-external-auth-three/main.js new file mode 100644 index 000000000..30cedccc6 --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-external-auth-three/main.js | |||
@@ -0,0 +1,53 @@ | |||
1 | async function register ({ | ||
2 | registerExternalAuth, | ||
3 | peertubeHelpers | ||
4 | }) { | ||
5 | { | ||
6 | const result = registerExternalAuth({ | ||
7 | authName: 'external-auth-7', | ||
8 | authDisplayName: () => 'External Auth 7', | ||
9 | onAuthRequest: (req, res) => { | ||
10 | result.userAuthenticated({ | ||
11 | req, | ||
12 | res, | ||
13 | username: 'cid', | ||
14 | email: 'cid@example.com', | ||
15 | displayName: 'Cid Marquez' | ||
16 | }) | ||
17 | }, | ||
18 | onLogout: (user, req) => { | ||
19 | return 'https://example.com/redirectUrl' | ||
20 | } | ||
21 | }) | ||
22 | } | ||
23 | |||
24 | { | ||
25 | const result = registerExternalAuth({ | ||
26 | authName: 'external-auth-8', | ||
27 | authDisplayName: () => 'External Auth 8', | ||
28 | onAuthRequest: (req, res) => { | ||
29 | result.userAuthenticated({ | ||
30 | req, | ||
31 | res, | ||
32 | username: 'cid', | ||
33 | email: 'cid@example.com', | ||
34 | displayName: 'Cid Marquez' | ||
35 | }) | ||
36 | }, | ||
37 | onLogout: (user, req) => { | ||
38 | return 'https://example.com/redirectUrl?access_token=' + req.headers['authorization'].split(' ')[1] | ||
39 | } | ||
40 | }) | ||
41 | } | ||
42 | } | ||
43 | |||
44 | async function unregister () { | ||
45 | |||
46 | } | ||
47 | |||
48 | module.exports = { | ||
49 | register, | ||
50 | unregister | ||
51 | } | ||
52 | |||
53 | // ########################################################################### | ||
diff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-three/package.json b/server/tests/fixtures/peertube-plugin-test-external-auth-three/package.json new file mode 100644 index 000000000..f323d189d --- /dev/null +++ b/server/tests/fixtures/peertube-plugin-test-external-auth-three/package.json | |||
@@ -0,0 +1,20 @@ | |||
1 | { | ||
2 | "name": "peertube-plugin-test-external-auth-three", | ||
3 | "version": "0.0.1", | ||
4 | "description": "External auth three", | ||
5 | "engine": { | ||
6 | "peertube": ">=1.3.0" | ||
7 | }, | ||
8 | "keywords": [ | ||
9 | "peertube", | ||
10 | "plugin" | ||
11 | ], | ||
12 | "homepage": "https://github.com/Chocobozzz/PeerTube", | ||
13 | "author": "Chocobozzz", | ||
14 | "bugs": "https://github.com/Chocobozzz/PeerTube/issues", | ||
15 | "library": "./main.js", | ||
16 | "staticDirs": {}, | ||
17 | "css": [], | ||
18 | "clientScripts": [], | ||
19 | "translations": {} | ||
20 | } | ||