From c8e741d0cadcf4486632c69e26fc6c48e6a15399 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Thu, 24 Jul 2014 22:58:36 +0300 Subject: [PATCH 1/4] openID keys for localhost in example secrets, so that openID works out of the box --- config/secrets.yml.example | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/secrets.yml.example b/config/secrets.yml.example index c2a21e41..f6e1c7ff 100644 --- a/config/secrets.yml.example +++ b/config/secrets.yml.example @@ -33,12 +33,12 @@ production: # If you add more providers, keep the format of the variables: provider_key, provider_secret # Register your appllication with Google from https://code.google.com/apis/console#:access - google_key: '' - google_secret: '' + google_key: '458905029210-hhf15fe4cq93i9t88i4r49v3si1avpjr.apps.googleusercontent.com' + google_secret: '-jXIXbaRV9xvdctpyZbbiSs5' # Register your application with Facebook from https://developers.facebook.com/ - facebook_key: '' - facebook_secret: '' + facebook_key: '574935089296608' + facebook_secret: 'd41ae8396a32c559c4527ab1c8c0d1b2' # Developers do not need to register their application for suse account to work. # You must, however, add some sample value to the variables, for the login option to appear. From bf6b09d9f43f47c822c4450e708bc9bc04a98439 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Thu, 24 Jul 2014 23:18:57 +0300 Subject: [PATCH 2/4] add github for openid login --- Gemfile | 1 + Gemfile.lock | 4 ++++ app/models/user.rb | 2 +- config/initializers/devise.rb | 1 + config/secrets.yml.example | 6 +++++- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 01c8a4f0..9c3eda3f 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,7 @@ gem 'omniauth' gem 'omniauth-facebook' gem 'omniauth-openid' gem 'omniauth-google-oauth2' +gem 'omniauth-github' # Use cancancan as authorization framework gem 'cancancan' diff --git a/Gemfile.lock b/Gemfile.lock index 5c4b58ac..bf7fb167 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -210,6 +210,9 @@ GEM rack (~> 1.0) omniauth-facebook (1.6.0) omniauth-oauth2 (~> 1.1) + omniauth-github (1.1.2) + omniauth (~> 1.0) + omniauth-oauth2 (~> 1.1) omniauth-google-oauth2 (0.2.4) omniauth (~> 1.0) omniauth-oauth2 (~> 1.1) @@ -429,6 +432,7 @@ DEPENDENCIES mysql2 omniauth omniauth-facebook + omniauth-github omniauth-google-oauth2 omniauth-openid paper_trail diff --git a/app/models/user.rb b/app/models/user.rb index 88cd34f7..498cb68c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -7,7 +7,7 @@ class User < ActiveRecord::Base # :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, - :omniauthable, omniauth_providers: [:suse, :google, :facebook] + :omniauthable, omniauth_providers: [:suse, :google, :facebook, :github] has_and_belongs_to_many :roles has_many :openids diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 1caa0d05..7b9ecaa4 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -14,6 +14,7 @@ Devise.setup do |config| name: 'google', scope: 'email' config.omniauth :facebook, Rails.application.secrets.facebook_key, Rails.application.secrets.facebook_secret + config.omniauth :github, Rails.application.secrets.github_key, Rails.application.secrets.github_secret # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, diff --git a/config/secrets.yml.example b/config/secrets.yml.example index f6e1c7ff..9bc47979 100644 --- a/config/secrets.yml.example +++ b/config/secrets.yml.example @@ -45,8 +45,12 @@ production: # For example: #suse_key: 'sample data' #suse_secret: 'sample data' - suse_key: '' suse_secret: '' + + # Register your application with GitHub from https://github.com/settings/applications + github_key: '7e38bdc9408721600e2c' + github_secret: '0290d60c27b1f0b9e88d73551862f6e0136976ba' + # If you add more providers that do not require a key, you still have to create the 2 variables with sample data From 035988a2e10cc8abafe7853fe832457fab674310 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Fri, 25 Jul 2014 12:33:38 +0300 Subject: [PATCH 3/4] remove keys --- config/secrets.yml.example | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/secrets.yml.example b/config/secrets.yml.example index 9bc47979..35984f9a 100644 --- a/config/secrets.yml.example +++ b/config/secrets.yml.example @@ -33,12 +33,12 @@ production: # If you add more providers, keep the format of the variables: provider_key, provider_secret # Register your appllication with Google from https://code.google.com/apis/console#:access - google_key: '458905029210-hhf15fe4cq93i9t88i4r49v3si1avpjr.apps.googleusercontent.com' - google_secret: '-jXIXbaRV9xvdctpyZbbiSs5' + google_key: '' + google_secret: '' # Register your application with Facebook from https://developers.facebook.com/ - facebook_key: '574935089296608' - facebook_secret: 'd41ae8396a32c559c4527ab1c8c0d1b2' + facebook_key: '' + facebook_secret: '' # Developers do not need to register their application for suse account to work. # You must, however, add some sample value to the variables, for the login option to appear. @@ -50,7 +50,7 @@ production: # Register your application with GitHub from https://github.com/settings/applications - github_key: '7e38bdc9408721600e2c' - github_secret: '0290d60c27b1f0b9e88d73551862f6e0136976ba' + github_key: '' + github_secret: '' # If you add more providers that do not require a key, you still have to create the 2 variables with sample data From b1c65eea796512ef8bf2456c87c8c1e6be804c85 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Wed, 6 Aug 2014 22:48:28 +0300 Subject: [PATCH 4/4] style fix --- config/secrets.yml.example | 1 - 1 file changed, 1 deletion(-) diff --git a/config/secrets.yml.example b/config/secrets.yml.example index 35984f9a..5f97b833 100644 --- a/config/secrets.yml.example +++ b/config/secrets.yml.example @@ -48,7 +48,6 @@ production: suse_key: '' suse_secret: '' - # Register your application with GitHub from https://github.com/settings/applications github_key: '' github_secret: ''