Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit97fd2a9

Browse files
committed
some cleanup
1 parent66d5c0c commit97fd2a9

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

‎cli/server.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ import (
108108
"github.com/coder/coder/v2/tailnet"
109109
)
110110

111-
funccreateOIDCConfig(ctx context.Context,logger slog.Logger,set*entitlements.Set,vals*codersdk.DeploymentValues) (*coderd.OIDCConfig,error) {
111+
funccreateOIDCConfig(ctx context.Context,logger slog.Logger,vals*codersdk.DeploymentValues) (*coderd.OIDCConfig,error) {
112112
ifvals.OIDC.ClientID=="" {
113113
returnnil,xerrors.Errorf("OIDC client ID must be set!")
114114
}
@@ -669,7 +669,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
669669
// Missing:
670670
//- Userinfo
671671
//- Verify
672-
oc,err:=createOIDCConfig(ctx,options.Logger,options.Entitlements,vals)
672+
oc,err:=createOIDCConfig(ctx,options.Logger,vals)
673673
iferr!=nil {
674674
returnxerrors.Errorf("create oidc config: %w",err)
675675
}

‎coderd/coderd.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ func New(options *Options) *API {
275275
options.Entitlements=entitlements.New()
276276
}
277277
ifoptions.IDPSync==nil {
278+
// If this is set in the options, it is probably the enterprise
279+
// version of the code.
278280
options.IDPSync=idpsync.NewAGPLSync(options.Logger, idpsync.SyncSettings{
279281
OrganizationField:options.DeploymentValues.OIDC.OrganizationField.Value(),
280282
OrganizationMapping:options.DeploymentValues.OIDC.OrganizationMapping.Value,

‎coderd/idpsync/idpsync.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ import (
1616
"github.com/coder/coder/v2/site"
1717
)
1818

19+
// IDPSync is an interface, so we can implement this as AGPL and as enterprise,
20+
// and just swap the underlying implementation.
21+
// IDPSync exists to contain all the logic for mapping a user's external IDP
22+
// claims to the internal representation of a user in Coder.
23+
// TODO: Move group + role sync into this interface.
1924
typeIDPSyncinterface {
2025
// ParseOrganizationClaims takes claims from an OIDC provider, and returns the
2126
// organization sync params for assigning users into organizations.

‎coderd/idpsync/organizations_test.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"github.com/stretchr/testify/require"
99

1010
"cdr.dev/slog/sloggers/slogtest"
11-
"github.com/coder/coder/v2/coderd/entitlements"
1211
"github.com/coder/coder/v2/coderd/idpsync"
1312
"github.com/coder/coder/v2/testutil"
1413
)
@@ -19,7 +18,7 @@ func TestParseOrganizationClaims(t *testing.T) {
1918
t.Run("SingleOrgDeployment",func(t*testing.T) {
2019
t.Parallel()
2120

22-
s:=idpsync.NewAGPLSync(slogtest.Make(t,&slogtest.Options{}),entitlements.New(),idpsync.SyncSettings{
21+
s:=idpsync.NewAGPLSync(slogtest.Make(t,&slogtest.Options{}), idpsync.SyncSettings{
2322
OrganizationField:"",
2423
OrganizationMapping:nil,
2524
OrganizationAssignDefault:true,
@@ -39,7 +38,7 @@ func TestParseOrganizationClaims(t *testing.T) {
3938
t.Parallel()
4039

4140
// AGPL has limited behavior
42-
s:=idpsync.NewAGPLSync(slogtest.Make(t,&slogtest.Options{}),entitlements.New(),idpsync.SyncSettings{
41+
s:=idpsync.NewAGPLSync(slogtest.Make(t,&slogtest.Options{}), idpsync.SyncSettings{
4342
OrganizationField:"orgs",
4443
OrganizationMapping:map[string][]uuid.UUID{
4544
"random": {uuid.New()},

‎codersdk/deployment.go‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,17 @@ when required by your organization's security policy.`,
15701570
Group:&deploymentGroupOIDC,
15711571
YAML:"organizationAssignDefault",
15721572
},
1573+
{
1574+
Name:"OIDC Organization Sync Mapping",
1575+
Description:"A map of OIDC claims and the organizations in Coder it should map to. "+
1576+
"This is required because organization IDs must be used within Coder.",
1577+
Flag:"oidc-organization-mapping",
1578+
Env:"CODER_OIDC_ORGANIZATION_MAPPING",
1579+
Default:"{}",
1580+
Value:&c.OIDC.OrganizationMapping,
1581+
Group:&deploymentGroupOIDC,
1582+
YAML:"organizationMapping",
1583+
},
15731584
{
15741585
Name:"OIDC Group Field",
15751586
Description:"This field must be set if using the group sync feature and the scope name is not 'groups'. Set to the claim to be used for groups.",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp