Skip to content

Commit

Permalink
fix: don't list org SSOs in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl committed Nov 22, 2023
1 parent 1a098b7 commit 207bf95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions selfservice/strategy/oidc/strategy_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func (s *Strategy) PopulateSettingsMethod(r *http.Request, id *identity.Identity
sr.UI.GetNodes().Remove("unlink", "link")
sr.UI.SetCSRF(s.d.GenerateCSRFToken(r))
for _, l := range linkable {
// We do not want to offer to link SSO providers in the settings.
if l.Config().OrganizationID != "" {
continue
}
sr.UI.GetNodes().Append(NewLinkNode(l.Config().ID))
}

Expand Down
3 changes: 3 additions & 0 deletions selfservice/strategy/oidc/strategy_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,15 @@ func TestSettingsStrategy(t *testing.T) {
errTS := testhelpers.NewErrorTestServer(t, reg)
publicTS, adminTS := testhelpers.NewKratosServers(t)

orgSSO := newOIDCProvider(t, publicTS, remotePublic, remoteAdmin, "org-sso")
orgSSO.OrganizationID = "org-1"
viperSetProviderConfig(
t,
conf,
newOIDCProvider(t, publicTS, remotePublic, remoteAdmin, "ory"),
newOIDCProvider(t, publicTS, remotePublic, remoteAdmin, "google"),
newOIDCProvider(t, publicTS, remotePublic, remoteAdmin, "github"),
orgSSO,
)
testhelpers.InitKratosServers(t, reg, publicTS, adminTS)
testhelpers.SetDefaultIdentitySchema(conf, "file://./stub/settings.schema.json")
Expand Down

0 comments on commit 207bf95

Please sign in to comment.