octoposprime / op-be-graphql

OctopOS Prime Backend Api Gateway
http://www.octoposprime.com
MIT License
13 stars 1 forks source link

Update auth.go: Remove Imports & Disable #66

Closed Feyzanrs closed 3 months ago

Feyzanrs commented 3 months ago

In order to align with current project requirements, we need to refactor the authorization.go file located in pkg/infrastructure/adapter/service/authorization.go. The primary task is to temporarily disable the CheckAuth function and clean up the imports that are no longer necessary due to this change. This update will help streamline the code and reduce dependencies.

The new version of the code:

package infrastructure

// CheckAuth returns true if the user is authorized to perform the action.
// func (a ServiceAdapter) CheckAuth(ctx context.Context, authRequest *pb.AuthRequest) (*pb.AuthResponse, error) {
//     conn, err := grpc.Dial(tconfig.GetInternalConfigInstance().Grpc.AuthorizationHost+":"+tconfig.GetInternalConfigInstance().Grpc.AuthorizationPort, grpc.WithTransportCredentials(insecure.NewCredentials()))
//     if err != nil {
//         userId, _ := ctx.Value(smodel.QueryKeyUid).(string)
//         go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "Login", userId, err.Error()))
//         return &pb.AuthResponse{IsAuthorized: false}, err
//     }

//     pbResult, err := pb.NewAuthorizationSvcClient(conn).CheckAuth(ctx, authRequest)
//     if err != nil {
//         userId, _ := ctx.Value(smodel.QueryKeyUid).(string)
//         go a.Log(context.Background(), me.NewLogData().GenerateLogData(pb_logging.LogType_LogTypeERROR, "Login", userId, err.Error()))
//         return &pb.AuthResponse{IsAuthorized: false}, err
//     }
//     return pbResult, nil
// }

Additionally, please make sure to push all changes to the feature/hsm/58/auth-service branch.