diff options
Diffstat (limited to 'server/tests/fixtures/peertube-plugin-test-external-auth-three/main.js')
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test-external-auth-three/main.js | 53 |
1 files changed, 53 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 | // ########################################################################### | ||