token refresh saves tokens under the context name instead of the user name
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 88/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- go
- Área
- authentication, cli
Línea de trabajo
Empieza en pkg/connectors/microcks_client.go, en refreshAuthToken, e inspecciona cómo configCtx resuelve el usuario referenciado. Revisa la prueba de refresh de #487 y añade cobertura para el caso en que el nombre del contexto difiera de contexts[].user. Se considera terminado cuando los tokens renovados actualizan el usuario referenciado con nombre de servidor sin crear una entrada huérfana.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
Title: bug: token refresh saves tokens under the context name instead of the user name
Describe the bug
For contexts created with microcks login <server> --name <ctx>, the automatic token refresh saves the new tokens under the context name, but users entries are keyed by the server URL. So it appends a new entry instead of updating the one the context points to.
login keys the user by server URL:
// cmd/login.go
localConfig.UpsertUser(config.User{Name: server, ...})
localConfig.UpsertContext(config.ContextRef{Name: ctxName, Server: server, User: server})
refreshAuthToken writes it back with ctxName:
// pkg/connectors/microcks_client.go:364
localCfg.UpsertUser(config.User{Name: ctxName, AuthToken: authToken, RefreshToken: refreshToken})
Same context-name vs user-name mix up that was fixed in #427 for deleteContext.
How to Reproduce?
microcks login http://localhost:8080 --name dev-context- Let the access token expire (or set
auth-tokento an expired JWT) - Run any authenticated command
cat ~/.config/microcks/config
contexts:
- name: dev-context
user: http://localhost:8080 # still points here
users:
- name: http://localhost:8080
auth-token: <still expired>
refresh-token: OLD-REFRESH-TOKEN
- name: dev-context # new entry, nothing resolves it
auth-token: NEW-ACCESS-TOKEN
refresh-token: NEW-REFRESH-TOKEN
Login without --name is fine, there the context name and user name are both the server URL.
Actual behavior
- The context keeps replaying the same refresh token on every command, so once it hits the Keycloak SSO idle timeout you have to log in again (and it fails right away if one time use refresh tokens are on).
logoutandcontext --deleteonly clean the referenced user, so the orphan entry with the newest tokens stays on disk.
Suggested fix
configCtx is already resolved a few lines above:
localCfg.UpsertUser(config.User{Name: configCtx.User.Name, AuthToken: authToken, RefreshToken: refreshToken})
The refresh test in #487 uses a config where contexts[].user equals the context name, so it passes with this bug. A regression test needs the two to differ.
- Lenguaje dominante
- Go
- Estrellas
- 52
- Forks
- 67
- Merge medio
- 1 d 1 h
- PR fusionados (30 d)
- 13
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microcks/microcks-cli
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
microcks/microcks-cli#535 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
microcks/microcks-cli#534 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microcks/microcks-cli#511 ·
-
component/cli kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
microcks/microcks-cli#503 · 4 comentarios ·
-
stale
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
microcks/microcks-cli#483 · 3 comentarios ·
Todos los issues de microcks/microcks-cli
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
-
enhancement needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
kind/cleanup
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
kubernetes-sigs/kueue#15947 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
sympozium-ai/sympozium#627 ·