Redirect target Post-Auth?


#1

Hi!
Been scouring over the posts in this forum and Silhouette sources. I am using Silhouette 5.0 on Play Scala 2.6.10 with the play Silhouette seed template.
What I am trying to achieve is that a user is sent back to the original secured action after the successful authentication. I had done this in other frameworks by passing a parameter with the target url around.
Not sure if this is already built-in or need to create myself.

Thanks!
Ciao,
Marco


#2

Hi,

yes, you’r right, this is not built-in. But as you say, this should be really straight forward to implement.

Best regards,
Christian


#3

Thank you for the fast response, Christian.
What do you suggest where to extract and store the original url?
Is the Authenticator the right place?
I think I got a handle on what to do post-authentication.

Ciao,
Marco


#4

Hi,

If you have a login form visible on every page, then you can use the URL of the current page and store it in the session or append it as URL encoded param to the URL. If you have a single login page, like in the seed template, then I would maintain a list of last visited pages (maybe 5) in the session. This could be easily done with a filter.

Hope that helps.

Best regards,
Christian