Skip to content

Commit

Permalink
chore(internal): skip sso refresh (#1629)
Browse files Browse the repository at this point in the history
  • Loading branch information
wtrocki authored Jul 7, 2022
1 parent 2ef4454 commit f718979
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
4 changes: 0 additions & 4 deletions pkg/shared/connection/kcconnection/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ func (b *ConnectionBuilder) BuildContext(ctx context.Context) (connection *Conne
return nil, &AuthError{notLoggedInError()}
}

if b.connectionConfig.RequireMASAuth && b.masAccessToken == "" && b.masRefreshToken == "" {
return nil, &MasAuthError{notLoggedInMASError()}
}

if b.clientID == "" {
return nil, AuthErrorf("missing client ID")
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/shared/connection/kcconnection/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ func notLoggedInError() error {
return errors.New(`not logged in. Run "rhoas login" to authenticate`)
}

func notLoggedInMASError() error {
return errors.New(`not logged in to identity.api.openshift.com. Run "rhoas login" to authenticate. Note: token-based login is not supported by the Kafka "topic" and "consumer-group" subcommands`)
}

func sessionExpiredError() error {
return errors.New(`session expired. Run "rhoas login" to authenticate`)
}
2 changes: 1 addition & 1 deletion pkg/shared/connection/kcconnection/keycloak_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (c *Connection) RefreshTokens(ctx context.Context) (err error) {
}
}

if c.connectionConfig.RequireMASAuth {
if c.connectionConfig.RequireMASAuth && c.MASToken.RefreshToken != "" {
c.logger.Debug("Refreshing MAS SSO tokens")
// nolint:govet
refreshedMasTk, err := c.masKeycloakClient.RefreshToken(ctx, c.MASToken.RefreshToken, c.clientID, "", c.masRealm)
Expand Down

0 comments on commit f718979

Please sign in to comment.