2024-07-14 12:25:30 +00:00
|
|
|
package grpc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-07-14 12:56:06 +00:00
|
|
|
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
|
2024-07-14 12:25:30 +00:00
|
|
|
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
|
2024-07-15 14:20:37 +00:00
|
|
|
"google.golang.org/grpc"
|
2024-07-14 12:25:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (v *Server) Authenticate(ctx context.Context, request *proto.AuthRequest) (*proto.AuthReply, error) {
|
2024-07-15 14:20:37 +00:00
|
|
|
return forwardInvokeRequest(
|
|
|
|
hyper.ServiceTypeAuthProvider,
|
|
|
|
func(ctx context.Context, conn *grpc.ClientConn) (*proto.AuthReply, error) {
|
|
|
|
out, err := proto.NewAuthClient(conn).Authenticate(ctx, request)
|
|
|
|
return out, err
|
|
|
|
},
|
|
|
|
)
|
2024-07-14 12:25:30 +00:00
|
|
|
}
|
|
|
|
|
2024-07-15 12:04:03 +00:00
|
|
|
func (v *Server) EnsurePermGranted(ctx context.Context, request *proto.CheckPermRequest) (*proto.CheckPermResponse, error) {
|
2024-07-15 14:20:37 +00:00
|
|
|
return forwardInvokeRequest(
|
|
|
|
hyper.ServiceTypeAuthProvider,
|
|
|
|
func(ctx context.Context, conn *grpc.ClientConn) (*proto.CheckPermResponse, error) {
|
|
|
|
out, err := proto.NewAuthClient(conn).EnsurePermGranted(ctx, request)
|
|
|
|
return out, err
|
|
|
|
},
|
|
|
|
)
|
2024-07-14 12:25:30 +00:00
|
|
|
}
|
2024-07-15 12:04:03 +00:00
|
|
|
|
|
|
|
func (v *Server) EnsureUserPermGranted(ctx context.Context, request *proto.CheckUserPermRequest) (*proto.CheckUserPermResponse, error) {
|
2024-07-15 14:20:37 +00:00
|
|
|
return forwardInvokeRequest(
|
|
|
|
hyper.ServiceTypeAuthProvider,
|
|
|
|
func(ctx context.Context, conn *grpc.ClientConn) (*proto.CheckUserPermResponse, error) {
|
|
|
|
out, err := proto.NewAuthClient(conn).EnsureUserPermGranted(ctx, request)
|
|
|
|
return out, err
|
|
|
|
},
|
|
|
|
)
|
2024-07-15 12:04:03 +00:00
|
|
|
}
|