mirror of https://github.com/jwtk/jjwt.git
109: removed implementation coupling from Clock interface. DefaultClock.INSTANCE achieves the same thing without coupling.
This commit is contained in:
parent
9e1ee67582
commit
3dfae9a31d
|
@ -1,7 +1,5 @@
|
||||||
package io.jsonwebtoken;
|
package io.jsonwebtoken;
|
||||||
|
|
||||||
import io.jsonwebtoken.impl.DefaultClock;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,8 +9,6 @@ import java.util.Date;
|
||||||
*/
|
*/
|
||||||
public interface Clock {
|
public interface Clock {
|
||||||
|
|
||||||
public static final Clock DEFAULT = new DefaultClock();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the clock's current timestamp at the instant the method is invoked.
|
* Returns the clock's current timestamp at the instant the method is invoked.
|
||||||
*
|
*
|
||||||
|
|
|
@ -11,6 +11,11 @@ import java.util.Date;
|
||||||
*/
|
*/
|
||||||
public class DefaultClock implements Clock {
|
public class DefaultClock implements Clock {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default static instance that may be shared. It is thread-safe.
|
||||||
|
*/
|
||||||
|
public static final Clock INSTANCE = new DefaultClock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simply returns <code>new {@link Date}()</code>.
|
* Simply returns <code>new {@link Date}()</code>.
|
||||||
*
|
*
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class DefaultJwtParser implements JwtParser {
|
||||||
|
|
||||||
Claims expectedClaims = new DefaultClaims();
|
Claims expectedClaims = new DefaultClaims();
|
||||||
|
|
||||||
private Clock clock = Clock.DEFAULT;
|
private Clock clock = DefaultClock.INSTANCE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JwtParser requireIssuedAt(Date issuedAt) {
|
public JwtParser requireIssuedAt(Date issuedAt) {
|
||||||
|
|
Loading…
Reference in New Issue