aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/fixtures/peertube-plugin-test-external-auth-three/main.js
blob: 30cedccc600e3b29cbacd9645835f8df520279bf (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
async function register ({
  registerExternalAuth,
  peertubeHelpers
}) {
  {
    const result = registerExternalAuth({
      authName: 'external-auth-7',
      authDisplayName: () => 'External Auth 7',
      onAuthRequest: (req, res) => {
        result.userAuthenticated({
          req,
          res,
          username: 'cid',
          email: 'cid@example.com',
          displayName: 'Cid Marquez'
        })
      },
      onLogout: (user, req) => {
        return 'https://example.com/redirectUrl'
      }
    })
  }

  {
    const result = registerExternalAuth({
      authName: 'external-auth-8',
      authDisplayName: () => 'External Auth 8',
      onAuthRequest: (req, res) => {
        result.userAuthenticated({
          req,
          res,
          username: 'cid',
          email: 'cid@example.com',
          displayName: 'Cid Marquez'
        })
      },
      onLogout: (user, req) => {
        return 'https://example.com/redirectUrl?access_token=' + req.headers['authorization'].split(' ')[1]
      }
    })
  }
}

async function unregister () {

}

module.exports = {
  register,
  unregister
}

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