diff options
| author | Fuwn <[email protected]> | 2026-02-08 01:35:41 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-08 01:35:41 -0800 |
| commit | b8a9b40f786554e5a49511ce1b2dd2ea7f3db94c (patch) | |
| tree | 23fcdad5c10a7a269286459b4b666120d92f2af7 /services/worker/internal/fetcher | |
| parent | fix: update worker Dockerfile to Go 1.24 to match go.mod requirement (diff) | |
| download | asa.news-b8a9b40f786554e5a49511ce1b2dd2ea7f3db94c.tar.xz asa.news-b8a9b40f786554e5a49511ce1b2dd2ea7f3db94c.zip | |
feat: implement authenticated feed support across worker and web app
Wire up the full authenticated feeds pipeline:
- Worker resolves credentials from Supabase Vault for authenticated feeds
- Worker sets owner_id on entries for per-user dedup
- query_param auth now parses name=value format
- Add-feed dialog shows auth type + credential fields for pro/developer
- Subscribe mutation passes credentials to RPC
- Sidebar and settings show [auth] indicator for authenticated feeds
Diffstat (limited to 'services/worker/internal/fetcher')
| -rw-r--r-- | services/worker/internal/fetcher/authentication.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/services/worker/internal/fetcher/authentication.go b/services/worker/internal/fetcher/authentication.go index ba10196..9ee4539 100644 --- a/services/worker/internal/fetcher/authentication.go +++ b/services/worker/internal/fetcher/authentication.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "net/url" + "strings" ) type AuthenticationConfiguration struct { @@ -21,6 +22,12 @@ func ApplyAuthentication(request *http.Request, authenticationConfig Authenticat request.Header.Set("Authorization", "Basic "+encodedCredentials) case "query_param": + parts := strings.SplitN(authenticationConfig.AuthenticationValue, "=", 2) + + if len(parts) != 2 { + return fmt.Errorf("query_param credential must be in format 'param_name=value', got: %s", authenticationConfig.AuthenticationValue) + } + existingURL, parseError := url.Parse(request.URL.String()) if parseError != nil { @@ -29,7 +36,7 @@ func ApplyAuthentication(request *http.Request, authenticationConfig Authenticat queryParameters := existingURL.Query() - queryParameters.Set("key", authenticationConfig.AuthenticationValue) + queryParameters.Set(parts[0], parts[1]) existingURL.RawQuery = queryParameters.Encode() request.URL = existingURL |