OidcUserInfo builder shoud accept Instant for the updateAt method

Open Beginner friendly
#20,013 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java

Research direction

Start from the updatedAt method on the OidcUserInfo builder, which currently takes a String, and see how the updated_at claim is stored. Add an overload that takes an Instant and stores it as epoch seconds, which the spec requires as a JSON number, and check the existing claim("updated_at", ...) workaround in the issue for the expected output. Done means a test builds the user info from an Instant and asserts the updated_at claim is the matching Unix timestamp.

Written by the indexing model from the issue text.

Description

status: waiting-for-triage type: bug

Describe the bug
This is the definition of the updated_at claim from the spec:

Time the End-User's information was last updated. Its value is a JSON number representing the number of seconds from 1970-01-01T00:00:00Z as measured in UTC until the date/time.

Currently the updatedAt builder method accepts a String. The rendered claim in this case violates the spec.

To Reproduce

var info = OidcUserInfo.builder()
             .updatedAt( "not a valid date")
             .build();        

Expected behavior
The method should accept an Instant object and render as the unix timestamp corresponding to the value.

For now, the workaround is to use claim("updated_at", Instant.now().getEphochSecond())

Dominant language
Java
Stars
9.7k
Forks
6.4k
Avg merge
1d 20h
Merged PRs (30d)
42

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from spring-projects/spring-security

All issues in spring-projects/spring-security

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.