diff options
author | Chocobozzz <me@florianbigard.com> | 2020-04-22 16:07:04 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-05-04 16:21:39 +0200 |
commit | 7fed637506043e4432cbebe041ada0625171cceb (patch) | |
tree | 07f174e17c4b4a0b3d43a0fa6944865c06234338 /shared/extra-utils/users | |
parent | 8d4197637868d5cde49434e937186b57e40f4b2b (diff) | |
download | PeerTube-7fed637506043e4432cbebe041ada0625171cceb.tar.gz PeerTube-7fed637506043e4432cbebe041ada0625171cceb.tar.zst PeerTube-7fed637506043e4432cbebe041ada0625171cceb.zip |
Begin auth plugin support
Diffstat (limited to 'shared/extra-utils/users')
-rw-r--r-- | shared/extra-utils/users/login.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/shared/extra-utils/users/login.ts b/shared/extra-utils/users/login.ts index 4fe54a74a..2d68337a6 100644 --- a/shared/extra-utils/users/login.ts +++ b/shared/extra-utils/users/login.ts | |||
@@ -27,6 +27,16 @@ function login (url: string, client: Client, user: User, expectedStatus = 200) { | |||
27 | .expect(expectedStatus) | 27 | .expect(expectedStatus) |
28 | } | 28 | } |
29 | 29 | ||
30 | function logout (url: string, token: string, expectedStatus = 200) { | ||
31 | const path = '/api/v1/users/revoke-token' | ||
32 | |||
33 | return request(url) | ||
34 | .post(path) | ||
35 | .set('Authorization', 'Bearer ' + token) | ||
36 | .type('form') | ||
37 | .expect(expectedStatus) | ||
38 | } | ||
39 | |||
30 | async function serverLogin (server: Server) { | 40 | async function serverLogin (server: Server) { |
31 | const res = await login(server.url, server.client, server.user, 200) | 41 | const res = await login(server.url, server.client, server.user, 200) |
32 | 42 | ||
@@ -71,6 +81,7 @@ function setAccessTokensToServers (servers: ServerInfo[]) { | |||
71 | 81 | ||
72 | export { | 82 | export { |
73 | login, | 83 | login, |
84 | logout, | ||
74 | serverLogin, | 85 | serverLogin, |
75 | userLogin, | 86 | userLogin, |
76 | getAccessToken, | 87 | getAccessToken, |