Commit Graph

267 Commits

Author SHA1 Message Date
Trong Huu Nguyen
66cf08e602 refactor(openid/logout): simplify logout logic
As we already clear any local sessions before redirecting to the
Identity Provider, and the callback always redirects to a pre-configured URL,
there isn't really any need to maintain and verify state in the logout
callback.

In other words, the logout callback handler is simply a redirect handler.
2022-07-12 15:09:49 +02:00
Trong Huu Nguyen
c321cff4eb test(openid/client): add missing tests 2022-07-12 14:28:17 +02:00
Trong Huu Nguyen
b937c64dd6 refactor(openid/client): ensure callback cookies are not nil 2022-07-11 14:30:04 +02:00
Trong Huu Nguyen
48160e7986 fix(handler/callback): pass correct error to error handler 2022-07-11 13:39:48 +02:00
Trong Huu Nguyen
b770f22174 refactor(handler/logoutcallback): extract to openid client 2022-07-11 13:37:40 +02:00
Trong Huu Nguyen
ad3201fbfb refactor(handler/logout): extract to openid client 2022-07-11 13:09:10 +02:00
Trong Huu Nguyen
451642caf8 refactor(handler/frontchannellogout): extract to openid client 2022-07-11 13:04:00 +02:00
Trong Huu Nguyen
8c28a3b109 refactor(router): group routes and extract middlewares 2022-07-08 16:10:11 +02:00
Trong Huu Nguyen
2f237ec89c refactor(handler/callback): extract openid specific code to client 2022-07-08 15:07:16 +02:00
Trong Huu Nguyen
aed89bfa94 nit(openid/clients): clean up error messages 2022-07-08 13:31:57 +02:00
Trong Huu Nguyen
5bfb80b934 wip: add todos 2022-07-08 13:29:37 +02:00
Trong Huu Nguyen
42938ee8b3 refactor(handler): deduplicate configuration 2022-07-05 14:43:40 +02:00
Trong Huu Nguyen
a4c3e72fc9 fix(router/handler): use long-lived context for refreshing jwks 2022-07-05 13:18:38 +02:00
Trong Huu Nguyen
1f5635239a refactor: split out openid client, config and provider
There's a bunch of changes here, but in essence:

- split out openid configuration
- separate openid configuration between client/rp and provider
- consolidate client and provider related code in separate packages

