Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
1c18f3a4
Commit
1c18f3a4
authored
Jun 25, 2020
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: revoke typo
parent
056ed46b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
auth.js
server/core/auth.js
+6
-6
No files found.
server/core/auth.js
View file @
1c18f3a4
...
...
@@ -19,7 +19,7 @@ module.exports = {
},
groups
:
{},
validApiKeys
:
[],
revo
k
ationList
:
require
(
'./cache'
).
init
(),
revo
c
ationList
:
require
(
'./cache'
).
init
(),
/**
* Initialize the authentication module
...
...
@@ -119,16 +119,16 @@ module.exports = {
mustRevalidate
=
true
}
// Check if user / group is in revo
k
ation list
// Check if user / group is in revo
c
ation list
if
(
user
&&
!
mustRevalidate
)
{
const
uRevalidate
=
WIKI
.
auth
.
revo
k
ationList
.
get
(
`u
${
_
.
toString
(
user
.
id
)}
`
)
const
uRevalidate
=
WIKI
.
auth
.
revo
c
ationList
.
get
(
`u
${
_
.
toString
(
user
.
id
)}
`
)
if
(
uRevalidate
&&
user
.
iat
<
uRevalidate
)
{
mustRevalidate
=
true
}
else
if
(
DateTime
.
fromSeconds
(
user
.
iat
)
<=
WIKI
.
startedAt
)
{
// Prevent new / restarted instance from allowing revoked tokens
mustRevalidate
=
true
}
else
{
for
(
const
gid
of
user
.
groups
)
{
const
gRevalidate
=
WIKI
.
auth
.
revo
k
ationList
.
get
(
`g
${
_
.
toString
(
gid
)}
`
)
const
gRevalidate
=
WIKI
.
auth
.
revo
c
ationList
.
get
(
`g
${
_
.
toString
(
gid
)}
`
)
if
(
gRevalidate
&&
user
.
iat
<
gRevalidate
)
{
mustRevalidate
=
true
break
...
...
@@ -440,9 +440,9 @@ module.exports = {
},
/**
* Add user / group ID to JWT revo
k
ation list, forcing all requests to be validated against the latest permissions
* Add user / group ID to JWT revo
c
ation list, forcing all requests to be validated against the latest permissions
*/
revokeUserTokens
({
id
,
kind
=
'u'
})
{
WIKI
.
auth
.
revo
k
ationList
.
set
(
`
${
kind
}${
_
.
toString
(
id
)}
`
,
Math
.
round
(
DateTime
.
utc
().
minus
({
seconds
:
5
}).
toSeconds
()),
Math
.
ceil
(
ms
(
WIKI
.
config
.
auth
.
tokenExpiration
)
/
1000
))
WIKI
.
auth
.
revo
c
ationList
.
set
(
`
${
kind
}${
_
.
toString
(
id
)}
`
,
Math
.
round
(
DateTime
.
utc
().
minus
({
seconds
:
5
}).
toSeconds
()),
Math
.
ceil
(
ms
(
WIKI
.
config
.
auth
.
tokenExpiration
)
/
1000
))
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment