userDebugOIDC returns the OIDC debug context for the user. Not going to expose this via swagger as the return payload is not guaranteed to be consistent between releases. @Summary Debug OIDC context for a user @ID debug-oidc-context-for-a-user @Security CoderSessionToken @Tags Agents @Success 200 "
(rw http.ResponseWriter, r *http.Request)
| 45 | // @Router /api/v2/debug/{user}/debug-link [get] |
| 46 | // @x-apidocgen {"skip": true} |
| 47 | func (api *API) userDebugOIDC(rw http.ResponseWriter, r *http.Request) { |
| 48 | var ( |
| 49 | ctx = r.Context() |
| 50 | user = httpmw.UserParam(r) |
| 51 | ) |
| 52 | |
| 53 | if user.LoginType != database.LoginTypeOIDC { |
| 54 | httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{ |
| 55 | Message: "User is not an OIDC user.", |
| 56 | }) |
| 57 | return |
| 58 | } |
| 59 | |
| 60 | link, err := api.Database.GetUserLinkByUserIDLoginType(ctx, database.GetUserLinkByUserIDLoginTypeParams{ |
| 61 | UserID: user.ID, |
| 62 | LoginType: database.LoginTypeOIDC, |
| 63 | }) |
| 64 | if err != nil { |
| 65 | httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{ |
| 66 | Message: "Failed to get user links.", |
| 67 | Detail: err.Error(), |
| 68 | }) |
| 69 | return |
| 70 | } |
| 71 | |
| 72 | httpapi.Write(ctx, rw, http.StatusOK, link.Claims) |
| 73 | } |
| 74 | |
| 75 | // Returns the merged OIDC claims for the authenticated user. |
| 76 | // |
nothing calls this directly
no test coverage detected