Class RedisTokenBlacklistRepository
java.lang.Object
com.broadleafcommerce.auth.authorization.security.tokenblacklist.redis.RedisTokenBlacklistRepository
Simple repository used for interacting with Redis to manage blacklisted tokens.
- Since:
- AuthenticationServices 3.0.0, Release Train 3.0.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRedisTokenBlacklistRepository(org.springframework.data.redis.core.StringRedisTemplate redisTemplate) -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters the token ID in Redis with a specified Time-to-Live (TTL).protected StringgetBlacklistedTokenKey(String tokenId, String tokenType) Generates a key prefixed with the blacklist identifier and the lowercased token type, followed by the raw token ID.protected org.springframework.data.redis.core.StringRedisTemplatebooleanisBlacklisted(String tokenId, String tokenType) Checks if the given token ID exists in Redis.
-
Field Details
-
BLACKLISTED_TOKEN_KEY_PREFIX
- See Also:
-
-
Constructor Details
-
RedisTokenBlacklistRepository
public RedisTokenBlacklistRepository(org.springframework.data.redis.core.StringRedisTemplate redisTemplate)
-
-
Method Details
-
blacklist
Registers the token ID in Redis with a specified Time-to-Live (TTL).- Parameters:
tokenId- the token ID to blacklisttokenType- the token type of the blacklist recordttl- the Time-to-Live duration for the blacklist record
-
isBlacklisted
Checks if the given token ID exists in Redis.- Parameters:
tokenId- the token ID to checktokenType- the token type of the blacklist record- Returns:
- true if the token ID exists in the blacklist, false otherwise
-
getBlacklistedTokenKey
Generates a key prefixed with the blacklist identifier and the lowercased token type, followed by the raw token ID.- Parameters:
tokenId- the raw token IDtokenType- the type of the token- Returns:
- the key to use to store the token in the blacklist
-
getRedisTemplate
protected org.springframework.data.redis.core.StringRedisTemplate getRedisTemplate()
-