Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add jwt pkg#14928

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sreya merged 25 commits intomainfromjon/jwt
Oct 4, 2024
Merged

feat: add jwt pkg#14928

sreya merged 25 commits intomainfromjon/jwt
Oct 4, 2024

Conversation

sreya
Copy link
Collaborator

@sreyasreya commentedOct 2, 2024
edited
Loading

This PR adds ajwtutils package to be shared amongst the various packages in the codebase that make use of JWTs. It's intended to help us standardize on one library instead of some implementations usinggo-jose and others usinggolang-jwt.

The main reason we're converging ongo-jose is due to its support for JWEs,golang-jwt also has a repo to handle it but itdoesn't look maintained

This refactor encapsulates key management for JWT signing and verification by:- Introducing `ParseKeyFunc` and `SecuringKeyFn` to streamline key operations.- Moving key-related functions to `jwt.go` to improve package modularity.- Simplifying `Encrypt` and `Decrypt` function documentation and usage.- Updating tests to align with the new function signatures and logic flow.
The JWT functionality has been refactored, and its associated test values are no longer required. Removing the test file helps maintain code clarity and prevents outdated test logic from impacting the current codebase.
- Renamed key functions to clarify their use.- Removed unused `featureHeaderKey`.- Added comprehensive tests for JWT signing and verifying.
@sreyasreya marked this pull request as ready for reviewOctober 2, 2024 05:14
- Streamlines key retrieval by integrating with the cryptokeys package.- Simplifies key handling by decoding directly using hex utilities.- Enhances validation by using context for managing key operations.- Improves test robustness with clearer setup and consistent mocking.
- Rename package `jwt` to `jwtutils` for better context.- Consolidate constants and enhance error messages.- Simplify key management for JWT signing and verification.
Refactor JWT utility code to replace `ParseOptions` with more specific`VerifyOptions` and `DecryptOptions`. This change enhances clarity andflexibility, accommodating different needs for JWS and JWE operations. Updatetests to align with the refactored structure, ensuring robust coverage andfunctionality verification.
Increase OIDC secret length for added security and clarity.Optimize JWT test coverage with custom claims and key cache tests.
- Enhance comments for key interfaces to clarify usage  and considerations for time validity and clock skew.- Refactor JWE/JWS logic to simplify serialization and  deserialization processes, ensuring more efficient and  concise handling of JWTs. Implement compact serialization  and remove unnecessary base64 encoding.
Removing unused test and mock code simplifies maintenance and reduces clutter.
@sreyasreya requested a review fromEmyrkOctober 3, 2024 22:37
Deleting unnecessary cryptokeys keycachemock ensures clarity and reduces maintenance.
Ensure that the dbCache methods for encrypting, decrypting, signing,and verifying keys validate the feature flag before proceeding withoperations. This validation step prevents using keys for unintendedpurposes, maintaining proper alignment with their intendedcryptographic feature.
Copy link
Member

@EmyrkEmyrk left a comment

Choose a reason for hiding this comment

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

LG, would like to have the "fetcher" interface so we can use this in wsproxy too at some point 👍

@sreya
Copy link
CollaboratorAuthor

sreya commentedOct 4, 2024
edited
Loading

LG, would like to have the "fetcher" interface so we can use this in wsproxy too at some point 👍

Yeah I'll open anissue to work on a refactor once I get this running in dev.

@sreyasreya merged commit68ec532 intomainOct 4, 2024
27 of 29 checks passed
@sreyasreya deleted the jon/jwt branchOctober 4, 2024 02:09
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsOct 4, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@EmyrkEmyrkEmyrk approved these changes

@deansheatherdeansheatherdeansheather approved these changes

Assignees

@sreyasreya

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@sreya@Emyrk@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp