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

ValidatingPushNotificationHandler not verifying expirationTimestamp #902

Open
brandonm opened this issue Jul 28, 2021 · 2 comments
Open

Comments

@brandonm
Copy link

final Instant expirationTimestamp = this.expirationTimestampsByDeviceToken.get(deviceToken);
if (expirationTimestamp != null) {
throw new UnregisteredDeviceTokenException(expirationTimestamp);
}

Is there a reason why the code is not actually verifying if it's expired but assuming if it exists then its expired?

Comment in ValidatingPushNotificationHandlerFactory.class makes it sound like it will be checked.

 * @param expirationTimestampsByDeviceToken a map of device tokens to the time at which they expire; tokens not in
 * the map (or all tokens if the map is {@code null} or empty) will never be considered "expired"
@jchambers jchambers added the bug label Jul 29, 2021
@jchambers
Copy link
Owner

At a glance, that looks like it's just a mistake. I'll take a closer look shortly.

@jchambers jchambers added this to the v0.15.4 milestone Jan 15, 2024
@jchambers jchambers removed the bug label Jan 15, 2024
@jchambers
Copy link
Owner

I've looked more closely at this, and this is behaving as expected, though I recognize that the documentation could be clearer. The design intent is that callers can ask the mock server to report that a device token expired at a certain timestamp. The idea is that the timestamp should be in the past, but it's not technically required.

The check you referenced is essentially asking "has somebody specified that this device is expired?" and not "should I perform some time check to see if it is expired?"

I'll think about some ways to rephrase the docs to be clearer, but I do not believe there's any functional problem here.

@jchambers jchambers removed this from the v0.15.4 milestone Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants