Skip to content

Commit

Permalink
feat: support updated RedHat SSO version strings (#903)
Browse files Browse the repository at this point in the history
  • Loading branch information
wombat authored Dec 15, 2023
1 parent 264286d commit abc191a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions keycloak/keycloak_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"net/http/cookiejar"
"net/url"
"os"
"regexp"
"strings"
"time"

Expand Down Expand Up @@ -167,6 +168,19 @@ func (keycloakClient *KeycloakClient) login(ctx context.Context) error {
serverVersion := info.SystemInfo.ServerVersion
if strings.Contains(serverVersion, ".GA") {
serverVersion = strings.ReplaceAll(info.SystemInfo.ServerVersion, ".GA", "")
} else {
regex, err := regexp.Compile(`\.redhat-\w+`)

if err != nil {
fmt.Println("Error compiling regex:", err)
return err
}

// Check if the pattern is found in serverVersion
if regex.MatchString(serverVersion) {
// Replace the matched pattern with an empty string
serverVersion = regex.ReplaceAllString(serverVersion, "")
}
}

v, err := version.NewVersion(serverVersion)
Expand Down

0 comments on commit abc191a

Please sign in to comment.