54132

SpringSecurity/Grails how to change loginFormUrl in LoginUrlAuthenticationEntryPoint dynamically at

Question:

I need to append a suffix to the config value "grails.plugin.springsecurity.auth.loginFormUrl = /login/auth" dynamically at runtime. So I think I would have to change the field "loginFormUrl" in class "LoginUrlAuthenticationEntryPoint". The method "setLoginFormUrl" is deprecated so I wonder how can I change that at runtime? Should I inject/create a new "LoginUrlAuthenticationEntryPoint" everytime I need to do that? How/where would I do that?

Answer1:

So the solution is quite simple. I implemented my own AuthenticationEntryPoint which is pretty much like the LoginUrlAuthenticationEntryPoint but has a different implementation of the determineUrlToUseForThisRequest method.

Then you only have to add this to your resources.groovy:

authenticationEntryPoint(MyCustomEntryPoint) {}

Recommend

  • How do I add a File Type Association in a Windows Phone 8.1 app manifest?
  • runtime error when linking ffmpeg libraries in qt creator
  • How can i dump blob fields from mysql tables
  • (Tcl/Expect) clear screen after exit
  • Ruby on Rails App deployed to heroku showing “We're sorry, but something went wrong”
  • HttpClient: disabling chunked encoding
  • How do I get the list of bad records that didn't load in Bigquery?
  • Detecting null parameter in preprocessor macro
  • Hash Code in SQL Server?
  • How to autopopulate a field in SugarCRM form
  • List images(01.png) and descriptions(01.txt) from directory
  • Login not working in Firefox in Meteor
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • Inline R code in YAML for rmarkdown doesn't run
  • Thread safety of a fluent like class using clone() and non final fields
  • Retrieve list of sent friend requests from friend_request FQL table
  • MongoDb aggregation
  • Django rest serializer Breaks when data exists
  • How to use an array of arrays with array_map(…) in PHP?
  • Recording logins for password protected directories
  • Initializer list vs. initialization method
  • Using variable in a value field in jMeter
  • Linq Objects Group By & Sum
  • Retrieving value from sql ExecuteScalar()
  • Is there any way to access browser form field suggestions from JavaScript?
  • Spring security and special characters
  • Nant, Vault & Windows Integrated Authentication
  • WinForms: two way TextBox problem
  • Trying to switch camera back to front but getting exception
  • Calling of Constructors in a Java
  • Traverse Array and Display in markup
  • Transpose CSV data with awk (pivot transformation)
  • KeystoneJS: Relationships in Admin UI not updating
  • Free memory of cv::Mat loaded using FileStorage API
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • Getting error when using KSoap library to consume .NET web services
  • Hits per day in Google Big Query
  • Angular 2 constructor injection vs direct access
  • Checking variable from a different class in C#
  • Programmatically clearing map cache