MCPcopy Index your code
hub / github.com/coder/coder / Authorize

Method Authorize

tailnet/tunnel.go:116–129  ·  view source on GitHub ↗
(ctx context.Context, req *proto.CoordinateRequest)

Source from the content-addressed store, hash-verified

114}
115
116func (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
132func handleClientNodeRequests(req *proto.CoordinateRequest) error {

Callers

nothing calls this directly

Calls 4

handleClientNodeRequestsFunction · 0.85
GetAddTunnelMethod · 0.80
AuthorizeTunnelMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected