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

Method MatchesRequest

coderd/workspaceapps/token.go:34–51  ·  view source on GitHub ↗

MatchesRequest returns true if the token matches the request. Any token that does not match the request should be considered invalid.

(req Request)

Source from the content-addressed store, hash-verified

32// MatchesRequest returns true if the token matches the request. Any token that
33// does not match the request should be considered invalid.
34func (t SignedToken) MatchesRequest(req Request) bool {
35 tokenBasePath := t.Request.BasePath
36 if !strings.HasSuffix(tokenBasePath, "/") {
37 tokenBasePath += "/"
38 }
39 reqBasePath := req.BasePath
40 if !strings.HasSuffix(reqBasePath, "/") {
41 reqBasePath += "/"
42 }
43
44 return t.AccessMethod == req.AccessMethod &&
45 tokenBasePath == reqBasePath &&
46 t.Prefix == req.Prefix &&
47 t.UsernameOrID == req.UsernameOrID &&
48 t.WorkspaceNameOrID == req.WorkspaceNameOrID &&
49 t.AgentNameOrID == req.AgentNameOrID &&
50 t.AppSlugOrPort == req.AppSlugOrPort
51}
52
53type EncryptedAPIKeyPayload struct {
54 jwtutils.RegisteredClaims

Callers 4

IssueMethod · 0.95
IssueMethod · 0.95
Test_TokenMatchesRequestFunction · 0.80
ResolveRequestFunction · 0.80

Calls

no outgoing calls

Tested by 1

Test_TokenMatchesRequestFunction · 0.64