31 Commits

Author SHA1 Message Date
83b22dbb86
feat(auth/embeddedjwt): add embedded-struct JWT/JWS/JWK package
Claims via embedded structs rather than generics:

- Decode(token, &claims) pattern: JSON payload unmarshaled directly into
  the caller's pre-allocated struct, stored in jws.Claims; custom fields
  accessible through the local variable without a type assertion
- StandardClaims.Validate promoted to any embedding struct via value
  receiver; override Validate on the outer struct for custom checks,
  calling ValidateStandardClaims to preserve standard OIDC validation
- Sign(crypto.Signer): algorithm set from key.Public() type switch;
  ES256 (P-256) and RS256 (PKCS#1 v1.5) supported; works with HSM/KMS
- ecdsaDERToRaw: converts ASN.1 DER output of crypto.Signer to raw r||s
- SignES256 uses FillBytes for correct zero-padded r||s (no leading-zero bug)
- UnsafeVerify(Key): dispatches on Header.Alg; ES256 and RS256 supported
- Non-generic PublicJWK with ECDSA()/RSA() typed accessor methods
  (contrast: bestjwt uses generic PublicJWK[K] + TypedKeys[K])
- JWKS fetch/parse: FetchPublicJWKs, ReadPublicJWKs, UnmarshalPublicJWKs
  for RSA and EC (P-256/384/521) keys
- 10 tests covering round trips, promoted/overridden validate, wrong key,
  wrong key type, unknown alg, JWKS accessors, and JWKS JSON parsing
2026-03-12 17:46:04 -06:00
fac58cf1ad
feat(auth/bestjwt): add hybrid JWT/JWS/JWK package
Combines the best ergonomics from genericjwt and embeddedjwt:

- Decode(&claims) pattern (embedded structs, no generics at call sites,
  no type assertion to access custom fields)
- StandardClaims.Validate promoted to any embedding struct via value
  receiver; override Validate on the outer struct for custom checks
- Sign(crypto.Signer): algorithm inferred from key.Public() type switch,
  supports HSM/cloud KMS transparently
- Full ECDSA curve support: ES256 (P-256), ES384 (P-384), ES512 (P-521)
  all inferred automatically from key curve via algForECKey
- Curve/alg consistency check in UnsafeVerify: P-256 key rejected for
  ES384 token and vice versa (prevents cross-algorithm downgrade)
- digestFor: fixed-size stack arrays for SHA-256/384/512 digests
- ecdsaDERToRaw + FillBytes: correct zero-padded r||s conversion from
  ASN.1 DER output of crypto.Signer
- Generic PublicJWK[K Key] + TypedKeys[K]: type-safe JWKS key management,
  filter mixed []PublicJWK[Key] to concrete type without assertions
- JWKS fetch/parse: FetchPublicJWKs, ReadPublicJWKs, UnmarshalPublicJWKs,
  DecodePublicJWKs for RSA and EC (P-256/384/521)
- RS256 (PKCS#1 v1.5 + SHA-256) support via crypto.Signer
- 13 tests covering all algorithms, negative cases, and JWKS integration
2026-03-12 17:40:24 -06:00
55a7b9b2f4
wip:feat(auth/jwt): add jwk fetch and jwt verify 2026-03-12 17:32:38 -06:00
c32acd5a74
ref(auth/csvauth): don't hold mutex longer than necessary 2026-03-03 03:05:05 -07:00
66dde73bd4
chore(auth/csvauth): add .goreleaser.yaml 2026-03-03 02:31:36 -07:00
249385c775
fix(auth/csvauth): load tokens into hashmap so that they can be retrieved by CredentialKeys 2026-03-03 02:26:34 -07:00
d415a8c743
fix(auth/csvauth): turn the old CLI-only warnings and errors into returned errors 2026-03-03 01:21:36 -07:00
8842791e34
fix(auth): update test 2026-03-03 00:01:15 -07:00
92f865912a
fix(auth): add missing arg to NewBasicRequestAuthenticator 2026-03-02 23:18:05 -07:00
846d14baf5
feat(auth): add BasicRequestAuthenticator 2026-03-02 12:32:01 -07:00
8ef2f73cb0
fix(auth/csvauth): oops, should have added as auth.BasicAuthenticator, done 2026-02-26 21:12:29 -07:00
ff8cdec1d7
feat(auth): add BasicVerifier, BasicAuthenticator, and BasicPrinciple for interfaces without implementation dependency 2026-02-26 20:03:43 -07:00
d756f205b0
ref(auth/csvauth): create and adhere to Principle interface for verified credential 2026-02-26 16:44:54 -07:00
737f3b0057
fix(auth/csvauth): make username lookups timing safe 2026-02-26 02:23:31 -07:00
1789c92815
fix(auth/csvauth): don't allow BOTH username and password to be empty 2026-02-26 02:23:31 -07:00
3465e9e232
doc(auth/csvauth): update examples 2026-02-26 02:23:31 -07:00
01a4cdda8a
feat(auth/csvauth): add Authenticate(user, pass string) to get verified Credential 2026-02-26 02:23:31 -07:00
7d35551fa7
ref(auth/csvauth): separate Login, Token, and ServiceAccount files 2026-02-26 02:23:31 -07:00
85c7b78ca6
ref(auth/csvauth): enable token use with Verify(dummy, token) 2026-02-21 15:41:02 -07:00
85d42550bf
feat(auth/csvauth): add token support,make secrets non-printing 2026-02-21 05:49:11 -07:00
dd48b2420b
feat(auth/csvauth): make secrets non-printing 2026-02-21 05:49:11 -07:00
af634f2175
doc+fix(cmd/csvauth): cleanup help, print with bare '--help' 2026-02-21 05:49:11 -07:00
6e0c91feb4
fix(cmd/csvauth): use errors.Is(err, ErrInQuestion) correctly 2026-02-21 05:49:11 -07:00
eee1434ba7
doc(auth/envauth): add Go Reference badge 2025-10-11 19:06:44 -06:00
f269f80771
doc(auth/csvauth): add Go Reference badge 2025-10-11 19:06:21 -06:00
9598545a9f
chore: add appopriate LICENSE files to each module 2025-10-06 00:42:41 -06:00
154da0aa04
chore(csvauth): add LICENSE 2025-10-06 00:42:20 -06:00
612cd2e53c
feat(csvauth): store and verify or retrieve credentials 2025-10-05 20:50:38 -06:00
e8fbe603af
ref!(envauth): change Verify return from bool to error 2025-10-04 21:19:34 -06:00
0893b3cb2d
doc(envauth): show use of salt generator 2025-10-04 02:21:05 -06:00
23ff6225f5
feat(envauth): add verifiers for single-user credentials 2025-10-04 02:17:51 -06:00