X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Ffixtures%2Fpeertube-plugin-test-id-pass-auth-two%2Fmain.js;h=ceab7b60de3a96284e0ed688aaac6b9b2da9aebf;hb=e307e4fce39853d445d086f92b8c556c363ee15d;hp=c0e560019c59e5951d25a4457b39057126e472a5;hpb=e1c5503114deef954731904695cd40dccfcef555;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js index c0e560019..ceab7b60d 100644 --- a/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js +++ b/server/tests/fixtures/peertube-plugin-test-id-pass-auth-two/main.js @@ -11,6 +11,24 @@ async function register ({ getWeight: () => 30, + hookTokenValidity: (options) => { + if (options.type === 'refresh') { + return { valid: false } + } + + if (options.type === 'access') { + const token = options.token + const now = new Date() + now.setTime(now.getTime() - 5000) + + const createdAt = new Date(token.createdAt) + + return { valid: createdAt.getTime() >= now.getTime() } + } + + return { valid: true } + }, + login (body) { if (body.id === 'laguna' && body.password === 'laguna password') { return Promise.resolve({