Created
November 29, 2016 14:19
-
-
Save novotnyr/0db0f0c7a32e17e47404adf373f2baee to your computer and use it in GitHub Desktop.
redis-cli utility to handle Spring Security / Spring Session sessions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
COMMAND="$1" | |
REDIS_CLI="redis-cli" | |
case "$COMMAND" in | |
list) | |
"$REDIS_CLI" keys 'spring:session:sessions:[a-f0-9][a-f0-9]*' | |
;; | |
hkeys) | |
if [ -z "$2" ]; then | |
echo "Missing session UUID" | |
exit 1 | |
fi | |
"$REDIS_CLI" hkeys 'spring:session:sessions:'"$2" | |
;; | |
context) | |
if [ -z "$2" ]; then | |
echo "Missing session UUID" | |
exit 1 | |
fi | |
"$REDIS_CLI" hget 'spring:session:sessions:'"$2" "sessionAttr:SPRING_SECURITY_CONTEXT" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment