Skip to content

Commit

Permalink
Validate connections
Browse files Browse the repository at this point in the history
Signed-off-by: abarreiro <abarreiro@vmware.com>
  • Loading branch information
adambarreiro committed May 9, 2024
1 parent 2acc530 commit a4a8a34
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions govcd/org_oidc.go
Expand Up @@ -127,6 +127,20 @@ func (adminOrg *AdminOrg) SetOpenIdConnectSettings(settings types.OrgOAuthSettin
return nil, fmt.Errorf("the OIDC Key Configuration is mandatory to configure OpenID Connect")
}

// Perform connectivity validations
err := oidcValidateConnection(adminOrg.client, settings.UserAuthorizationEndpoint)
if err != nil {
return nil, err
}
err = oidcValidateConnection(adminOrg.client, settings.AccessTokenEndpoint)
if err != nil {
return nil, err
}
err = oidcValidateConnection(adminOrg.client, settings.UserInfoEndpoint)
if err != nil {
return nil, err
}

// The namespace must be set for all structures, otherwise the API call fails
settings.Xmlns = types.XMLNamespaceVCloud
settings.OAuthKeyConfigurations.Xmlns = types.XMLNamespaceVCloud
Expand Down

0 comments on commit a4a8a34

Please sign in to comment.