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

JwtParser parse method name changes #834

Closed
lhazlewood opened this issue Sep 16, 2023 · 0 comments · Fixed by #845
Closed

JwtParser parse method name changes #834

lhazlewood opened this issue Sep 16, 2023 · 0 comments · Fixed by #845
Milestone

Comments

@lhazlewood
Copy link
Contributor

Creating this issue per the discussion in #658

Since parsing unprotected JWTs is not possible by default (RFCs mandate disabling this behavior by default), and can only be supported by configuring the JwtParserBuilder in master (via the enableUnsecured() builder method), unexpected parse method invocations are still protected/secure by default.

To that end, this issue represents a name change purely in the name of convenience and self-documentation. It is to change the various parse* methods from parseClaimsJws, parseClaimsJwt, etc (which might not be easy to distinguish visually and easily chosen incorrectly) to something more readable/explicit and less likely to be chosen mistakenly. For example:

Jwt<Claims> parseUnprotectedClaims(String jwt);

Jwt<byte[]> parseUnprotectedContent(String jwt);

Jws<Claims> parseSignedClaims(String jwt);

Jws<byte[]> parseSignedContent(String jwt);

Jwe<Claims> parseEncryptedClaims(String jwt);

Jwe<byte[]> parseEncryptedContent(String jwt);
@lhazlewood lhazlewood added this to the 1.0 milestone Sep 16, 2023
@lhazlewood lhazlewood changed the title Parse method name changes JwtParser parse method name changes Sep 16, 2023
lhazlewood added a commit that referenced this issue Sep 30, 2023
- Deprecated JwtParser parseContentJwt, parseClaimsJwt, parseContentJws and parseClaimsJws in favor of parseUnprotectedContent, parseUnprotectedClaims, parseSignedContent, and parseSignedClaims
- Renamed the not-yet-released JwtParser parseContentJwe and parseClaimsJwe to parseEncryptedContent and parseEncryptedClaims
- Renamed the not-yet-released JwtParser overloaded unencoded payload parseContentJws and parseClaimsJws methods to parseSignedContent and parseSignedClaims

Still need to refactor the JwtHandler and JwtHandlerAdapter concepts, probably using the visitor pattern with a new JwtVisitor interface
lhazlewood added a commit that referenced this issue Oct 3, 2023
- Deprecated JwtHandler and JwtHandlerAdapter in favor of JwtVisitor and SupportedJwtVisitor, probably using the visitor pattern with a new JwtVisitor interface
lhazlewood added a commit that referenced this issue Oct 3, 2023
* Closes #834

- Deprecated JwtParser parseContentJwt, parseClaimsJwt, parseContentJws and parseClaimsJws in favor of parseUnprotectedContent, parseUnprotectedClaims, parseSignedContent, and parseSignedClaims

- Renamed the not-yet-released JwtParser parseContentJwe and parseClaimsJwe to parseEncryptedContent and parseEncryptedClaims

- Renamed the not-yet-released JwtParser overloaded unencoded payload parseContentJws and parseClaimsJws methods to parseSignedContent and parseSignedClaims

- Deprecated JwtHandler and JwtHandlerAdapter in favor of JwtVisitor and SupportedJwtVisitor
@lhazlewood lhazlewood modified the milestones: 1.0, 0.12.0 Oct 15, 2023
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 a pull request may close this issue.

1 participant