Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
c24181b2
Commit
c24181b2
authored
Nov 05, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix jwt checks
parent
39a0e69b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
5 deletions
+3
-5
jwt.go
api/v1/jwt.go
+1
-1
server.go
server/server.go
+0
-2
AccessTokenSection.tsx
web/src/components/Settings/AccessTokenSection.tsx
+2
-2
No files found.
api/v1/jwt.go
View file @
c24181b2
...
@@ -60,7 +60,7 @@ func JWTMiddleware(server *APIV1Service, next echo.HandlerFunc, secret string) e
...
@@ -60,7 +60,7 @@ func JWTMiddleware(server *APIV1Service, next echo.HandlerFunc, secret string) e
}
}
// Skip validation for server status endpoints.
// Skip validation for server status endpoints.
if
util
.
HasPrefixes
(
path
,
"/api/v1/ping"
,
"/api/v1/idp"
,
"/api/v1/status"
,
"/api/v1/user"
)
&&
path
!=
"/api/v1/user/me"
&&
method
==
http
.
MethodGet
{
if
util
.
HasPrefixes
(
path
,
"/api/v1/ping"
,
"/api/v1/idp"
,
"/api/v1/status"
,
"/api/v1/user"
)
&&
path
!=
"/api/v1/user/me"
&&
path
!=
"/api/v1/user"
&&
method
==
http
.
MethodGet
{
return
next
(
c
)
return
next
(
c
)
}
}
...
...
server/server.go
View file @
c24181b2
...
@@ -61,8 +61,6 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
...
@@ -61,8 +61,6 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
`"status":${status},"error":"${error}"}`
+
"
\n
"
,
`"status":${status},"error":"${error}"}`
+
"
\n
"
,
}))
}))
e
.
Use
(
middleware
.
Gzip
())
e
.
Use
(
middleware
.
CORSWithConfig
(
middleware
.
CORSConfig
{
e
.
Use
(
middleware
.
CORSWithConfig
(
middleware
.
CORSConfig
{
Skipper
:
grpcRequestSkipper
,
Skipper
:
grpcRequestSkipper
,
AllowOrigins
:
[]
string
{
"*"
},
AllowOrigins
:
[]
string
{
"*"
},
...
...
web/src/components/Settings/AccessTokenSection.tsx
View file @
c24181b2
...
@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
...
@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
import
{
toast
}
from
"react-hot-toast"
;
import
{
toast
}
from
"react-hot-toast"
;
import
{
userServiceClient
}
from
"@/grpcweb"
;
import
{
userServiceClient
}
from
"@/grpcweb"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
UserNamePrefix
,
extractUsernameFromName
}
from
"@/store/v1"
;
import
{
UserAccessToken
}
from
"@/types/proto/api/v2/user_service"
;
import
{
UserAccessToken
}
from
"@/types/proto/api/v2/user_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
showCreateAccessTokenDialog
from
"../CreateAccessTokenDialog"
;
import
showCreateAccessTokenDialog
from
"../CreateAccessTokenDialog"
;
...
@@ -13,7 +13,7 @@ import Icon from "../Icon";
...
@@ -13,7 +13,7 @@ import Icon from "../Icon";
import
LearnMore
from
"../LearnMore"
;
import
LearnMore
from
"../LearnMore"
;
const
listAccessTokens
=
async
(
username
:
string
)
=>
{
const
listAccessTokens
=
async
(
username
:
string
)
=>
{
const
{
accessTokens
}
=
await
userServiceClient
.
listUserAccessTokens
({
name
:
`
${
User
AccessToken
}${
username
}
`
});
const
{
accessTokens
}
=
await
userServiceClient
.
listUserAccessTokens
({
name
:
`
${
User
NamePrefix
}${
username
}
`
});
return
accessTokens
;
return
accessTokens
;
};
};
...
...
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