I just pushed omniauth-central_login
to rubygems.org, to make it easy to integrate CentralLogin with other ruby apps. It is a companion gem to CentralLogin, a batteries included open source OAuth2 Provider based on Rails, Doorkeeper & Devise, with simple user managment tools.
Add this line to your application's Gemfile:
ruby
gem 'omniauth-central_login'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install omniauth-central_login
Configuring Omniauth:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :central_login, ENV['CENTRAL_LOGIN_CLIENT_ID'], ENV['CENTRAL_LOGIN_CLIENT_SECRET'], {
scope: "openid email profile",
client_options: {
site: ENV['CENTRAL_LOGIN_URL']
}
}
end
Configuration for Devise (using omniauthable):
co...
This is a short follow up on the previous article in which the ActionCable basics were explained. We can now add some level of authentication. Authentication is a bit harder than simply registering some before_action
’s, but it is perfectly doable, especially if you've survived the previous tutorial.
From the official Action Cable guide we can simply reuse the full connection.rb template:
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
self.current_user = find_verified_user
end
protected
def find_verified_user
if current_user = User.find_by(id: cookies.signed[:user_id])
current_...
Dit artikel van murblog van Maarten Brouwers (murb) is in licentie gegeven volgens een Creative Commons Naamsvermelding 3.0 Nederland licentie .