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

Function shouldRefreshOIDCToken

coderd/mcp.go:131–141  ·  view source on GitHub ↗

shouldRefreshOIDCToken mirrors provisionerdserver.shouldRefreshOIDCToken. See that function for the rationale behind the 10-minute pre-expiry buffer.

(link database.UserLink)

Source from the content-addressed store, hash-verified

129// See that function for the rationale behind the 10-minute pre-expiry
130// buffer.
131func shouldRefreshOIDCToken(link database.UserLink) (bool, time.Time) {
132 if link.OAuthRefreshToken == "" {
133 return false, link.OAuthExpiry
134 }
135 if link.OAuthExpiry.IsZero() {
136 // A zero expiry means the token never expires.
137 return false, link.OAuthExpiry
138 }
139 expiresAt := link.OAuthExpiry.Add(-time.Minute * 10)
140 return expiresAt.Before(dbtime.Now()), expiresAt
141}
142
143// @Summary List MCP server configs
144// @x-apidocgen {"skip": true}

Callers 2

OIDCAccessTokenMethod · 0.70

Calls 3

NowFunction · 0.92
AddMethod · 0.65
IsZeroMethod · 0.45

Tested by 1