Start adding token auth
All checks were successful
ci/woodpecker/push/build Pipeline was successful

Signed-off-by: Nikolai Rodionov <iam@allanger.xyz>
This commit is contained in:
2026-05-14 19:54:55 +02:00
parent c5af2c7544
commit efe9042bdc
6 changed files with 149 additions and 23 deletions

View File

@@ -99,6 +99,7 @@ func (cmd *Server) Run(ctx context.Context) error {
tokenCtrl := &controllers.TokenController{
DB: db,
HashCost: cmd.HashCost,
Redis: rdb,
}
accountCtrl := &controllers.AccountController{
@@ -136,6 +137,7 @@ func selectorRequireAuth(ctx context.Context, callMeta interceptors.CallMeta) bo
return false
}
serviceName := serviceParts[len(serviceParts)-1]
fmt.Println(serviceName)
if strings.HasPrefix(serviceName, "Public") {
return false
@@ -145,5 +147,9 @@ func selectorRequireAuth(ctx context.Context, callMeta interceptors.CallMeta) bo
return false
}
if strings.Contains(callMeta.Method, "AuthenticateWithToken") {
return false
}
return true
}