Skip to content

Conversation

aldavidson
Copy link
Contributor

An 'under the hood' PR which does two things:

  1. Moves the JWT-generation methods out of the OneTimeTokens controller, and into the OneTimeToken model.

This is tidier, and also enables a one-liner in the console which is useful when developing locally:

> jwt = ReportingAPI::OneTimeToken.find_or_generate_for!(user: User.first, cis2_info: {...}).to_jwt
  1. Adds a JWT_SIGNING_ALGORITHM constant to define the HS512 algorithm in one place, rather than hard-coding it everywhere

…nto the model, and add a constant to define the algorithm used for signing the JWTs in just one place
@aldavidson aldavidson marked this pull request as ready for review September 2, 2025 15:41
@aldavidson aldavidson requested a review from a team as a code owner September 2, 2025 15:41
Copy link

sonarqubecloud bot commented Sep 2, 2025

@thomasleese thomasleese added the refactor Improving maintainability label Sep 2, 2025
@aldavidson aldavidson merged commit f4c6339 into next Sep 2, 2025
13 checks passed
@aldavidson aldavidson deleted the refactor-jwt-methods-onto-model branch September 2, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Improving maintainability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants