Package io.meeds.pwa.service
Class PwaNotificationTokenService
java.lang.Object
org.exoplatform.web.security.security.AbstractTokenService<org.exoplatform.web.security.PortalToken,String>
org.exoplatform.web.security.security.CookieTokenService
io.meeds.pwa.service.PwaNotificationTokenService
- All Implemented Interfaces:
org.exoplatform.web.security.TokenStore,org.picocontainer.Startable
@Service
public class PwaNotificationTokenService
extends org.exoplatform.web.security.security.CookieTokenService
Persistent token service used by service workers to retrieve a web
notification after the web session cookie has expired. The generated token is
persisted through
PortalTokenStorage by the parent
CookieTokenService; only the token selector and salted hash are
stored. The token type binds the token to both the notification and the push
subscription, so the same raw token cannot be used for another notification
or another device subscription. The service also exposes consumeToken(...)
for single-push delivery tokens: after the first successful push fetch, the
token is deleted from the persistent store.-
Field Summary
FieldsFields inherited from class org.exoplatform.web.security.security.CookieTokenService
EMAIL_VALIDATION_TOKEN, EXTERNAL_REGISTRATION_TOKEN, FORGOT_PASSWORD_TOKEN, HASH_SERVICE_INIT_PARAM, LIFECYCLE_NAME, ONBOARD_TOKEN, SEPARATOR_CHARFields inherited from class org.exoplatform.web.security.security.AbstractTokenService
CLEANUP_PERIOD_TIME, DEFAULT_TOKEN_BYTE_LENGTH, delayTime, log, name, SERVICE_CONFIG, tokenByteLength, validityMillis -
Constructor Summary
ConstructorsConstructorDescriptionPwaNotificationTokenService(io.meeds.web.security.storage.PortalTokenStorage tokenStore) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildTokenType(long notificationId, String subscriptionId) consumeToken(String token, long notificationId, String subscriptionId) createToken(String username, long notificationId, String subscriptionId) voiddeleteNotificationToken(String token, long notificationId, String subscriptionId) voiddeleteNotificationTokens(String username) validateToken(String token, long notificationId, String subscriptionId) validateToken(String token, long notificationId, String subscriptionId, boolean remove) Methods inherited from class org.exoplatform.web.security.security.CookieTokenService
cleanExpiredTokens, createToken, createToken, decodeKey, deleteAll, deleteToken, deleteToken, deleteTokensByUsernameAndType, deleteTokensOfUser, getToken, getToken, nextTokenId, sizeMethods inherited from class org.exoplatform.web.security.security.AbstractTokenService
getInstance, getName, getPeriodTime, getValidityTime, nextRandom, start, stop, validateToken
-
Field Details
-
TOKEN_TYPE_PREFIX
- See Also:
-
-
Constructor Details
-
PwaNotificationTokenService
public PwaNotificationTokenService(io.meeds.web.security.storage.PortalTokenStorage tokenStore) -
PwaNotificationTokenService
public PwaNotificationTokenService()
-
-
Method Details
-
createToken
-
validateToken
-
consumeToken
-
validateToken
-
deleteNotificationToken
-
deleteNotificationTokens
-
buildTokenType
-