Skip to content

Commit

Permalink
Use Hostname() to set --hosted-domain
Browse files Browse the repository at this point in the history
Updated the usage string in cmd.go as well

Resolves #595

Signed-off-by: Melvin Hillsman <[email protected]>
  • Loading branch information
mrhillsman committed Feb 6, 2024
1 parent fab7ccf commit f279dc7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/ocm/create/idp/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cmd/ocm/create/idp/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f279dc7

Please sign in to comment.