Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2654f28

Browse files
authored
Fixed trigger check (#251)
1 parentd081119 commit2654f28

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

‎handlers/auth.go‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,23 @@ var (
1818
errNotAuthorized=errors.New("no or invalid jwt token provided. You are not authorized")
1919

2020
// Non-protected URL paths which are prefix checked
21-
nonProtectedPathsPrefix= []string{
21+
nonProtectedPathsPrefix= []string{
2222
"/login",
2323
"/pipeline/githook",
24-
"/trigger",
2524
"/worker/register",
2625
"/js/",
2726
"/img/",
2827
"/fonts/",
2928
"/css/",
3029
}
3130

31+
// Non-protected URL paths which are suffix checked
32+
nonProtectedPathsSuffix= []string{
33+
"/trigger",
34+
}
35+
3236
// Non-protected URL paths which are explicitly checked
33-
nonProtectedPaths= []string{
37+
nonProtectedPaths= []string{
3438
"/",
3539
"/favicon.ico",
3640
}
@@ -59,6 +63,14 @@ func AuthMiddleware(roleAuth *AuthConfig) echo.MiddlewareFunc {
5963
}
6064
}
6165

66+
// Check if it matches a suffix-based paths
67+
for_,suffix:=rangenonProtectedPathsSuffix {
68+
switch {
69+
casestrings.HasSuffix(c.Path(),suffix):
70+
returnnext(c)
71+
}
72+
}
73+
6274
token,err:=getToken(c)
6375
iferr!=nil {
6476
returnc.String(http.StatusUnauthorized,err.Error())

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp