X Tutup
Skip to content

Make Clock customization accessible for verification#125

Merged
hzalaz merged 2 commits intomasterfrom
clock-test-accessible
Jan 4, 2017
Merged

Make Clock customization accessible for verification#125
hzalaz merged 2 commits intomasterfrom
clock-test-accessible

Conversation

@lbalmaceda
Copy link
Copy Markdown
Contributor

@lbalmaceda lbalmaceda commented Dec 14, 2016

Now when working with time related claims, the JWTVerifier allows to specify the custom Clock instance used on the verification. We want this to be as hidden as possible for the normal user. Devs can access it by performing a cast.

BaseVerification verification = (BaseVerification) JWT.require(Algorithm.RSA256(key))
    .acceptLeeway(1)
    .acceptExpiresAt(5);
Clock clock = new CustomClock(); //Must implement Clock interface
JWTVerifier verifier = verification.build(clock);

Related to: #50 #118

@lbalmaceda
Copy link
Copy Markdown
Contributor Author

The last commit can be avoided, as it only extracts a single method interface for the Clock class. This can be set from a new constructor receiving the Date value to be returned in the clock.getToday() call.

@lbalmaceda lbalmaceda force-pushed the clock-test-accessible branch from eb25cb4 to 545f5c4 Compare January 4, 2017 20:50
@hzalaz hzalaz added this to the 3.1.0 milestone Jan 4, 2017
@hzalaz hzalaz merged commit 9a79032 into master Jan 4, 2017
@hzalaz hzalaz deleted the clock-test-accessible branch January 4, 2017 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup