Giter Club home page Giter Club logo

Comments (6)

jaliss avatar jaliss commented on August 23, 2024

Chris,

There is some code to save the original url and redirect the user back to it after login. The SecureSocial.checkAccess() method saves it. It does it for GET requests, for POST requests it just redirects to /. Do you see it fail for GET requests?

Jorge

from securesocial.

tazmaniax avatar tazmaniax commented on August 23, 2024

Hi Jorge,

Sorry I should have mentioned that I'm still using a customised secure module at the moment but I would like to move to using SecureSocial, however from looking at the source the same issue exists in both for this use case. I have a login link in my app that is available on pages that can be viewed by both signed-in and unsigned-in users and as a result the class is not annotated with "@with(...)". When selected the login link calls the login() controller method to render the login page but checkAccess() method is not called so the originalUrl is not defined and in this case I would like the originalUrl to be set to the referer header when the originalUrl is not already defined, e.g.

/**

  • The action for the login page.
    */
    public static void login() {
    final Collection providers = ProviderRegistry.all();
    String originalURL = flash.get(ORIGINAL_URL);
    if (originalURL == null) {
    Http.Header refererHeader = request.headers.get("referer");
    if (refererHeader != null && refererHeader.values.size() > 0) {
    flash.put(ORIGINAL_URL, refererHeader.values.get(0));
    }
    } else {
    flash.keep(ORIGINAL_URL);
    }
    boolean userPassEnabled = ProviderRegistry.get(ProviderType.userpass) != null;
    render(providers, userPassEnabled);
    }

This is obviously a customisation that not everyone wants so I was looking for a mechanism to add optionally add this.

Chris

from securesocial.

jaliss avatar jaliss commented on August 23, 2024

Are you pointing to the login page from the public pages?

from securesocial.

tazmaniax avatar tazmaniax commented on August 23, 2024

Yes I have a login link in the top right of my pages. This link changes to logout after a user has authenticated and points to the logout page. Similar to the login when the user selects logout they are returned to the same page, but with less content. I forked SecureSocial and added two callback methods to UserService, onLogin and onLogout. The idea would be that onLogin could set the originalUrl to the referrer if originalUrl was not already set and onLogout could set the redirectTo to the referrer to display the page prior to selecting logout. Implementing the callbacks would allow my app to customise the authentication process without impacting too much on the framework itself and affecting other users of the module. Thoughts?

from securesocial.

jaliss avatar jaliss commented on August 23, 2024

You can use securesocial.login.redirect=MyController.myAction in application.conf to specify the page you'd like to user to be redirected after log in if no originalURL was detected.

from securesocial.

cndreiter avatar cndreiter commented on August 23, 2024

I cannot find the checkAccess method in the code. Has it been removed? Otherwise, please tell me the file in which it lives.

Thanks

from securesocial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.