Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails spring security alternative for deprecated SPRING_SECURITY_LAST_USERNAME_KEY

I am developing a grails application where I need to fiddle with the Session variables to implement Custom Spring Security authentication and need to set the following-

request.session[SPRING_SECURITY_LAST_USERNAME_KEY] =
            TextEscapeUtils.escapeEntities(username)

Now this key comes from org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.SPRING_SECURITY_LAST_USERNAME_KEY which is now deprecated. Can you please suggest me an alternative for this?

like image 829
Aryan Avatar asked Dec 02 '25 15:12

Aryan


1 Answers

Yes I have faced the same problem. And it has a very simple alternative-

import grails.plugin.springsecurity.SpringSecurityUtils;

Now use SpringSecurityUtils.SPRING_SECURITY_LAST_USERNAME_KEY this will work and is not deprecated.

like image 124
Chetan Avatar answered Dec 05 '25 08:12

Chetan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!