Open
Description
Hi,
Maybe I'm missing something so apologies if this is not an issue.
I've configured my spring boot application to use jackson-datatype-jsr310 by including in pom.xml, all outgoing json is serialized correctly.
however I am using a hashmap to set the payload of the the jwt token:
hashMap.put(Claims.ISSUED_AT,LocalDateTime.now);
and this is being serialized in the Long LocalDateTimeFormat:
{"hour":9,"minute":53,"second":49,"nano":288000000,"dayOfYear":193,"dayOfWeek":"WEDNESDAY","month":"JULY","dayOfMonth":12,"year":2017,"monthValue":7,"chronology":{"calendarType":"iso8601","id":"ISO"}
I had a similar issue in another spring boot application where I was using new ObjectMapper() and not using springBoots configured ObjectMapper.
Any ideas how I could make jjwt pick up springboots ObjectMapper which would be configured correctly ?
I'm using using jjwt version 0.7.0.
Thanks in advance for your help,
Peter
Activity
lhazlewood commentedon Oct 11, 2017
Unfortunately you cannot currently specify the ObjectMapper that the JwtBuilder will use to generate the resulting JSON. Yet. :)
We'll use this issue to track the work to allow you to do so :)
That said, would you say this issue should be classified as "Allow me to set my own ObjectMapper" ?
Or is the issue really "Please support Java8 Date/Time formats ?
Thoughts?
Thanks for the issue!
petekaras commentedon Oct 22, 2017
Hi Les,
Yes, I think this is really about supporting Java8 formats.
I would be happy to contribute to this project, but am short of time right now. Will let you know if I can help out in the future if you are looking for contributors ?
[-]Java8 jsr310 LocalDateTime [/-][+]Please support Java8 Date/Time formats [/+]simdevmon commentedon Apr 19, 2018
It would be nice to have overloaded methods e.g. in
Claims
e.g.Would you accept a PR for that?
[-]Please support Java8 Date/Time formats [/-][+]Java8 Date/Time formats [/+]lhazlewood commentedon Jul 11, 2018
Depends on #308.
lhazlewood commentedon Jul 11, 2018
This ticket would add support for claims of type:
Anything else?
cassiomolin commentedon May 17, 2019
Can we add
OffsetDateTime
to the list?marschall commentedon Aug 6, 2019
I would not support
LocalDateTime
.LocalDateTime
is not an instant and therefore does not identify a point in time. You would need a time zone for that. Which means you don't know how much time has passed since a claim was issued which means that you don't know whether it is expired.Even the JSR-310 expert group leader thinks
LocalDateTime
is not generally useful.tc39/proposal-temporal#7 (comment)
RockyMM commentedon Jan 4, 2020
@marschall I completely agree.
LocalDateTime
is ambiguous. However, Instant has far too many advantages over java.util.Date. I will check other tickets for progress on of deprecation of java.util.Date.marschall commentedon Jan 5, 2020
@RockyMM sure,
Instant
,OffsetDateTime
andZonedDateTime
are a great addition and completely fine.imhansai commentedon Apr 19, 2023
Hi, it's 2023, any good news?
14 remaining items