Login does the full OIDC flow starting at the "LoginButton". The client argument is just to get the URL of the Coder instance. The client passed in is just to get the url of the Coder instance. The actual client that is used is 100% unauthenticated and fresh.
(t testing.TB, client *codersdk.Client, idTokenClaims jwt.MapClaims, opts ...func(r *http.Request))
| 595 | // The client passed in is just to get the url of the Coder instance. |
| 596 | // The actual client that is used is 100% unauthenticated and fresh. |
| 597 | func (f *FakeIDP) Login(t testing.TB, client *codersdk.Client, idTokenClaims jwt.MapClaims, opts ...func(r *http.Request)) (*codersdk.Client, *http.Response) { |
| 598 | t.Helper() |
| 599 | |
| 600 | client, resp := f.AttemptLogin(t, client, idTokenClaims, opts...) |
| 601 | if resp.StatusCode != http.StatusOK { |
| 602 | data, err := httputil.DumpResponse(resp, true) |
| 603 | if err == nil { |
| 604 | t.Logf("Attempt Login response payload\n%s", string(data)) |
| 605 | } |
| 606 | } |
| 607 | require.Equal(t, http.StatusOK, resp.StatusCode, "client failed to login") |
| 608 | return client, resp |
| 609 | } |
| 610 | |
| 611 | func (f *FakeIDP) AttemptLogin(t testing.TB, client *codersdk.Client, idTokenClaims jwt.MapClaims, opts ...func(r *http.Request)) (*codersdk.Client, *http.Response) { |
| 612 | t.Helper() |