Add port back for management client
[ZITADOPER-1]
This commit is contained in:
@@ -55,9 +55,6 @@ func GetIssuer(zitadel *zitadelv1alpha1.ZitadelCluster) string {
|
||||
if zitadel.Spec.ExternalSecure {
|
||||
scheme = "https"
|
||||
}
|
||||
if zitadel.Spec.ExternalPort == 443 {
|
||||
return fmt.Sprintf("%s://%s", scheme, zitadel.Spec.Host)
|
||||
}
|
||||
return fmt.Sprintf("%s://%s:%d", scheme, zitadel.Spec.Host, zitadel.Spec.ExternalPort)
|
||||
}
|
||||
|
||||
@@ -118,13 +115,23 @@ func GetDiscoveryConfig(issuer string, httpClient *http.Client, host string, api
|
||||
req.Host = host
|
||||
discoveryConfig := new(oidc.DiscoveryConfiguration)
|
||||
err = httphelper.HttpRequest(httpClient, req, &discoveryConfig)
|
||||
discoveryConfig.TokenEndpoint = strings.ReplaceAll(discoveryConfig.TokenEndpoint, host, api)
|
||||
discoveryConfig.TokenEndpoint = replaceEndpoint(discoveryConfig.TokenEndpoint, host, api)
|
||||
discoveryConfig.AuthorizationEndpoint = replaceEndpoint(discoveryConfig.AuthorizationEndpoint, host, api)
|
||||
discoveryConfig.IntrospectionEndpoint = replaceEndpoint(discoveryConfig.IntrospectionEndpoint, host, api)
|
||||
discoveryConfig.EndSessionEndpoint = replaceEndpoint(discoveryConfig.EndSessionEndpoint, host, api)
|
||||
discoveryConfig.RevocationEndpoint = replaceEndpoint(discoveryConfig.RevocationEndpoint, host, api)
|
||||
discoveryConfig.UserinfoEndpoint = replaceEndpoint(discoveryConfig.UserinfoEndpoint, host, api)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return discoveryConfig, nil
|
||||
}
|
||||
|
||||
func replaceEndpoint(endpoint string, host string, api string) string {
|
||||
return strings.ReplaceAll(strings.ReplaceAll(endpoint, host, api), "https", "http")
|
||||
}
|
||||
|
||||
func (j *jwtProfileTokenSource) TokenEndpoint() string {
|
||||
return j.tokenEndpoint
|
||||
}
|
||||
@@ -159,10 +166,9 @@ func callTokenEndpoint(request interface{}, authFn interface{}, caller client.To
|
||||
return nil, err
|
||||
}
|
||||
tokenRes := new(oidc.AccessTokenResponse)
|
||||
|
||||
req.Host = host
|
||||
if err := httphelper.HttpRequest(caller.HttpClient(), req, &tokenRes); err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("Error calling token endpoint: %v", err)
|
||||
}
|
||||
return &oauth2.Token{
|
||||
AccessToken: tokenRes.AccessToken,
|
||||
|
||||
Reference in New Issue
Block a user