Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement Request: Expand JWT Algorithm Support (RFC 7518 Compliance) #1481

Open
mdaneri opened this issue Feb 8, 2025 · 0 comments
Open

Comments

@mdaneri
Copy link
Contributor

mdaneri commented Feb 8, 2025

Description
Pode’s JWT authentication should be expanded to fully comply with [RFC 7518: JSON Web Algorithms (JWA)](https://datatracker.ietf.org/doc/html/rfc7518), allowing Pode to support a wider range of JWT signing and verification algorithms.

Proposed Enhancements

  • Add support for additional JWT algorithms:
    • NONE, HS256, HS384, HS512 (HMAC)
    • RS256, RS384, RS512 (RSA)
    • PS256, PS384, PS512 (RSA-PSS)
    • ES256, ES384, ES512 (ECDSA)
  • Introduce -PrivateKey parameter:
    • Enables support for RSA and ECDSA verification.
    • Accepts private keys in PEM format as a secure string.
    • Example usage:
      $privateKey = Get-Content 'C:\\path\\to\\private-key.pem' -Raw | ConvertTo-SecureString -AsPlainText -Force
      New-PodeAuthScheme -Bearer -AsJWT -PrivateKey $privateKey | Add-PodeAuth -Name 'JWTAuth' -Sessionless -ScriptBlock {
          param($payload)
          Write-Output "Authenticated user: $($payload.sub)"
      }
  • Validate JWT signature against provided keys:
    • Pode should reject JWTs with invalid or mismatched signatures.
    • Signature verification should be optional (e.g., -IgnoreSignature parameter).
  • Ensure proper handling of JWT expiry (exp) and not-before (nbf) claims.

Why This is Needed

  • Aligns Pode’s JWT authentication with industry standards.
  • Supports widely used cryptographic algorithms for stronger security.
  • Allows authentication mechanisms to leverage RSA and ECDSA, which are commonly used in enterprise-grade security solutions.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

1 participant