|
|
auth: Refactor how authentication methods are passed to server/auth library.
This CL removes a bunch of highly confusing public functions and makes
server/auth library more difficult to misuse.
The changes:
* Use auth.Authenticator{...} struct to represent an object that makes
authentication, instead of aliasing []Method for this. Even though it makes
instantiation more verbose, it is cleaner conceptually and has a room for
extensions (like custom HTTP 401 handlers, etc).
* Get rid of two separate auth.Use(...) and auth.Authenticate(...) funcs that
almost always cargo-culted into very specific usage pattern. Now there's only
one auth.Authenticate(Method) function that returns authenticating
middleware.
* Store *Authenticator in the context with the rest of authentication state.
* Get rid of auth.Autologin. It was used in single place only, move it there.
Update Milo to use fakeauth package for mocking auth state. Unfortunately, it
caused non-essential expectation change that made this CL even scarier.
R=iannucci@chromium.org
BUG= 712506
Review-Url: https://codereview.chromium.org/2830443003
Committed: https://github.com/luci/luci-go/commit/a539fb93ab9faa249f025c4fbbe75733ddbab6d1
Total comments: 3
Total comments: 2
Total comments: 12
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+345 lines, -494 lines) |
Patch |
 |
M |
appengine/gaeauth/server/prpc.go
|
View
|
|
1 chunk |
+4 lines, -2 lines |
0 comments
|
Download
|
 |
M |
examples/appengine/helloworld_flexible/frontend/main.go
|
View
|
1
2
|
1 chunk |
+1 line, -7 lines |
0 comments
|
Download
|
 |
M |
examples/appengine/helloworld_standard/frontend/handler.go
|
View
|
1
2
|
1 chunk |
+1 line, -2 lines |
0 comments
|
Download
|
 |
M |
milo/appengine/common/middleware.go
|
View
|
1
2
|
1 chunk |
+5 lines, -9 lines |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/buildbot.build-Debug_page-_CrWinGoma_30608.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/buildbot.build-Debug_page-_newline_1234.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/buildbot.build-Debug_page-_win_chromium_rel_ng_246309.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/buildbot.builder-Basic_Test_no_builds.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/buildbot.builder-Basic_Test_with_builds.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/frontpage-Basic_frontpage.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-Basic_successful_build.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-canceled.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-exception.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-expired.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-internal.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-link.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-nested.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-patch-failure.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-pending.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-pending-logdog.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-running.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-running-logdog.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-running-logdog-no-annotation-stream.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-timeout.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.build-build-unicode.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/expectations/swarming.log-Basic_log.html
|
View
|
1
2
3
4
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
milo/appengine/frontend/main_test.go
|
View
|
|
3 chunks |
+2 lines, -23 lines |
0 comments
|
Download
|
 |
M |
scheduler/appengine/frontend/handler.go
|
View
|
|
2 chunks |
+2 lines, -6 lines |
0 comments
|
Download
|
 |
M |
scheduler/appengine/ui/common.go
|
View
|
1
2
|
2 chunks |
+6 lines, -1 line |
0 comments
|
Download
|
 |
M |
server/auth/auth.go
|
View
|
1
2
3
4
|
6 chunks |
+73 lines, -29 lines |
0 comments
|
Download
|
 |
M |
server/auth/auth_test.go
|
View
|
1
2
3
4
5
|
9 chunks |
+112 lines, -16 lines |
0 comments
|
Download
|
 |
M |
server/auth/authtest/method.go
|
View
|
1
2
3
4
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
server/auth/authtest/state.go
|
View
|
|
2 chunks |
+10 lines, -3 lines |
0 comments
|
Download
|
 |
D |
server/auth/context.go
|
View
|
|
1 chunk |
+0 lines, -128 lines |
0 comments
|
Download
|
 |
D |
server/auth/context_test.go
|
View
|
|
1 chunk |
+0 lines, -226 lines |
0 comments
|
Download
|
 |
A |
server/auth/middleware.go
|
View
|
1
2
|
1 chunk |
+26 lines, -0 lines |
0 comments
|
Download
|
 |
M |
server/auth/state.go
|
View
|
1
2
3
|
5 chunks |
+41 lines, -10 lines |
0 comments
|
Download
|
 |
M |
server/settings/admin/handlers.go
|
View
|
1
2
3
4
|
3 chunks |
+38 lines, -8 lines |
0 comments
|
Download
|
Total messages: 20 (10 generated)
|