@Test public void getValidityShouldThrowWhenTokenIsNull() throws Exception { assertThatThrownBy(() -> tokenManager.getValidity(null)) .isInstanceOf(NullPointerException.class); }
@Override public TokenStatus getValidity(SignedExpiringToken token) { Preconditions.checkNotNull(token); if (! isCorrectlySigned(token)) { return TokenStatus.INVALID; } if (isExpired(token)) { return TokenStatus.EXPIRED; } return TokenStatus.OK; }
SignedTokenManager implements SimpleTokenManager { @Override public TokenStatus getValidity(SignedExpiringToken token) { Preconditions.checkNotNull(token); if (! isCorrectlySigned(token)) { return TokenStatus.INVALID; } if (isExpired(token)) { return TokenStatus.EXPIRED; } return TokenStatus.OK; } }
SignedTokenManager implements SimpleTokenManager { @Override public TokenStatus getValidity(SignedExpiringToken token) { Preconditions.checkNotNull(token); if (! isCorrectlySigned(token)) { return TokenStatus.INVALID; } if (isExpired(token)) { return TokenStatus.EXPIRED; } return TokenStatus.OK; } @Inject  SignedTokenManager(SignatureHandler signatureHandler, ZonedDateTimeProvider zonedDateTimeProvider); }
SignedTokenManager implements SimpleTokenManager { @Override public TokenStatus getValidity(SignedExpiringToken token) { Preconditions.checkNotNull(token); if (! isCorrectlySigned(token)) { return TokenStatus.INVALID; } if (isExpired(token)) { return TokenStatus.EXPIRED; } return TokenStatus.OK; } @Inject  SignedTokenManager(SignatureHandler signatureHandler, ZonedDateTimeProvider zonedDateTimeProvider); @Override TokenStatus getValidity(SignedExpiringToken token); @Override boolean isValid(SignedExpiringToken token); }
SignedTokenManager implements SimpleTokenManager { @Override public TokenStatus getValidity(SignedExpiringToken token) { Preconditions.checkNotNull(token); if (! isCorrectlySigned(token)) { return TokenStatus.INVALID; } if (isExpired(token)) { return TokenStatus.EXPIRED; } return TokenStatus.OK; } @Inject  SignedTokenManager(SignatureHandler signatureHandler, ZonedDateTimeProvider zonedDateTimeProvider); @Override TokenStatus getValidity(SignedExpiringToken token); @Override boolean isValid(SignedExpiringToken token);  }