mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
Add ability to list and revoke token sessions
This commit is contained in:
parent
a53ed039b8
commit
57caf25611
40 changed files with 1158 additions and 138 deletions
|
@ -23,6 +23,12 @@ type TokenInfo = {
|
|||
refreshToken: string
|
||||
accessTokenExpiresAt: Date
|
||||
refreshTokenExpiresAt: Date
|
||||
loginDevice: string
|
||||
loginIP: string
|
||||
loginDate: Date
|
||||
lastActivityDevice: string
|
||||
lastActivityIP: string
|
||||
lastActivityDate: Date
|
||||
}
|
||||
|
||||
export type BypassLogin = {
|
||||
|
@ -194,13 +200,21 @@ async function saveToken (
|
|||
authName = refreshTokenAuthName
|
||||
}
|
||||
|
||||
logger.debug('Saving token ' + token.accessToken + ' for client ' + client.id + ' and user ' + user.id + '.')
|
||||
logger.debug(`Saving token ${token.accessToken} for client ${client.id} and user ${user.id}.`)
|
||||
|
||||
const tokenToCreate = {
|
||||
accessToken: token.accessToken,
|
||||
accessTokenExpiresAt: token.accessTokenExpiresAt,
|
||||
refreshToken: token.refreshToken,
|
||||
refreshTokenExpiresAt: token.refreshTokenExpiresAt,
|
||||
...pick(token, [
|
||||
'accessToken',
|
||||
'refreshToken',
|
||||
'accessTokenExpiresAt',
|
||||
'refreshTokenExpiresAt',
|
||||
'loginDevice',
|
||||
'loginIP',
|
||||
'loginDate',
|
||||
'lastActivityDate',
|
||||
'lastActivityDevice',
|
||||
'lastActivityIP'
|
||||
]),
|
||||
authName,
|
||||
oAuthClientId: client.id,
|
||||
userId: user.id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue