feat: Support multiple JWS signing algorithms (algorithm agility) for issued tokens

Open
#541 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
kotlin

Research direction

Start by reading the listed key and token files: KeyUtils.kt, JwtProvider.kt, TokenVerifiers.kt, SigningKeyPublisher.kt, OIDCDiscoveryResponse.kt, and TokenRouter.kt, then inspect the client model and OAuthClientRepository.kt. Map how keys are generated, published, advertised, selected, and verified before resolving the open configuration and migration questions. Done means RS256 remains supported, configured algorithms and keys are advertised and published, and ID Tokens use each client's selected algorithm.

Written by the indexing model from the issue text.

Description

enhancement priority: low security

Summary

Support multiple JWS signing algorithms (algorithm agility) for issued tokens, so that MineAuth can add stronger or post-quantum algorithms (e.g. ES256, EdDSA, and later ML-DSA) without breaking existing relying parties.

Background

MineAuth currently has a single, hard-coded signing setup:

  • KeyUtils.generateKeyPair() generates one RSA-2048 key pair (KeyPairGenerator.getInstance("RSA"), initialize(2048, ...)).
  • JwtProvider.algorithm is fixed to Algorithm.RSA256 (auth0 java-jwt), and the same algorithm is used for both signing and verifying.
  • SigningKeyPublisher writes exactly one RSA key (with the configured kid) to jwks.json.
  • OIDC Discovery advertises id_token_signing_alg_values_supported = ["RS256"] only.
  • Clients have no id_token_signed_response_alg setting.

RSA is not quantum-resistant, and RSA-2048 provides only ~112-bit classical security. OpenID Connect already provides the mechanisms needed for algorithm agility:

  • Discovery: id_token_signing_alg_values_supported (and the related *_alg_values_supported fields).
  • Client metadata: id_token_signed_response_alg (defaults to RS256 when omitted).
  • JWKS: multiple keys of different types; verifiers select the key by the kid / alg JOSE header.

Note that OpenID Connect Core 1.0 §15.1 requires OPs to support RS256, so new algorithms must be added alongside RS256, not replace it.

Proposal

  1. Multiple signing keys: allow one signing key per algorithm (each with its own kid), generated / loaded by KeyUtils, and publish all public keys in jwks.json.
  2. Discovery: build id_token_signing_alg_values_supported from the configured keys instead of a hard-coded list.
  3. Per-client algorithm: add id_token_signed_response_alg to the client model (default RS256) and pick the signing key when issuing ID Tokens.
  4. Internal tokens: decide whether access / refresh / service tokens keep a single server-wide algorithm or follow the same selection. Verifiers (TokenVerifiers, KindRestrictedVerifier) must accept every configured key, selected by kid.
  5. Post-quantum (follow-up): add ML-DSA (ML-DSA-44/65/87, draft-ietf-cose-dilithium / JOSE) once relying-party support is realistic. auth0 java-jwt does not support ML-DSA, so this likely requires moving signing / verification to Nimbus JOSE (already a dependency) with BouncyCastle.

Open questions

  • Configuration shape for multiple keys (list of { alg, kid, key files } vs. auto-generation per enabled algorithm).
  • Migration of existing single-key installations (keep the current kid as the RS256 key).
  • Whether to replace java-jwt with Nimbus in this change or in the ML-DSA follow-up.
  • Key rotation interplay (multiple keys per algorithm during rotation).

Affected Files

  • core/src/main/kotlin/party/morino/mineauth/core/file/utils/KeyUtils.kt
  • core/src/main/kotlin/party/morino/mineauth/core/file/utils/JwtProvider.kt
  • core/src/main/kotlin/party/morino/mineauth/core/file/utils/TokenVerifiers.kt
  • core/src/main/kotlin/party/morino/mineauth/core/file/utils/SigningKeyPublisher.kt
  • core/src/main/kotlin/party/morino/mineauth/core/web/components/auth/OIDCDiscoveryResponse.kt
  • core/src/main/kotlin/party/morino/mineauth/core/web/router/auth/oauth/TokenRouter.kt
  • Client model / repository (OAuthClientRepository.kt)

References

Dominant language
Kotlin
Stars
1
Forks
1
Avg merge
23h 35m
Merged PRs (30d)
36

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from morinoparty/MineAuth

All issues in morinoparty/MineAuth

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.