MCPcopy Index your code
hub / github.com/rilldata/rill / OAuthExternalResourceURL

Method OAuthExternalResourceURL

admin/urls.go:442–451  ·  view source on GitHub ↗

OAuthExternalResourceURL returns the external URL for OAuth 2.0 resource access. If a request is provided, it uses the request's Host header to construct the URL to make sure protected resource URLs origin matches with the resource URL being accessed by the client. This helps in cases, for example,

(r *http.Request)

Source from the content-addressed store, hash-verified

440// If a request is provided, it uses the request's Host header to construct the URL to make sure protected resource URLs origin matches with the resource URL being accessed by the client.
441// This helps in cases, for example, where the MCP server url starts with api.rilldata.com instead of admin.rilldata.com.
442func (u *URLs) OAuthExternalResourceURL(r *http.Request) string {
443 if r != nil {
444 scheme := "http"
445 if u.IsHTTPS() {
446 scheme = "https"
447 }
448 return fmt.Sprintf("%s://%s", scheme, r.Host)
449 }
450 return u.External()
451}
452
453// OAuthProtectedResourceMetadata returns the URL for the OAuth 2.0 Protected Resource Metadata endpoint.
454// This endpoint is used by MCP clients to discover authorization server information.

Calls 2

IsHTTPSMethod · 0.95
ExternalMethod · 0.95

Tested by

no test coverage detected