shouldRefreshOIDCToken mirrors provisionerdserver.shouldRefreshOIDCToken. See that function for the rationale behind the 10-minute pre-expiry buffer.
(link database.UserLink)
| 129 | // See that function for the rationale behind the 10-minute pre-expiry |
| 130 | // buffer. |
| 131 | func 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} |