~bigbes/core-go

ref: bdb0f7e8ad77b331f7a0d3ec5a60733250095233 core-go/auth d---------
3e69641e — Adnan Maolood 4 years ago
auth: Use canonical user IDs

When adding users to the database, use the canonical user ID from
meta.sr.ht.
12000f49 — Drew DeVault 3 years ago
Revert "auth: Use canonical user IDs"

This reverts commit 6c1036e2705d93e1cb71476ac78499ae27f0d326.
6c1036e2 — Adnan Maolood 4 years ago
auth: Use canonical user IDs

When adding users to the database, use the canonical user ID from
meta.sr.ht.
b2c8e81e — Conrad Hoffmann 4 years ago
Fix (some) user PGP key lookups from meta.sr.ht

The authForUsername() function uses a closure that is almost identical
to the LookupUser() function, but is missing the handling for the PGP
key if called from meta.sr.ht. This causes at least the email
notifications for new OAuth2 tokens to be sent unencrypted. This commit
fixes that (and reduces code duplication) by calling LookupUser()
instead.

This requires the context for the tests to have a value for the calling
service, so add that to the mock.
e28d47cf — Adnan Maolood 4 years ago
go fmt
f9c34fc3 — Josh Junon 4 years ago
auth: fix nil reference in auth method check
378fedbc — Drew DeVault 4 years ago
Add @anoninternal support code

This is a slightly better approach to the previous commit.
fbc8f491 — Drew DeVault 4 years ago
auth: implement internal anonymous authentication

This is used for meta.sr.ht's GraphQL user registration resolver, which
needs to run prior to the user's information being added to the database.
f44afb10 — Simon Ser 4 years ago
go fmt
76279c9b — Simon Ser 4 years ago
Fix json struct tag

Found via `go vet`:

    auth/middleware.go:259:2: struct field tag `json:"oauth_client_id",omit-empty` not compatible with reflect.StructTag.Get: key:"value" pairs not separated by spaces
48250772 — Simon Ser 4 years ago
Remove %e formatting verbs

%e is not valid for formatting error values:

> %e	scientific notation, e.g. -1.234456e+78

Instead, use %w when using fmt.Errorf (for error wrapping) and
%v when using log.Printf (%w is not valid in that context).
3c6ab9bd — Drew DeVault 4 years ago
auth: improve error response format

This maps more closely onto what normal GQL errors look like.
ae61e243 — Drew DeVault 4 years ago
auth: force webhooks to read-only
2d9a547c — Drew DeVault 4 years ago
auth: harden grants structure

This replaces the Access map with a data type whose default value does
not grant any permissions, so that it's more difficult to create an
insecure auth context by mistake.
07f694d2 — Drew DeVault 4 years ago
webhooks: expand auth configuration

The purpose of this change is to enable internal webhooks to be
configured in GQL webhook tables. A webhook subscription now includes
the auth method field which is appropriate, which is limited to either
OAUTH2 or INTERNAL. In the former case, the previous set of fields will
be valid, and in the latter case, the NodeID field will be valid. This
will allow us to register webhook subscriptions for internal use.
4f926ddc — Drew DeVault 4 years ago
auth: fix /query/api-meta.json route

This route does not need authentication.
8bd6005b — Drew DeVault 5 years ago
webhooks: initial prototype for GQL-native webhooks
1d24fef3 — Drew DeVault 5 years ago
auth: s/OAuth2Token/BearerToken/g

This also makes some tweaks to the organization of the crypto module to
make it easier for us to add more keys in the future, which will be
necessary for the internal token redesign.
39cd24bd — Drew DeVault 5 years ago
auth: allow /query/metrics w/o authentication
b5e0030f — Drew DeVault 5 years ago
auth: fix user type on database insert
Next