Skip to content

Commit

Permalink
Self-review
Browse files Browse the repository at this point in the history
Signed-off-by: abarreiro <abarreiro@vmware.com>
  • Loading branch information
adambarreiro committed May 7, 2024
1 parent 4128460 commit 8eb11d1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion .changes/v2.25.0/0-features.md

This file was deleted.

2 changes: 2 additions & 0 deletions .changes/v2.25.0/671-features.md
@@ -0,0 +1,2 @@
* Added methods to manage OpenID Connect settings for a given `AdminOrg`: `GetOpenIdConnectSettings`,
`SetOpenIdConnectSettings` and `DeleteOpenIdConnectSettings` [GH-671]
4 changes: 2 additions & 2 deletions govcd/org_oidc.go
Expand Up @@ -28,7 +28,7 @@ func (adminOrg *AdminOrg) GetOpenIdConnectSettings() (*types.OrgOAuthSettings, e

// SetOpenIdConnectSettings sets the OpenID Connect configuration for a given Organization. If the well-known configuration
// endpoint is provided, the configuration is automatically retrieved from that URL.
// If other fields have been set in the input structure, the well-known configuration is overridden with these.
// If other fields have been set in the input structure, the corresponding values retrieved from the well-known endpoint are overridden.
// If there are no fields informed, the configuration retrieved from the well-known configuration endpoint is applied as-is.
// ClientId and ClientSecret properties are always mandatory, with and without well-known endpoint.
// This method returns an error if the settings can't be saved in VCD for any reason or if the provided settings are wrong.
Expand Down Expand Up @@ -76,7 +76,7 @@ func (adminOrg *AdminOrg) SetOpenIdConnectSettings(settings types.OrgOAuthSettin
if settings.OIDCAttributeMapping == nil {
// The whole mapping is missing, we take the whole struct from wellknown endpoint
settings.OIDCAttributeMapping = wellKnownSettings.OIDCAttributeMapping
} else if wellKnownSettings.OIDCAttributeMapping != nil {
} else {
// Some mappings are present, others are missing. We take the missing ones from wellknown endpoint
if settings.OIDCAttributeMapping.EmailAttributeName == "" {
settings.OIDCAttributeMapping.EmailAttributeName = wellKnownSettings.OIDCAttributeMapping.EmailAttributeName
Expand Down
1 change: 1 addition & 0 deletions govcd/org_oidc_test.go
Expand Up @@ -285,6 +285,7 @@ func (vcd *TestVCD) Test_OrgOidcSettingsSystemAdminUpdate(check *C) {
check.Assert(updatedSettings.OIDCAttributeMapping.RolesAttributeName, Equals, "roles2")
}

// Test_OrgOidcSettingsWithTenantUser configures OIDC settings with a tenant user instead of System administrator.
func (vcd *TestVCD) Test_OrgOidcSettingsWithTenantUser(check *C) {
if len(vcd.config.Tenants) == 0 {
check.Skip(check.TestName() + " requires at least one tenant in the configuration")
Expand Down

0 comments on commit 8eb11d1

Please sign in to comment.