A lot of thigs are going on
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
18
main.go
18
main.go
@@ -10,9 +10,8 @@ import (
|
||||
"time"
|
||||
|
||||
v1 "gitea.badhouseplants.net/softplayer/softplayer-backend/api/v1"
|
||||
"gitea.badhouseplants.net/softplayer/softplayer-backend/internal/authorization"
|
||||
"gitea.badhouseplants.net/softplayer/softplayer-backend/internal/controllers"
|
||||
"gitea.badhouseplants.net/softplayer/softplayer-backend/internal/tools/logger"
|
||||
"gitea.badhouseplants.net/softplayer/softplayer-backend/internal/helpers/logger"
|
||||
accounts "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/accounts/v1"
|
||||
test "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/test/v1"
|
||||
"github.com/alecthomas/kong"
|
||||
@@ -160,13 +159,19 @@ func server(ctx context.Context, params Serve) error {
|
||||
}
|
||||
|
||||
authReqServices := func(ctx context.Context, callMeta interceptors.CallMeta) bool {
|
||||
return !strings.Contains(callMeta.Service, "NoAuth")
|
||||
serviceParts := strings.Split(callMeta.Service, ".")
|
||||
if len(serviceParts) == 0 {
|
||||
return false
|
||||
}
|
||||
serviceName := serviceParts[len(serviceParts)-1]
|
||||
fmt.Println(serviceName)
|
||||
return !strings.HasPrefix(serviceName, "Public")
|
||||
}
|
||||
rdb := redis.NewClient(&redis.Options{
|
||||
Addr: params.RedisHost,
|
||||
})
|
||||
|
||||
authInterceptor := authorization.NewAuthController(
|
||||
authInterceptor := controllers.NewAuthController(
|
||||
[]byte(params.JWTSecret),
|
||||
params.AccessTokenTTL,
|
||||
params.RefrestTokenTTL,
|
||||
@@ -195,8 +200,9 @@ func server(ctx context.Context, params Serve) error {
|
||||
JWTSecret: []byte(params.JWTSecret),
|
||||
Redis: rdb,
|
||||
}
|
||||
accounts.RegisterAccountsNoAuthServiceServer(grpcServer, v1.NewAccountNoAuthRPCImpl(accountCtrl, authInterceptor))
|
||||
accounts.RegisterAccountsAuthServiceServer(grpcServer, v1.NewAccountAuthRPCImpl(accountCtrl, authInterceptor))
|
||||
|
||||
accounts.RegisterPublicAccountsServiceServer(grpcServer, v1.NewAccountNoAuthRPCImpl(accountCtrl, authInterceptor))
|
||||
accounts.RegisterAccountsServiceServer(grpcServer, v1.NewAccountAuthRPCImpl(accountCtrl, authInterceptor))
|
||||
test.RegisterTestAuthServiceServer(grpcServer, v1.NewTestAuthRPCImpl())
|
||||
test.RegisterTestNoAuthServiceServer(grpcServer, v1.NewTestNoAuthRPCImpl())
|
||||
if err := grpcServer.Serve(lis); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user