Skip to content

Commit

Permalink
openid: Gather the refresh token if found.
Browse files Browse the repository at this point in the history
With this commit, when the openid login page sends the refresh
token in the login redirection url, the code will get it. This is
helpful to support refresh openid user claims routine.
  • Loading branch information
Anis Eleuch committed Nov 25, 2024
1 parent 076b803 commit cf47324
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/auth/idp/oauth2/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,15 @@ func (client *Provider) VerifyIdentity(ctx context.Context, code, state, roleARN
return nil, errors.New("missing access_token")
}
token.AccessToken = accessToken.(string)
refreshToken := oauth2Token.Extra("refresh_token")
if refreshToken != nil {
token.RefreshToken = refreshToken.(string)

Check failure on line 326 in pkg/auth/idp/oauth2/provider.go

View workflow job for this annotation

GitHub Actions / Analysis

token.RefreshToken undefined (type *credentials.WebIdentityToken has no field or method RefreshToken)

Check failure on line 326 in pkg/auth/idp/oauth2/provider.go

View workflow job for this annotation

GitHub Actions / Checking Lint (1.22.x, ubuntu-latest)

token.RefreshToken undefined (type *credentials.WebIdentityToken has no field or method RefreshToken)) (typecheck)

Check failure on line 326 in pkg/auth/idp/oauth2/provider.go

View workflow job for this annotation

GitHub Actions / Checking Lint (1.22.x, ubuntu-latest)

token.RefreshToken undefined (type *credentials.WebIdentityToken has no field or method RefreshToken)) (typecheck)

Check failure on line 326 in pkg/auth/idp/oauth2/provider.go

View workflow job for this annotation

GitHub Actions / Checking Lint (1.22.x, ubuntu-latest)

token.RefreshToken undefined (type *credentials.WebIdentityToken has no field or method RefreshToken) (typecheck)

Check failure on line 326 in pkg/auth/idp/oauth2/provider.go

View workflow job for this annotation

GitHub Actions / Checking Lint (1.22.x, ubuntu-latest)

token.RefreshToken undefined (type *credentials.WebIdentityToken has no field or method RefreshToken)) (typecheck)
} else {
// TODO in Nov 2026 : add an error when the refresh token is not found.
// This is not done yet because users may not have access_offline scope
// and this may break their deployments
}

}
return token, nil
}
Expand Down

0 comments on commit cf47324

Please sign in to comment.