These changes allow for simplification of the Handler, as well as a
bunch of test/mock code as the configuration is now instantiated
seperately from the client/provider code.
2022-07-05 13:09:00 +02:00
Trong Huu Nguyen
d49db13e5f refactor(openid/clients): consolidate configuration 2022-07-04 15:24:21 +02:00
Trong Huu Nguyen
10dddd00bc refactor(router): begin extraction of openid client 2022-07-04 15:18:42 +02:00
Trong Huu Nguyen
d1559f5479 style(main): rename variable for clarity 2022-07-04 15:18:40 +02:00
Trong Huu Nguyen
a19cbe375c refactor(router/session): extract cookie store 2022-07-04 15:18:40 +02:00
Trong Huu Nguyen
31eb0d5a1e refactor(router/cookies): move related functions to cookies pkg 2022-07-04 15:18:38 +02:00
Trong Huu Nguyen
a752978f8f refactor(session): move data to own file 2022-07-04 15:18:37 +02:00
Trong Huu Nguyen
d73a5f24bb refactor(session): move session id generator to relevant pkg 2022-07-04 15:18:36 +02:00
Trong Huu Nguyen
debf97efda feat(session): store metadata 2022-07-04 15:18:36 +02:00
Trong Huu Nguyen
402d8b940f refactor: use expiry in token response instead of jwt claim 2022-07-04 15:18:35 +02:00
Trong Huu Nguyen
497cf9fba7 feat: store refresh tokens in session 2022-07-04 15:18:34 +02:00
Trong Huu Nguyen
543d7b387c router/request: add some test cases for canonical redirects
(cherry picked from commit 53e4d257c906941a24ceda462f610846a209e50d)
2022-07-04 13:27:06 +02:00
Trong Huu Nguyen
303708ea65 router/request: add some clarifying comments 2022-07-04 13:26:51 +02:00
André Roaldseth
1f830b5dc8 fix(router/request): add query string when redirecting back to referrer (#37)
* Add query string when redirecting back to referrer

Fixes #36

* Manipulate URL object for more consistent stringify

Co-authored-by: thokra-nav <85170275+thokra-nav@users.noreply.github.com>

Co-authored-by: thokra-nav <85170275+thokra-nav@users.noreply.github.com>
2022-07-04 13:25:41 +02:00
Jan-Kåre Solbakken
22a4ca4c1a Merge pull request #38 from nais/dependabot/go_modules/github.com/stretchr/testify-1.7.5
build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.7.5
2022-06-28 08:53:58 +02:00
dependabot[bot]
afd1a29671 build(deps): bump github.com/stretchr/testify from 1.7.2 to 1.7.5
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.2 to 1.7.5.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.2...v1.7.5)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-27 19:25:46 +00:00
Trong Huu Nguyen
414b7a9c68 refactor(handler/default): remove unneeded modifications for reverse proxy requests 2022-06-15 08:37:57 +02:00
Trong Huu Nguyen
184102d365 perf(session/redis): set minIdleConns to alleviate cold start performance 2022-06-14 14:26:42 +02:00
dependabot[bot]
557cca2a08 build(deps): bump github.com/lestrrat-go/jwx/v2 from 2.0.2 to 2.0.3 (#34)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-14 08:27:37 +02:00
Trong Huu Nguyen
9cc9bd72b9 refactor(middleware/logentry): only include relevant cookies 2022-06-13 15:43:02 +02:00
Trong Huu Nguyen
a4c96d3217 deps: bumpity bump 2022-06-09 13:18:52 +02:00
Trong Huu Nguyen
2534c4dcd6 deps: bump prometheus/client_golang to 1.12.2 2022-05-19 08:25:51 +02:00
Trong Huu Nguyen
10f9a48cc1 ci: bump actions/checkout to v3 2022-05-19 08:24:09 +02:00
Trong Huu Nguyen
65ac98f5a8 fix(middleware/logentry): use fallback logger if not set in context 2022-05-10 15:56:41 +02:00
Trong Huu Nguyen
0a73b1cf3b deps: bump jwx to v2.0.1 2022-05-10 09:25:27 +02:00
Trong Huu Nguyen
32dd80b5da feat: add handler for logout callbacks 2022-05-10 08:52:07 +02:00
Trong Huu Nguyen
b3dfa54768 refactor: change default post-logout redirect uri for idporten 2022-05-09 11:49:44 +02:00
Trong Huu Nguyen
441d890fe7 refactor: move random string generator to own pkg 2022-05-09 11:48:44 +02:00
Trong Huu Nguyen
04fab6104a feat(handler/callback): add retries for requests to external services 2022-05-06 12:28:58 +02:00
Trong Huu Nguyen
18fffcc755 deps: migrate from lestrrat-go/jwx to lestrrat-go/jwx/v2 2022-05-05 11:09:03 +02:00
Trong Huu Nguyen
eb2a93dbf0 deps: bump various libs 2022-05-05 11:06:01 +02:00
Trong Huu Nguyen
afeaf6a381 deps: bump to go 1.18 2022-05-05 11:03:25 +02:00
Trong Huu Nguyen
fc695b079b ci: bump setup-go from v2 to v3 2022-05-05 11:03:03 +02:00
Trong Huu Nguyen
f10bb80f9e refactor(handler): use logger with request context 2022-05-05 09:15:59 +02:00
Trong Huu Nguyen
cd57e72d56 refactor(router/request): clean up construction of canonical redirect uris; add missing tests 2022-05-05 08:12:23 +02:00
Trong Huu Nguyen
40a4c8a02c docs: minor cleanups, add overview with diagrams 2022-05-04 15:54:45 +02:00
Trong Huu Nguyen
2252b1dbce refactor(handler/callback): unconditionally clear callback cookies 2022-03-25 11:26:24 +01:00