Skip to content

Commit 4f94342

Browse files
committed
chore: add claims to oauth link in db for debug
1 parent 214123d commit 4f94342

File tree

9 files changed

+136
-43
lines changed

9 files changed

+136
-43
lines changed

coderd/coderd.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,10 @@ func New(options *Options) *API {
958958
r.Get("/tailnet", api.debugTailnet)
959959
r.Get("/health", api.debugDeploymentHealth)
960960
r.Get("/ws", (&healthcheck.WebsocketEchoServer{}).ServeHTTP)
961+
r.Route("/{user}", func(r chi.Router) {
962+
r.Use(httpmw.ExtractUserParam(options.Database))
963+
r.Get("/debug-link", api.userDebugOIDC)
964+
})
961965
})
962966
})
963967

coderd/database/dump.sql

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
BEGIN;
2+
3+
ALTER TABLE user_links DROP COLUMN debug_context jsonb;
4+
5+
COMMIT;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
BEGIN;
2+
3+
ALTER TABLE user_links ADD COLUMN debug_context jsonb DEFAULT '{}' NOT NULL;
4+
COMMENT ON COLUMN user_links.debug_context IS 'Debug information includes information like id_token and userinfo claims.';
5+
6+
COMMIT;

coderd/database/models.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 35 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/user_links.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ INSERT INTO
2727
oauth_access_token_key_id,
2828
oauth_refresh_token,
2929
oauth_refresh_token_key_id,
30-
oauth_expiry
30+
oauth_expiry,
31+
debug_context
3132
)
3233
VALUES
33-
( $1, $2, $3, $4, $5, $6, $7, $8 ) RETURNING *;
34+
( $1, $2, $3, $4, $5, $6, $7, $8, $9 ) RETURNING *;
3435

3536
-- name: UpdateUserLinkedID :one
3637
UPDATE
@@ -48,6 +49,7 @@ SET
4849
oauth_access_token_key_id = $2,
4950
oauth_refresh_token = $3,
5051
oauth_refresh_token_key_id = $4,
51-
oauth_expiry = $5
52+
oauth_expiry = $5,
53+
debug_context = $6
5254
WHERE
53-
user_id = $6 AND login_type = $7 RETURNING *;
55+
user_id = $7 AND login_type = $8 RETURNING *;

0 commit comments

Comments
 (0)