aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/fixtures/peertube-plugin-test-external-auth-two/main.js
blob: 1604a7c41524a4a2f75feae2fc910792fe1ddf07 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
async function register ({
  registerExternalAuth,
  peertubeHelpers
}) {
  {
    const result = registerExternalAuth({
      authName: 'external-auth-3',
      authDisplayName: () => 'External Auth 3',
      onAuthRequest: (req, res) => {
        result.userAuthenticated({
          req,
          res,
          username: 'cid',
          email: 'cid@example.com',
          displayName: 'Cid Marquez'
        })
      }
    })
  }

  {
    const result = registerExternalAuth({
      authName: 'external-auth-4',
      authDisplayName: () => 'External Auth 4',
      onAuthRequest: (req, res) => {
        result.userAuthenticated({
          req,
          res,
          username: 'kefka2',
          email: 'kefka@example.com',
          displayName: 'Kefka duplication'
        })
      }
    })
  }

  {
    const result = registerExternalAuth({
      authName: 'external-auth-5',
      authDisplayName: () => 'External Auth 5',
      onAuthRequest: (req, res) => {
        result.userAuthenticated({
          req,
          res,
          username: 'kefka',
          email: 'kefka@example.com',
          displayName: 'Kefka duplication'
        })
      }
    })
  }

  {
    const result = registerExternalAuth({
      authName: 'external-auth-6',
      authDisplayName: () => 'External Auth 6',
      onAuthRequest: (req, res) => {
        result.userAuthenticated({
          req,
          res,
          username: 'existing_user',
          email: 'existing_user@example.com',
          displayName: 'Existing user'
        })
      }
    })
  }
}

async function unregister () {
  return
}

module.exports = {
  register,
  unregister
}

// ###########################################################################