Skip to content

Commit 02ff066

Browse files
committed
Rename basic authentication to password
1 parent 2595156 commit 02ff066

18 files changed

+42
-31
lines changed

coderd/database/dump.sql

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/migrations/000001_base.up.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
-- https://github.com/coder/m/blob/47b6fc383347b9f9fab424d829c482defd3e1fe2/product/coder/pkg/database/dump.sql
66

77
CREATE TYPE login_type AS ENUM (
8-
'basic',
8+
'password',
99
'github'
1010
);
1111

coderd/database/models.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/httpmw/apikey.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func ExtractAPIKey(db database.Store, oauth *OAuth2Configs) func(http.Handler) h
9999
// Tracks if the API key has properties updated!
100100
changed := false
101101

102-
if key.LoginType != database.LoginTypeBasic {
102+
if key.LoginType != database.LoginTypePassword {
103103
// Check if the OAuth token is expired!
104104
if key.OAuthExpiry.Before(now) && !key.OAuthExpiry.IsZero() {
105105
var oauthConfig OAuth2Config

coderd/httpmw/oauth2.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ func OAuth2(r *http.Request) OAuth2State {
4040
return oauth
4141
}
4242

43-
// ExtractOAuth2 adds a middleware for handling OAuth2 callbacks.
44-
// Any route that does not have a "code" URL parameter will be redirected
45-
// to the handler configuration provided.
43+
// ExtractOAuth2 is a middleware for automatically redirecting to OAuth
44+
// URLs, and handling the exchange inbound. Any route that does not have
45+
// a "code" URL parameter will be redirected.
4646
func ExtractOAuth2(config OAuth2Config) func(http.Handler) http.Handler {
4747
return func(next http.Handler) http.Handler {
4848
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {

coderd/httpmw/organizationparam_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func TestOrganizationParam(t *testing.T) {
4141
ID: userID,
4242
Email: "testaccount@coder.com",
4343
Name: "example",
44-
LoginType: database.LoginTypeBasic,
44+
LoginType: database.LoginTypePassword,
4545
HashedPassword: hashed[:],
4646
Username: username,
4747
CreatedAt: database.Now(),

coderd/httpmw/templateparam_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestTemplateParam(t *testing.T) {
4040
ID: userID,
4141
Email: "testaccount@coder.com",
4242
Name: "example",
43-
LoginType: database.LoginTypeBasic,
43+
LoginType: database.LoginTypePassword,
4444
HashedPassword: hashed[:],
4545
Username: username,
4646
CreatedAt: database.Now(),

coderd/httpmw/templateversionparam_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestTemplateVersionParam(t *testing.T) {
4040
ID: userID,
4141
Email: "testaccount@coder.com",
4242
Name: "example",
43-
LoginType: database.LoginTypeBasic,
43+
LoginType: database.LoginTypePassword,
4444
HashedPassword: hashed[:],
4545
Username: username,
4646
CreatedAt: database.Now(),

coderd/httpmw/workspaceagentparam_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestWorkspaceAgentParam(t *testing.T) {
4040
ID: userID,
4141
Email: "testaccount@coder.com",
4242
Name: "example",
43-
LoginType: database.LoginTypeBasic,
43+
LoginType: database.LoginTypePassword,
4444
HashedPassword: hashed[:],
4545
Username: username,
4646
CreatedAt: database.Now(),

coderd/httpmw/workspacebuildparam_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestWorkspaceBuildParam(t *testing.T) {
4040
ID: userID,
4141
Email: "testaccount@coder.com",
4242
Name: "example",
43-
LoginType: database.LoginTypeBasic,
43+
LoginType: database.LoginTypePassword,
4444
HashedPassword: hashed[:],
4545
Username: username,
4646
CreatedAt: database.Now(),

coderd/httpmw/workspaceparam_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestWorkspaceParam(t *testing.T) {
4040
ID: userID,
4141
Email: "testaccount@coder.com",
4242
Name: "example",
43-
LoginType: database.LoginTypeBasic,
43+
LoginType: database.LoginTypePassword,
4444
HashedPassword: hashed[:],
4545
Username: username,
4646
CreatedAt: database.Now(),

coderd/userauth_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (*oauth2Config) TokenSource(context.Context, *oauth2.Token) oauth2.TokenSou
3333

3434
func TestUserAuthMethods(t *testing.T) {
3535
t.Parallel()
36-
t.Run("Basic", func(t *testing.T) {
36+
t.Run("Password", func(t *testing.T) {
3737
t.Parallel()
3838
client := coderdtest.New(t, nil)
3939
methods, err := client.AuthMethods(context.Background())

coderd/users.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ func (api *api) postLogin(rw http.ResponseWriter, r *http.Request) {
377377

378378
sessionToken, created := api.createAPIKey(rw, r, database.InsertAPIKeyParams{
379379
UserID: user.ID,
380-
LoginType: database.LoginTypeBasic,
380+
LoginType: database.LoginTypePassword,
381381
})
382382
if !created {
383383
return
@@ -402,7 +402,7 @@ func (api *api) postAPIKey(rw http.ResponseWriter, r *http.Request) {
402402

403403
sessionToken, created := api.createAPIKey(rw, r, database.InsertAPIKeyParams{
404404
UserID: user.ID,
405-
LoginType: database.LoginTypeBasic,
405+
LoginType: database.LoginTypePassword,
406406
})
407407
if !created {
408408
return
@@ -843,7 +843,7 @@ func (api *api) createUser(ctx context.Context, req codersdk.CreateUserRequest)
843843
ID: uuid.New(),
844844
Email: req.Email,
845845
Username: req.Username,
846-
LoginType: database.LoginTypeBasic,
846+
LoginType: database.LoginTypePassword,
847847
CreatedAt: database.Now(),
848848
UpdatedAt: database.Now(),
849849
}

peerbroker/proto/peerbroker.pb.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provisionerd/proto/provisionerd.pb.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provisionersdk/proto/provisioner.pb.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/pages/login.test.tsx

+15-9
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ describe("SignInPage", () => {
1919
// only leave password auth enabled by default
2020
server.use(
2121
rest.get("/api/v2/users/auth", (req, res, ctx) => {
22-
return res(ctx.status(200), ctx.json({
23-
password: true,
24-
github: false,
25-
}))
26-
})
22+
return res(
23+
ctx.status(200),
24+
ctx.json({
25+
password: true,
26+
github: false,
27+
}),
28+
)
29+
}),
2730
)
2831
})
2932

@@ -64,10 +67,13 @@ describe("SignInPage", () => {
6467
// Given
6568
server.use(
6669
rest.get("/api/v2/users/auth", async (req, res, ctx) => {
67-
return res(ctx.status(200), ctx.json({
68-
password: true,
69-
github: true,
70-
}))
70+
return res(
71+
ctx.status(200),
72+
ctx.json({
73+
password: true,
74+
github: true,
75+
}),
76+
)
7177
}),
7278
)
7379

site/src/pages/login.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ export const SignInPage: React.FC = () => {
4747
<div className={styles.root}>
4848
<div className={styles.layout}>
4949
<div className={styles.container}>
50-
<SignInForm authMethods={authState.context.methods} isLoading={isLoading} authErrorMessage={authErrorMessage} onSubmit={onSubmit} />
50+
<SignInForm
51+
authMethods={authState.context.methods}
52+
isLoading={isLoading}
53+
authErrorMessage={authErrorMessage}
54+
onSubmit={onSubmit}
55+
/>
5156
</div>
5257

5358
<Footer />

0 commit comments

Comments
 (0)