From f279dc773d5330596fb751895683957462df5ddc Mon Sep 17 00:00:00 2001 From: Melvin Hillsman Date: Tue, 6 Feb 2024 15:03:31 -0600 Subject: [PATCH] Use Hostname() to set --hosted-domain Updated the usage string in cmd.go as well Resolves #595 Signed-off-by: Melvin Hillsman --- cmd/ocm/create/idp/cmd.go | 2 +- cmd/ocm/create/idp/google.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/ocm/create/idp/cmd.go b/cmd/ocm/create/idp/cmd.go index 54e7df26..62dc1e69 100644 --- a/cmd/ocm/create/idp/cmd.go +++ b/cmd/ocm/create/idp/cmd.go @@ -154,7 +154,7 @@ func init() { &args.googleHostedDomain, "hosted-domain", "", - "Google: Restrict users to a Google Apps domain.\n", + "Google: Restrict users to a Google Apps domain. Example: http://redhat.com (scheme required)\n", ) // LDAP diff --git a/cmd/ocm/create/idp/google.go b/cmd/ocm/create/idp/google.go index e5ee76f7..23e3ce93 100644 --- a/cmd/ocm/create/idp/google.go +++ b/cmd/ocm/create/idp/google.go @@ -81,12 +81,12 @@ func buildGoogleIdp(cluster *cmv1.Cluster, idpName string) (idpBuilder cmv1.Iden ClientSecret(clientSecret) if hostedDomain != "" { - _, err = url.ParseRequestURI(hostedDomain) + hostedDomainParsed, err := url.ParseRequestURI(hostedDomain) if err != nil { return idpBuilder, fmt.Errorf("Expected a valid Hosted Domain: %v", err) } // Set the hosted domain, if any - googleIDP = googleIDP.HostedDomain(hostedDomain) + googleIDP = googleIDP.HostedDomain(hostedDomainParsed.Hostname()) } // Create new IDP with Google provider