• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

go-pkgz / auth / 46083647315
89%

Build:
DEFAULT BRANCH: master
Ran 27 Nov 2026 11:40PM UTC
Jobs 1
Files 25
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

27 Nov 2026 11:38PM UTC coverage: 88.452% (+0.1%) from 88.311%
46083647315

push

github

web-flow
Add an avatar saver option for custom providers and Opts.AuthRoutePath (#346)

* Let a custom OAuth2 provider take its own avatar saver

AddCustomProvider gave the provider the service's avatar proxy and took
no other saver. The OAuth2 callback hands the saver the provider's
oauth2 client, which adds the user's access token to every request, and
the proxy fetches the picture URL from the user info with it, whatever
address it names. With a provider whose users can set that URL, the
token went to an address of their choosing and the server fetched
internal addresses. The only way out was to build the handler with
NewCustom and Params of one's own.

CustomHandlerOpt now has an optional AvatarSaver. When set, NewCustom,
and so AddCustomProvider, uses it in place of the saver in Params.
Without it nothing changes.

* Add Opts.AuthRoutePath to answer auth routes only right under the mount

The auth handler takes the action from the last path element and the
provider from the one before it, and ignores everything in front.
/auth/x/y/email/login is the email login and /auth/email/status is
/auth/status, so a middleware in front of the handler that goes by the
path, such as a per-path rate limiter, sees a different path for the
same endpoint and can be bypassed by making one up. The handler cannot
tell where it is mounted from the path, and Request.Pattern is not
reliable for that: a router nested under another leaves the outer
pattern in place.

With the new Opts.AuthRoutePath set to the path the handler is mounted
at, as the handler sees it, the handler answers only list, logout, user
and status, and <provider>/<action> for a registered provider, right
under that path. It reads the route elements from the escaped path and
refuses an element with an escape in it, since provider names and
actions never need one: a router keeps "direct%2Flogin" in one element,
and chi does not match "%64irect" with a "direct" route. The mount path
also refuses other escapes: w... (continued)

56 of 59 new or added lines in 2 files covered. (94.92%)

3669 of 4148 relevant lines covered (88.45%)

18.98 hits per line

Uncovered Changes

Lines Coverage ∆ File
3
98.83
0.15% auth.go
Jobs
ID Job ID Ran Files Coverage
1 46083647315.1 27 Nov 2026 11:40PM UTC 25
88.45
GitHub Action Run
Source Files on build 46083647315
  • Tree
  • List 25
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • baaf7704 on github
  • Prev Build on master (#46081838007)
  • Next Build on master (#46090175676)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc