class CsrfTokenService {

    void validateToken(final HttpServletRequest request) throws CsrfException {
        final CsrfUidToken csrfUidToken = decryptToken(request);

        if (!isUIdValid(csrfUidToken.getuId())) {
            throw new CsrfException("User id not recognised while validating CSRF token.");
        }

        if (!isTimestampValid(csrfUidToken.getTimestamp())) {
            throw new CsrfException("Timestamp not valid while validating CSRF token.");
        }
    }

}