H
H
Heafy2014-12-22 16:10:47
Ruby on Rails
Heafy, 2014-12-22 16:10:47

Way to authorize admin in rails application?

For the purpose of self-education, I wrote a blog using the ruby ​​on rails framework.
Blog single user - only admin and anonymous visitors. For the first time, I used the most primitive "authentication" for administration, registered the code in the article controller:

class ArticlesController < ApplicationController
  before_filter :master, :only => [ :new, :edit, :destroy ]
 
  def new
    ...
  end

  ... # и другие методы

  private

    def master
      authenticate_or_request_with_http_basic do |email, password|
        email == "******"
        password == "******"
      end
    end
end

Now, when all the little things are debugged, I was interested in authentication by some kind of external service - Google / Facebook / VKontakte, etc., why external? - a separate database for users is not required and the code of this application can be stored in a public repository, and I will not worry that someone will write a curse word on my behalf.
Simply put, I want to tell the application that if a person with such and such an email is authorized, then he has access to the administration page and I will be calm that the pranksters need not only to study the application code on the github, but to hack my account, for example, on a buzz mail.
Please tell me who has already implemented this, what to look at / what to read to implement single-user external (if you can call it that) authentication on your blog, or a time-tested alternative.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Krasnodemsky, 2014-12-22
@Heafy

Devise
Differences that today the user one - is not present. Tomorrow you will want to collect a database of user emails for mailing and give access to comments after authenticating through social networks. networks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question