Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb36783

Browse files
authored
feat: convert to oidc out of experimental (#8742)
1 parent ed82b86 commit cb36783

File tree

13 files changed

+15
-65
lines changed

13 files changed

+15
-65
lines changed

coderd/apidoc/docs.go

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

coderd/apidoc/swagger.json

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

coderd/userauth.go

-13
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ type OAuthConvertStateClaims struct {
6464
// @Success 201 {object} codersdk.OAuthConversionResponse
6565
// @Router /users/{user}/convert-login [post]
6666
func (api *API) postConvertLoginType(rw http.ResponseWriter, r *http.Request) {
67-
if !api.Experiments.Enabled(codersdk.ExperimentConvertToOIDC) {
68-
httpapi.Write(r.Context(), rw, http.StatusForbidden, codersdk.Response{
69-
Message: "Oauth conversion is not allowed, contact an administrator to turn on this feature.",
70-
})
71-
return
72-
}
73-
7467
var (
7568
user = httpmw.UserParam(r)
7669
ctx = r.Context()
@@ -455,7 +448,6 @@ func (api *API) userAuthMethods(rw http.ResponseWriter, r *http.Request) {
455448
}
456449

457450
httpapi.Write(r.Context(), rw, http.StatusOK, codersdk.AuthMethods{
458-
ConvertToOIDCEnabled: api.Experiments.Enabled(codersdk.ExperimentConvertToOIDC),
459451
Password: codersdk.AuthMethod{
460452
Enabled: !api.DeploymentValues.DisablePasswordAuth.Value(),
461453
},
@@ -1499,11 +1491,6 @@ func (api *API) convertUserToOauth(ctx context.Context, r *http.Request, db data
14991491
oauthConvertAudit.UserID = claims.UserID
15001492
oauthConvertAudit.Old = user
15011493

1502-
// If we do not allow converting to oauth, return an error.
1503-
if !api.Experiments.Enabled(codersdk.ExperimentConvertToOIDC) {
1504-
return database.User{}, wrongLoginTypeHTTPError(user.LoginType, params.LoginType)
1505-
}
1506-
15071494
if claims.RegisteredClaims.Issuer != api.DeploymentID {
15081495
return database.User{}, httpError{
15091496
code: http.StatusForbidden,

coderd/userauth_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"golang.org/x/xerrors"
2121

2222
"cdr.dev/slog/sloggers/slogtest"
23-
"github.com/coder/coder/cli/clibase"
2423
"github.com/coder/coder/coderd"
2524
"github.com/coder/coder/coderd/audit"
2625
"github.com/coder/coder/coderd/coderdtest"
@@ -796,7 +795,6 @@ func TestUserOIDC(t *testing.T) {
796795
config.AllowSignups = true
797796

798797
cfg := coderdtest.DeploymentValues(t)
799-
cfg.Experiments = clibase.StringArray{string(codersdk.ExperimentConvertToOIDC)}
800798
client := coderdtest.New(t, &coderdtest.Options{
801799
Auditor: auditor,
802800
OIDCConfig: config,

codersdk/deployment.go

-4
Original file line numberDiff line numberDiff line change
@@ -1850,10 +1850,6 @@ const (
18501850
// only Coordinator
18511851
ExperimentTailnetPGCoordinator Experiment = "tailnet_pg_coordinator"
18521852

1853-
// ExperimentConvertToOIDC enables users to convert from password to
1854-
// oidc.
1855-
ExperimentConvertToOIDC Experiment = "convert-to-oidc"
1856-
18571853
// ExperimentSingleTailnet replaces workspace connections inside coderd to
18581854
// all use a single tailnet, instead of the previous behavior of creating a
18591855
// single tailnet for each agent.

codersdk/users.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,9 @@ type CreateOrganizationRequest struct {
160160

161161
// AuthMethods contains authentication method information like whether they are enabled or not or custom text, etc.
162162
type AuthMethods struct {
163-
ConvertToOIDCEnabled bool `json:"convert_to_oidc_enabled"`
164-
Password AuthMethod `json:"password"`
165-
Github AuthMethod `json:"github"`
166-
OIDC OIDCAuthMethod `json:"oidc"`
163+
Password AuthMethod `json:"password"`
164+
Github AuthMethod `json:"github"`
165+
OIDC OIDCAuthMethod `json:"oidc"`
167166
}
168167

169168
type AuthMethod struct {

docs/api/schemas.md

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

docs/api/users.md

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

site/src/api/typesGenerated.ts

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

site/src/components/SignInForm/SignInForm.stories.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ SigningIn.args = {
2828
...SignedOut.args,
2929
isSigningIn: true,
3030
authMethods: {
31-
convert_to_oidc_enabled: false,
3231
password: { enabled: true },
3332
github: { enabled: true },
3433
oidc: { enabled: false, signInText: "", iconUrl: "" },
@@ -56,7 +55,6 @@ export const WithGithub = Template.bind({})
5655
WithGithub.args = {
5756
...SignedOut.args,
5857
authMethods: {
59-
convert_to_oidc_enabled: false,
6058
password: { enabled: true },
6159
github: { enabled: true },
6260
oidc: { enabled: false, signInText: "", iconUrl: "" },
@@ -67,7 +65,6 @@ export const WithOIDC = Template.bind({})
6765
WithOIDC.args = {
6866
...SignedOut.args,
6967
authMethods: {
70-
convert_to_oidc_enabled: false,
7168
password: { enabled: true },
7269
github: { enabled: false },
7370
oidc: { enabled: true, signInText: "", iconUrl: "" },
@@ -78,7 +75,6 @@ export const WithOIDCWithoutPassword = Template.bind({})
7875
WithOIDCWithoutPassword.args = {
7976
...SignedOut.args,
8077
authMethods: {
81-
convert_to_oidc_enabled: false,
8278
password: { enabled: false },
8379
github: { enabled: false },
8480
oidc: { enabled: true, signInText: "", iconUrl: "" },
@@ -89,7 +85,6 @@ export const WithoutAny = Template.bind({})
8985
WithoutAny.args = {
9086
...SignedOut.args,
9187
authMethods: {
92-
convert_to_oidc_enabled: false,
9388
password: { enabled: false },
9489
github: { enabled: false },
9590
oidc: { enabled: false, signInText: "", iconUrl: "" },
@@ -100,7 +95,6 @@ export const WithGithubAndOIDC = Template.bind({})
10095
WithGithubAndOIDC.args = {
10196
...SignedOut.args,
10297
authMethods: {
103-
convert_to_oidc_enabled: false,
10498
password: { enabled: true },
10599
github: { enabled: true },
106100
oidc: { enabled: true, signInText: "", iconUrl: "" },

site/src/pages/LoginPage/LoginPage.test.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ describe("LoginPage", () => {
6161

6262
it("shows github authentication when enabled", async () => {
6363
const authMethods: TypesGen.AuthMethods = {
64-
convert_to_oidc_enabled: false,
6564
password: { enabled: true },
6665
github: { enabled: true },
6766
oidc: { enabled: true, signInText: "", iconUrl: "" },
@@ -113,7 +112,6 @@ describe("LoginPage", () => {
113112

114113
it("hides password authentication if OIDC/GitHub is enabled and displays on click", async () => {
115114
const authMethods: TypesGen.AuthMethods = {
116-
convert_to_oidc_enabled: false,
117115
password: { enabled: true },
118116
github: { enabled: true },
119117
oidc: { enabled: true, signInText: "", iconUrl: "" },

site/src/pages/UserSettingsPage/SecurityPage/SecurityPage.tsx

+7-11
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,13 @@ export const SecurityPage: FC = () => {
5353
},
5454
},
5555
}}
56-
oidc={
57-
authMethods.convert_to_oidc_enabled
58-
? {
59-
section: {
60-
authMethods,
61-
userLoginType,
62-
...singleSignOnSection,
63-
},
64-
}
65-
: undefined
66-
}
56+
oidc={{
57+
section: {
58+
authMethods,
59+
userLoginType,
60+
...singleSignOnSection,
61+
},
62+
}}
6763
/>
6864
)
6965
}

site/src/testHelpers/entities.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,6 @@ export const MockAuthMethods: TypesGen.AuthMethods = {
11131113
password: { enabled: true },
11141114
github: { enabled: false },
11151115
oidc: { enabled: false, signInText: "", iconUrl: "" },
1116-
convert_to_oidc_enabled: true,
11171116
}
11181117

11191118
export const MockAuthMethodsWithPasswordType: TypesGen.AuthMethods = {

0 commit comments

Comments
 (0)