(ctx context.Context, req *proto.CoordinateRequest)
| 114 | } |
| 115 | |
| 116 | func (a ClientUserCoordinateeAuth) Authorize(ctx context.Context, req *proto.CoordinateRequest) error { |
| 117 | if tun := req.GetAddTunnel(); tun != nil { |
| 118 | uid, err := uuid.FromBytes(tun.Id) |
| 119 | if err != nil { |
| 120 | return xerrors.Errorf("parse add tunnel id: %w", err) |
| 121 | } |
| 122 | err = a.Auth.AuthorizeTunnel(ctx, uid) |
| 123 | if err != nil { |
| 124 | return xerrors.Errorf("workspace agent not found or you do not have permission") |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | return handleClientNodeRequests(req) |
| 129 | } |
| 130 | |
| 131 | // handleClientNodeRequests validates GetUpdateSelf requests and declines ReadyForHandshake requests |
| 132 | func handleClientNodeRequests(req *proto.CoordinateRequest) error { |
nothing calls this directly
no test coverage detected