diff options
Diffstat (limited to 'packages/tests/fixtures/peertube-plugin-test-external-auth-two/main.js')
-rw-r--r-- | packages/tests/fixtures/peertube-plugin-test-external-auth-two/main.js | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/packages/tests/fixtures/peertube-plugin-test-external-auth-two/main.js b/packages/tests/fixtures/peertube-plugin-test-external-auth-two/main.js new file mode 100644 index 000000000..755dbb62b --- /dev/null +++ b/packages/tests/fixtures/peertube-plugin-test-external-auth-two/main.js | |||
@@ -0,0 +1,95 @@ | |||
1 | async function register ({ | ||
2 | registerExternalAuth, | ||
3 | peertubeHelpers | ||
4 | }) { | ||
5 | { | ||
6 | const result = registerExternalAuth({ | ||
7 | authName: 'external-auth-3', | ||
8 | authDisplayName: () => 'External Auth 3', | ||
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 | }) | ||
19 | } | ||
20 | |||
21 | { | ||
22 | const result = registerExternalAuth({ | ||
23 | authName: 'external-auth-4', | ||
24 | authDisplayName: () => 'External Auth 4', | ||
25 | onAuthRequest: (req, res) => { | ||
26 | result.userAuthenticated({ | ||
27 | req, | ||
28 | res, | ||
29 | username: 'kefka2', | ||
30 | email: 'kefka@example.com', | ||
31 | displayName: 'Kefka duplication' | ||
32 | }) | ||
33 | } | ||
34 | }) | ||
35 | } | ||
36 | |||
37 | { | ||
38 | const result = registerExternalAuth({ | ||
39 | authName: 'external-auth-5', | ||
40 | authDisplayName: () => 'External Auth 5', | ||
41 | onAuthRequest: (req, res) => { | ||
42 | result.userAuthenticated({ | ||
43 | req, | ||
44 | res, | ||
45 | username: 'kefka', | ||
46 | email: 'kefka@example.com', | ||
47 | displayName: 'Kefka duplication' | ||
48 | }) | ||
49 | } | ||
50 | }) | ||
51 | } | ||
52 | |||
53 | { | ||
54 | const result = registerExternalAuth({ | ||
55 | authName: 'external-auth-6', | ||
56 | authDisplayName: () => 'External Auth 6', | ||
57 | onAuthRequest: (req, res) => { | ||
58 | result.userAuthenticated({ | ||
59 | req, | ||
60 | res, | ||
61 | username: 'existing_user', | ||
62 | email: 'existing_user@example.com', | ||
63 | displayName: 'Existing user' | ||
64 | }) | ||
65 | } | ||
66 | }) | ||
67 | } | ||
68 | |||
69 | { | ||
70 | const result = registerExternalAuth({ | ||
71 | authName: 'external-auth-7', | ||
72 | authDisplayName: () => 'External Auth 7', | ||
73 | onAuthRequest: (req, res) => { | ||
74 | result.userAuthenticated({ | ||
75 | req, | ||
76 | res, | ||
77 | username: 'existing_user2', | ||
78 | email: 'custom_email_existing_user2@example.com', | ||
79 | displayName: 'Existing user 2' | ||
80 | }) | ||
81 | } | ||
82 | }) | ||
83 | } | ||
84 | } | ||
85 | |||
86 | async function unregister () { | ||
87 | return | ||
88 | } | ||
89 | |||
90 | module.exports = { | ||
91 | register, | ||
92 | unregister | ||
93 | } | ||
94 | |||
95 | // ########################################################################### | ||