News for hackers. Stuff that matters.
Re:Rails 6: B-Sides and Rarities by ksec on Thursday May 02, 2019 @12:52AM (#19804848)
Any Reason why Rails still does not include an any decent Auth by default?

Edit: I remembering keep asking this question but obviously no answer was satisfactory enough that stick to my brain.

Re:Rails 6: B-Sides and Rarities by aaronbrethorst on Thursday May 02, 2019 @01:52AM (#19805115)
has_secure_password is built in, and works as long as you include the bcrypt gem in your Gemfile. I've never found Devise or any other 'off the shelf' solution to be satisfying for me because authentication seems to vary just enough between projects to make it easier to use has_secure_password and rewrite auth from scratch.

Personally, I think it would be cool if someone built an user account/authentication experience as a generator (along the lines of Rails scaffolds), so that you could see all of the generated code and modify it without having to get elbow-deep into the bowels of what I find to be an overly-abstract gem.

Re:Rails 6: B-Sides and Rarities by ravenstine on Thursday May 02, 2019 @10:03AM (#19808001)
That's been my experience with Devise and similar libraries for other frameworks and languages. If it fulfills all needs for a project, that's great, but I tend to find that it's simpler just to build authentication around authentication "primitives" like has_secure_password. The thing I do like about Devise is that it has views for everything including password reset out of the box. The abstractions it provides end up being more of a headache than they are worth.

To be honest, I'd rather see more gems for these sorts of purposes that are just a collection of off-the-shelf views that can be easily tied in to one's authentication solution of choice. By installing Devise, you bring all of the extra non-view baggage it comes with into the application's memory space even if you don't use it. Yuck. (no offense!)

Actually, I just reread your comment and I think your scaffold/generator approach is also a nice way to go. It's just too bad that there hasn't been as much development effort towards these sorts of things recently in the Ruby community. I'd build it, but have gotten away from Ruby because the community is obsessed with applying object-orientation to every problem, over-abstracting, metaprogramming, etc.

Re:Rails 6: B-Sides and Rarities by brightball on Thursday May 02, 2019 @10:23AM (#19808187)
Because every application doesn't need it and it's virtually effortless to add Devise, which is the defacto standard at this point.
Re:Rails 6: B-Sides and Rarities by hit8run on Thursday May 02, 2019 @01:12AM (#19804952)
I think the defacto standard is devise but they want you to be flexible enough to roll your own or whatever serves you. I would like to have it built in though.
Re:Rails 6: B-Sides and Rarities by ken on Thursday May 02, 2019 @07:30AM (#19806746)
I'm not familiar with recent versions of Rails or its authentication situation, but whenever I hear this said about some mandatory functionality of a system, it sounds to me exactly like "We haven't yet figured out how to do ___ well".

It reminds me of the old days when I'd get a library which would say "We want to be flexible, so just pass in any memory allocation function here!", or Linux distros that said "We want to be flexible, so just write any boot script here!" Then a year later, some competitor ships with a default, and everybody switches over to that because it's obviously better (and you can always customize it if you need to).

Especially so with Rails, whose entire existence seems to be picking good-enough defaults.

Re:Rails 6: B-Sides and Rarities by petepete on Thursday May 02, 2019 @02:40AM (#19805338)
This sounds about right. And if you want something in between without rolling your own, Sorcery is excellent.

https://github.com/Sorcery/sorcery

Re:Rails 6: B-Sides and Rarities by jjgreen on Thursday May 02, 2019 @09:41AM (#19807787)
Looks interesting, thanks
Re:Rails 6: B-Sides and Rarities by mplewis on Thursday May 02, 2019 @01:16AM (#19804964)
There are many ways to do auth. Some Rails auth gems are more prescriptive than others. All of them involve large tradeoffs in various directions. It would be weird to bless just one of them as the "right" way to do auth in Rails, imo.
Re:Rails 6: B-Sides and Rarities by owens99 on Thursday May 02, 2019 @04:12AM (#19805779)
Have you tried Devise? It’s not default but it’s one of the best Auth tools I’ve seen in any stack. I love it and use it in tons of apps.
Re:Rails 6: B-Sides and Rarities by Kalium on Thursday May 02, 2019 @12:19PM (#19809539)
> Any Reason why Rails still does not include an any decent Auth by default?

If memory serves, Rails has quite good authentication built in by default.

If that's not what you meant, could you clarify?