@@ -18,19 +18,23 @@ var (
1818errNotAuthorized = 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 := range nonProtectedPathsSuffix {
68+ switch {
69+ case strings .HasSuffix (c .Path (),suffix ):
70+ return next (c )
71+ }
72+ }
73+
6274token ,err := getToken (c )
6375if err != nil {
6476return c .String (http .StatusUnauthorized ,err .Error ())