-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
#235 Replace usage of java.util.Date #884
base: master
Are you sure you want to change the base?
Changes from 8 commits
9bdbb85
0921e29
54f3a19
fd1728c
13a83b6
a7c80d1
59196a7
9cbbbe7
a940383
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,9 @@ | |
import java.security.SecureRandom; | ||
import java.security.interfaces.ECKey; | ||
import java.security.interfaces.RSAKey; | ||
import java.util.Date; | ||
import java.time.Instant; | ||
import java.time.OffsetDateTime; | ||
import java.time.ZonedDateTime; | ||
import java.util.Map; | ||
|
||
/** | ||
|
@@ -523,14 +525,46 @@ public interface JwtBuilder extends ClaimsMutator<JwtBuilder> { | |
* | ||
* <p>This is a convenience wrapper for:</p> | ||
* <blockquote><pre> | ||
* {@link #claims()}.{@link ClaimsMutator#expiration(Date) expiration(exp)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* {@link #claims()}.{@link ClaimsMutator#expiration(Instant) expiration(exp)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* | ||
* @param exp the JWT {@code exp} value or {@code null} to remove the property from the Claims map. | ||
* @return the builder instance for method chaining. | ||
*/ | ||
@Override | ||
// for better/targeted JavaDoc | ||
JwtBuilder expiration(Date exp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If adding these other wrappers, keeping the ability to wrap a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. personally I would avoid keeping This would require a java version increase, and thus mean a major release. In my opinion it would be the ideal time to 'force' the devs to fix the breaking changes done in the major bump. ofc, I am not the maintainer and will bend to the will of the code owner. just my 2cents |
||
JwtBuilder expiration(Instant exp); | ||
|
||
/** | ||
* Sets the JWT Claims <a href="https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.4"> | ||
* <code>exp</code></a> (expiration) claim. A {@code null} value will remove the property from the Claims. | ||
* | ||
* <p>A JWT obtained after this timestamp should not be used.</p> | ||
* | ||
* <p>This is a convenience wrapper for:</p> | ||
* <blockquote><pre> | ||
* {@link #claims()}.{@link #expiration(Instant) expiration(exp)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* | ||
* @param exp the JWT {@code exp} value or {@code null} to remove the property from the Claims map. | ||
* @return the builder instance for method chaining. | ||
*/ | ||
// for better/targeted JavaDoc | ||
JwtBuilder expiration(OffsetDateTime exp); | ||
|
||
/** | ||
* Sets the JWT Claims <a href="https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.4"> | ||
* <code>exp</code></a> (expiration) claim. A {@code null} value will remove the property from the Claims. | ||
* | ||
* <p>A JWT obtained after this timestamp should not be used.</p> | ||
* | ||
* <p>This is a convenience wrapper for:</p> | ||
* <blockquote><pre> | ||
* {@link #claims()}.{@link #expiration(Instant) expiration(exp)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* | ||
* @param exp the JWT {@code exp} value or {@code null} to remove the property from the Claims map. | ||
* @return the builder instance for method chaining. | ||
*/ | ||
// for better/targeted JavaDoc | ||
JwtBuilder expiration(ZonedDateTime exp); | ||
|
||
/** | ||
* Sets the JWT Claims <a href="https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.5"> | ||
|
@@ -540,14 +574,46 @@ public interface JwtBuilder extends ClaimsMutator<JwtBuilder> { | |
* | ||
* <p>This is a convenience wrapper for:</p> | ||
* <blockquote><pre> | ||
* {@link #claims()}.{@link ClaimsMutator#notBefore(Date) notBefore(nbf)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* {@link #claims()}.{@link ClaimsMutator#notBefore(Instant) notBefore(nbf)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* | ||
* @param nbf the JWT {@code nbf} value or {@code null} to remove the property from the Claims map. | ||
* @return the builder instance for method chaining. | ||
*/ | ||
@Override | ||
// for better/targeted JavaDoc | ||
JwtBuilder notBefore(Date nbf); | ||
JwtBuilder notBefore(Instant nbf); | ||
|
||
/** | ||
* Sets the JWT Claims <a href="https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.5"> | ||
* <code>nbf</code></a> (not before) claim. A {@code null} value will remove the property from the Claims. | ||
* | ||
* <p>A JWT obtained before this timestamp should not be used.</p> | ||
* | ||
* <p>This is a convenience wrapper for:</p> | ||
* <blockquote><pre> | ||
* {@link #claims()}.{@link #notBefore(Instant) notBefore(nbf)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* | ||
* @param nbf the JWT {@code nbf} value or {@code null} to remove the property from the Claims map. | ||
* @return the builder instance for method chaining. | ||
*/ | ||
// for better/targeted JavaDoc | ||
JwtBuilder notBefore(OffsetDateTime nbf); | ||
|
||
/** | ||
* Sets the JWT Claims <a href="https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.5"> | ||
* <code>nbf</code></a> (not before) claim. A {@code null} value will remove the property from the Claims. | ||
* | ||
* <p>A JWT obtained before this timestamp should not be used.</p> | ||
* | ||
* <p>This is a convenience wrapper for:</p> | ||
* <blockquote><pre> | ||
* {@link #claims()}.{@link #notBefore(Instant) notBefore(nbf)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* | ||
* @param nbf the JWT {@code nbf} value or {@code null} to remove the property from the Claims map. | ||
* @return the builder instance for method chaining. | ||
*/ | ||
// for better/targeted JavaDoc | ||
JwtBuilder notBefore(ZonedDateTime nbf); | ||
|
||
/** | ||
* Sets the JWT Claims <a href="https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.6"> | ||
|
@@ -557,14 +623,46 @@ public interface JwtBuilder extends ClaimsMutator<JwtBuilder> { | |
* | ||
* <p>This is a convenience wrapper for:</p> | ||
* <blockquote><pre> | ||
* {@link #claims()}.{@link ClaimsMutator#issuedAt(Date) issuedAt(iat)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* {@link #claims()}.{@link ClaimsMutator#issuedAt(Instant) issuedAt(iat)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* | ||
* @param iat the JWT {@code iat} value or {@code null} to remove the property from the Claims map. | ||
* @return the builder instance for method chaining. | ||
*/ | ||
@Override | ||
// for better/targeted JavaDoc | ||
JwtBuilder issuedAt(Date iat); | ||
JwtBuilder issuedAt(Instant iat); | ||
|
||
/** | ||
* Sets the JWT Claims <a href="https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.6"> | ||
* <code>iat</code></a> (issued at) claim. A {@code null} value will remove the property from the Claims. | ||
* | ||
* <p>The value is the timestamp when the JWT was created.</p> | ||
* | ||
* <p>This is a convenience wrapper for:</p> | ||
* <blockquote><pre> | ||
* {@link #claims()}.{@link #issuedAt(Instant) issuedAt(iat)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* | ||
* @param iat the JWT {@code iat} value or {@code null} to remove the property from the Claims map. | ||
* @return the builder instance for method chaining. | ||
*/ | ||
// for better/targeted JavaDoc | ||
JwtBuilder issuedAt(OffsetDateTime iat); | ||
|
||
/** | ||
* Sets the JWT Claims <a href="https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.6"> | ||
* <code>iat</code></a> (issued at) claim. A {@code null} value will remove the property from the Claims. | ||
* | ||
* <p>The value is the timestamp when the JWT was created.</p> | ||
* | ||
* <p>This is a convenience wrapper for:</p> | ||
* <blockquote><pre> | ||
* {@link #claims()}.{@link #issuedAt(Instant) issuedAt(iat)}.{@link BuilderClaims#and() and()}</pre></blockquote> | ||
* | ||
* @param iat the JWT {@code iat} value or {@code null} to remove the property from the Claims map. | ||
* @return the builder instance for method chaining. | ||
*/ | ||
// for better/targeted JavaDoc | ||
JwtBuilder issuedAt(ZonedDateTime iat); | ||
|
||
/** | ||
* Sets the JWT Claims <a href="https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.7"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the old signatures for the deprecated methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this data change requires is a major release, I would actually opt to remove these deprecated methods (in another pull request)
I modified these just to ensure it all compiles and not longer requires
java.time.Date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get that, but the method is marked as deprecated, so that shouldn't be changed.
(this is basically removing a old deprecated method, and adding a new deprecated method)
In general (and when possible) we want to provide an easy upgrade path for users, (e.g. adding an extra setter and deprecating the old one).
That's not possible with getters, (which would be a breaking change).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the deprecated methods haven been reverted to use
java.util.Date