How to use Redis as a session for authentication in spring Boot applicationRedisTemplate expire doesn't workHow to atomically delete keys matching a pattern using RedisHow do I delete everything in Redis?Redis Error in Spring Session sample using Maven and Spring BootSpring Boot - Redis persistence tokenAuthentication Principal is empty while using Spring Session RedisNot able to capture SessionDestroyed event in Spring Redis Session + Spring boot environmentUsing redis in spring boot application with separate IdP serverspring-boot redis : How to invalidate all sessions of a user?Spring Session with Redis - server.session.timeout has no effectSpring boot session in redis, expiration time update for each access

How can I set command-line parameters through `.emacs` file?

Fedora boot screen shows both Fedora logo and Lenovo logo. Why and How?

Is my Rep in Stack-Exchange Form?

How can Charles Proxy change settings without admin rights after first time?

STM Microcontroller burns every time

What is this opening trap called, and how should I play afterwards? How can I refute the gambit, and play if I accept it?

Does ultrasonic bath cleaning damage laboratory volumetric glassware calibration?

MH370 blackbox - is it still possible to retrieve data from it?

Every infinite linearly ordered set has two disjoint infinite subsets

Going to get married soon, should I do it on Dec 31 or Jan 1?

How to determine what is the correct level of detail when modelling?

Is there a short way to compare many values mutually at same time without using multiple 'and's?

What is this blowing instrument used in the acoustic cover of "Taekwondo" by "Walk off the Earth"?

Why does the numerical solution of an ODE move away from an unstable equilibrium?

Fitting a mixture of two normal distributions for a data set?

In the Marvel universe, can a human have a baby with any non-human?

Calculating the partial sum of a expl3 sequence

Why is the Turkish president's surname spelt in Russian as Эрдоган, with г?

Why is C++ initial allocation so much larger than C's?

Can a US president have someone sent to prison?

Averting Real Women Don’t Wear Dresses

Using “sparkling” as a diminutive of “spark” in a poem

Could Sauron have read Tom Bombadil's mind if Tom had held the Palantir?

First-year PhD giving a talk among well-established researchers in the field



How to use Redis as a session for authentication in spring Boot application


RedisTemplate expire doesn't workHow to atomically delete keys matching a pattern using RedisHow do I delete everything in Redis?Redis Error in Spring Session sample using Maven and Spring BootSpring Boot - Redis persistence tokenAuthentication Principal is empty while using Spring Session RedisNot able to capture SessionDestroyed event in Spring Redis Session + Spring boot environmentUsing redis in spring boot application with separate IdP serverspring-boot redis : How to invalidate all sessions of a user?Spring Session with Redis - server.session.timeout has no effectSpring boot session in redis, expiration time update for each access






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















How can I use Redis for handling a session for authentication in a Spring Boot application?



I tried with using expire() of the RedisTemplate class:



String redisKeyExpiryTime=environment.getProperty("app.redisKeyExpiryTime");
long redisKeyExpiry=Long.parseLong(redisKeyExpiryTime);
redisTemplate.expire(tokenId,1,TimeUnit.MINUTES);
hashOperations.put(userId,tokenId,token);


But it is not expiring that key. I am getting value against that tokenId Key even after expiration time over.










share|improve this question
























  • It is expire(), not expiry(). See also related question

    – trincot
    Mar 25 at 11:58











  • Yes, I had use that expire() . But it's not working. redisTemplate.expire(tokenId,redisKeyExpiry,TimeUnit.MINUTES); hashOperations.put(userId,tokenId,token);

    – k.rohit
    Mar 25 at 14:02











  • OK, I added that info in your question. Could you also edit it further and describe what you mean with "it is not working"? Mention any error message or unexpected behaviour...

    – trincot
    Mar 25 at 14:07











  • Actually, I am getting that token stored against tokenId even after setting expire time of 2min.

    – k.rohit
    Mar 25 at 14:12











  • Could you edit your question and add that information?

    – trincot
    Mar 25 at 14:24

















0















How can I use Redis for handling a session for authentication in a Spring Boot application?



I tried with using expire() of the RedisTemplate class:



String redisKeyExpiryTime=environment.getProperty("app.redisKeyExpiryTime");
long redisKeyExpiry=Long.parseLong(redisKeyExpiryTime);
redisTemplate.expire(tokenId,1,TimeUnit.MINUTES);
hashOperations.put(userId,tokenId,token);


But it is not expiring that key. I am getting value against that tokenId Key even after expiration time over.










