MCPcopy Index your code
hub / github.com/coder/coder / Login

Method Login

coderd/coderdtest/oidctest/idp.go:597–609  ·  view source on GitHub ↗

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))

Source from the content-addressed store, hash-verified

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.
597func (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
611func (f *FakeIDP) AttemptLogin(t testing.TB, client *codersdk.Client, idTokenClaims jwt.MapClaims, opts ...func(r *http.Request)) (*codersdk.Client, *http.Response) {
612 t.Helper()

Callers 10

TestUserOAuth2GithubFunction · 0.95
TestUserOIDCFunction · 0.95
TestOIDCSkipIssuerFunction · 0.95
TestPostUsersFunction · 0.95
TestUserOIDCClaimsFunction · 0.95
TestScimFunction · 0.95
TestUserOIDCFunction · 0.45
TestGroupSyncFunction · 0.45

Calls 5

AttemptLoginMethod · 0.95
HelperMethod · 0.65
DumpResponseMethod · 0.65
LogfMethod · 0.65
EqualMethod · 0.45

Tested by 10

TestUserOAuth2GithubFunction · 0.76
TestUserOIDCFunction · 0.76
TestOIDCSkipIssuerFunction · 0.76
TestPostUsersFunction · 0.76
TestUserOIDCClaimsFunction · 0.76
TestScimFunction · 0.76
TestUserOIDCFunction · 0.36
TestGroupSyncFunction · 0.36