{"action":"opened","issue":{"url":"https://api.github.com/repos/jwtk/jjwt/issues/89","labels_url":"https://api.github.com/repos/jwtk/jjwt/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/jwtk/jjwt/issues/89/comments","events_url":"https://api.github.com/repos/jwtk/jjwt/issues/89/events","html_url":"https://github.com/jwtk/jjwt/issues/89","id":130493898,"number":89,"title":"Using SetClaims(Map<String, Object>) makes the NotBefore and Expiration dates being multiplied by 1000","user":{"login":"victorgb","id":996802,"avatar_url":"https://avatars.githubusercontent.com/u/996802?v=3","gravatar_id":"","url":"https://api.github.com/users/victorgb","html_url":"https://github.com/victorgb","followers_url":"https://api.github.com/users/victorgb/followers","following_url":"https://api.github.com/users/victorgb/following{/other_user}","gists_url":"https://api.github.com/users/victorgb/gists{/gist_id}","starred_url":"https://api.github.com/users/victorgb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/victorgb/subscriptions","organizations_url":"https://api.github.com/users/victorgb/orgs","repos_url":"https://api.github.com/users/victorgb/repos","events_url":"https://api.github.com/users/victorgb/events{/privacy}","received_events_url":"https://api.github.com/users/victorgb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-01T21:45:28Z","updated_at":"2016-02-01T21:45:28Z","closed_at":null,"body":"Hello,\r\n\r\nI believe that the problem is on the JwtMap class.\r\n\r\nThe setDate(String, Date) method divides the date by 1000 (to store the date in seconds), and the getDate(String) method multiplies the dates by the same factor. \r\n\r\nHowever, the JwtMap constructor that receives a Map makes no such check for dates, therefore dates will be stored in millis and multiplied by 1000 when the getDate(String) method is used.\r\n\r\nAs a result, in many cases, it causes the parser to throw PrematureJwtException with valid NotBefore dates, or to miss throwing ExpiredJwtException with expired dates. Obviously, as a workaround, I ended up using the setIssuedAt(Date), setNotBefore(Date) and setExpiration(Date) methods of the JwtBuilder and it worked like a charm.\r\n\r\nIt's the first time I ever reported a bug on github, so i'd like to apologize if I'm not aware of github etiquette to do so. For that same reason I didn't offer to send a patch or whatever.\r\n\r\nThanks,\r\nVictor"}}