share|improve this question
























  • It is expire(), not expiry(). See also related question

    – trincot
    Mar 25 at 11:58











  • Yes, I had use that expire() . But it's not working. redisTemplate.expire(tokenId,redisKeyExpiry,TimeUnit.MINUTES); hashOperations.put(userId,tokenId,token);

    – k.rohit
    Mar 25 at 14:02











  • OK, I added that info in your question. Could you also edit it further and describe what you mean with "it is not working"? Mention any error message or unexpected behaviour...

    – trincot
    Mar 25 at 14:07











  • Actually, I am getting that token stored against tokenId even after setting expire time of 2min.

    – k.rohit
    Mar 25 at 14:12











  • Could you edit your question and add that information?

    – trincot
    Mar 25 at 14:24













0












0








0








How can I use Redis for handling a session for authentication in a Spring Boot application?



I tried with using expire() of the RedisTemplate class:



String redisKeyExpiryTime=environment.getProperty("app.redisKeyExpiryTime");
long redisKeyExpiry=Long.parseLong(redisKeyExpiryTime);
redisTemplate.expire(tokenId,1,TimeUnit.MINUTES);
hashOperations.put(userId,tokenId,token);


But it is not expiring that key. I am getting value against that tokenId Key even after expiration time over.










share|improve this question
















How can I use Redis for handling a session for authentication in a Spring Boot application?



I tried with using expire() of the RedisTemplate class:



String redisKeyExpiryTime=environment.getProperty("app.redisKeyExpiryTime");
long redisKeyExpiry=Long.parseLong(redisKeyExpiryTime);
redisTemplate.expire(tokenId,1,TimeUnit.MINUTES);
hashOperations.put(userId,tokenId,token);


But it is not expiring that key. I am getting value against that tokenId Key even after expiration time over.







redis






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 14:42







k.rohit

















asked Mar 25 at 11:15









k.rohitk.rohit

63 bronze badges




63 bronze badges












  • It is expire(), not expiry(). See also related question

    – trincot
    Mar 25 at 11:58











  • Yes, I had use that expire() . But it's not working. redisTemplate.expire(tokenId,redisKeyExpiry,TimeUnit.MINUTES); hashOperations.put(userId,tokenId,token);

    – k.rohit
    Mar 25 at 14:02











  • OK, I added that info in your question. Could you also edit it further and describe what you mean with "it is not working"? Mention any error message or unexpected behaviour...

    – trincot
    Mar 25 at 14:07











  • Actually, I am getting that token stored against tokenId even after setting expire time of 2min.

    – k.rohit
    Mar 25 at 14:12











  • Could you edit your question and add that information?

    – trincot
    Mar 25 at 14:24

















  • It is expire(), not expiry(). See also related question

    – trincot
    Mar 25 at 11:58











  • Yes, I had use that expire() . But it's not working. redisTemplate.expire(tokenId,redisKeyExpiry,TimeUnit.MINUTES); hashOperations.put(userId,tokenId,token);

    – k.rohit
    Mar 25 at 14:02











  • OK, I added that info in your question. Could you also edit it further and describe what you mean with "it is not working"? Mention any error message or unexpected behaviour...

    – trincot
    Mar 25 at 14:07











  • Actually, I am getting that token stored against tokenId even after setting expire time of 2min.

    – k.rohit
    Mar 25 at 14:12











  • Could you edit your question and add that information?

    – trincot
    Mar 25 at 14:24
















It is expire(), not expiry(). See also related question

– trincot
Mar 25 at 11:58





It is expire(), not expiry(). See also related question

– trincot
Mar 25 at 11:58













Yes, I had use that expire() . But it's not working. redisTemplate.expire(tokenId,redisKeyExpiry,TimeUnit.MINUTES); hashOperations.put(userId,tokenId,token);

– k.rohit
Mar 25 at 14:02





Yes, I had use that expire() . But it's not working. redisTemplate.expire(tokenId,redisKeyExpiry,TimeUnit.MINUTES); hashOperations.put(userId,tokenId,token);

– k.rohit
Mar 25 at 14:02













OK, I added that info in your question. Could you also edit it further and describe what you mean with "it is not working"? Mention any error message or unexpected behaviour...

– trincot
Mar 25 at 14:07





OK, I added that info in your question. Could you also edit it further and describe what you mean with "it is not working"? Mention any error message or unexpected behaviour...

– trincot
Mar 25 at 14:07













Actually, I am getting that token stored against tokenId even after setting expire time of 2min.

– k.rohit
Mar 25 at 14:12





Actually, I am getting that token stored against tokenId even after setting expire time of 2min.

– k.rohit
Mar 25 at 14:12













Could you edit your question and add that information?

– trincot
Mar 25 at 14:24





Could you edit your question and add that information?

– trincot
Mar 25 at 14:24












0






active

oldest

votes














Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55336565%2fhow-to-use-redis-as-a-session-for-authentication-in-spring-boot-application%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55336565%2fhow-to-use-redis-as-a-session-for-authentication-in-spring-boot-application%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript