Git Product home page Git Product logo

Comments (7)

TomNaessens avatar TomNaessens commented on July 1, 2024

At the moment, I used a workaround where I have a different controller which logs in the partner and redirects the partner to the partner show URL. Using the sign_in_token = true, the acts_as_token_authentication_handler does not need to be placed on top of the original controller.

It may however still be an interesting use case to allow scoping for this method, so I'll leave this open.

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on July 1, 2024

Hi @silox, seems you're right about the access denied causes; I'm AFK right
now ; )

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on July 1, 2024

Hi @silox, I'm sorry I haven't replied to you sooner.

The use case you want to implement is quite complex. In fact, my first idea in such a case would be either to treat "User" and "Partner" as roles with a single User model, or to implement them as two sub-classes of an unique token authenticatable class (typ. through Single Table Inheriance). In that last implementation, I would probably name their parent class Account or User, while the children could be PartnerAccount/UserAccount or CustomerPartner/Customer... there are a bunch of possibilities depending on your business. I didn't knew about CAS, and I don't know if it can interfere with such a design.

On the other hand, it should be possible to allow passing the only: [:show, :confirm] option to acts_as_token_authenticatation_handler. However, since that option won't affect the method itself but authenticate_resource!, I'm not sure about which syntax could avoid ambiguity.

A third way could be allowing to disable, through an initializer option, the authenticate_resource! calls. That would delegate to you to call it after each acts_as_authentication_handler decalaration. I don't like very much this possibility because of the importance of that call (remember the Access Forbidden is finally ensured by Devise, not by Simple Token Authentication). Yet it could be considered.

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on July 1, 2024

Hi @silox, taking about making the authenticate_resource! calls optional, I think the last part of this comment may interest you.
We still would have to define how that would interact with the eventual :only options, but that may simplify your issue.

Regards!

from simple_token_authentication.

TomNaessens avatar TomNaessens commented on July 1, 2024

👍

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on July 1, 2024

Hi, keep an eye on #66.

from simple_token_authentication.

gonzalo-bulnes avatar gonzalo-bulnes commented on July 1, 2024

Since v1.5.0 the #66 feature is implemented and examples can be found in the Installation section of the README file.

from simple_token_authentication.

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.