Skip to content

Stop local user access tokens being removed on app start#73

Merged
gscho merged 2 commits intogemfast:mainfrom
cpcwood:fix-local-user-token-reset
May 14, 2025
Merged

Stop local user access tokens being removed on app start#73
gscho merged 2 commits intogemfast:mainfrom
cpcwood:fix-local-user-token-reset

Conversation

@cpcwood
Copy link
Copy Markdown
Contributor

@cpcwood cpcwood commented May 12, 2025

Context:

  • When the application starts, local users are added to the database through db.CreateLocalUsers.
  • If a user already exists and has an access token, it gets removed.
  • This breaks access token auth when gemfast is run in environments where its container is expected to be ephemeral.

e.g.

Access token added for user and can be seen in DB:

image

Server restarted and access token is removed:

image

Changes:

  • Update CreateLocalUsers method to fetch local users & only update password, role, and type fields, instead of replacing the whole user
  • Add tests to check that the token is available on the user when the CreateLocalUsers method is run twice

@cpcwood cpcwood force-pushed the fix-local-user-token-reset branch from 26d94f1 to f8a95b4 Compare May 12, 2025 14:50
@cpcwood cpcwood force-pushed the fix-local-user-token-reset branch from f8a95b4 to 337dbfd Compare May 12, 2025 14:56
@cpcwood cpcwood marked this pull request as ready for review May 12, 2025 15:12
@gscho gscho self-requested a review May 14, 2025 19:12
Copy link
Copy Markdown
Collaborator

@gscho gscho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing!

@gscho gscho merged commit c447b8a into gemfast:main May 14, 2025
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants