Skip to content
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

Make Clock customization accessible for verification #125

Merged
merged 2 commits into from
Jan 4, 2017

Conversation

lbalmaceda
Copy link
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
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