Skip to content

Commit

Permalink
update to omniauth 1.0 and omniauth-saml gem.
Browse files Browse the repository at this point in the history
* update to rails 3.1 and latest gem versions.
* use activerecord session store. some saml server responses overflow the cookie store.
  • Loading branch information
rajiv committed Feb 20, 2012
1 parent 9a81c95 commit 01b3e67
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 141 deletions.
10 changes: 5 additions & 5 deletions Gemfile
@@ -1,12 +1,12 @@
source 'http://rubygems.org'

gem 'rails', '3.1.0.rc4'
gem 'rails', '3.1.2'
gem 'sqlite3'
gem 'sass-rails', "~> 3.1.0.rc"
gem 'sass-rails', "~> 3.1.2"
gem 'uglifier'
gem 'jquery-rails'
gem 'uuid'
gem 'omniauth', :git => 'https://github.com/raecoo/omniauth.git'
gem 'omniauth'
gem 'omniauth-saml'

group :development do
gem 'ruby-debug19'
Expand All @@ -15,4 +15,4 @@ end
group :production do
gem 'therubyracer-heroku', '0.8.1.pre3'
gem 'pg'
end
end
203 changes: 74 additions & 129 deletions Gemfile.lock
@@ -1,148 +1,97 @@
GIT
remote: https://github.com/raecoo/omniauth.git
revision: 3079ffcdaefcbc0ed588bd1d24ee39da9940a058
specs:
oa-basic (0.3.0.rc1)
oa-core (= 0.3.0.rc1)
rest-client (~> 1.6.0)
oa-core (0.3.0.rc1)
oa-enterprise (0.3.0.rc1)
XMLCanonicalizer (~> 1.0.1)
addressable (~> 2.2.6)
net-ldap (~> 0.2.2)
nokogiri (~> 1.5.0)
oa-core (= 0.3.0.rc1)
pyu-ruby-sasl (~> 0.0.3.1)
rubyntlm (~> 0.1.1)
oa-more (0.3.0.rc1)
multi_json (~> 1.0.0)
oa-core (= 0.3.0.rc1)
rest-client (~> 1.6.0)
oa-oauth (0.3.0.rc1)
faraday (~> 0.7.3)
multi_json (~> 1.0.0)
multi_xml (~> 0.3.0)
oa-core (= 0.3.0.rc1)
oauth (~> 0.4.0)
oauth2 (~> 0.5.0)
oa-openid (0.3.0.rc1)
oa-core (= 0.3.0.rc1)
rack-openid (~> 1.3.1)
ruby-openid-apps-discovery (~> 1.2.0)
omniauth (0.3.0.rc1)
oa-basic (= 0.3.0.rc1)
oa-core (= 0.3.0.rc1)
oa-enterprise (= 0.3.0.rc1)
oa-more (= 0.3.0.rc1)
oa-oauth (= 0.3.0.rc1)
oa-openid (= 0.3.0.rc1)

GEM
remote: http://rubygems.org/
specs:
XMLCanonicalizer (1.0.1)
log4r (>= 1.0.4)
actionmailer (3.1.0.rc4)
actionpack (= 3.1.0.rc4)
actionmailer (3.1.2)
actionpack (= 3.1.2)
mail (~> 2.3.0)
actionpack (3.1.0.rc4)
activemodel (= 3.1.0.rc4)
activesupport (= 3.1.0.rc4)
actionpack (3.1.2)
activemodel (= 3.1.2)
activesupport (= 3.1.2)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.0)
rack-cache (~> 1.0.1)
rack-mount (~> 0.8.1)
rack-test (~> 0.6.0)
sprockets (~> 2.0.0.beta.10)
tzinfo (~> 0.3.27)
activemodel (3.1.0.rc4)
activesupport (= 3.1.0.rc4)
bcrypt-ruby (~> 2.1.4)
rack (~> 1.3.5)
rack-cache (~> 1.1)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.0)
activemodel (3.1.2)
activesupport (= 3.1.2)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.0.rc4)
activemodel (= 3.1.0.rc4)
activesupport (= 3.1.0.rc4)
arel (~> 2.1.1)
tzinfo (~> 0.3.27)
activeresource (3.1.0.rc4)
activemodel (= 3.1.0.rc4)
activesupport (= 3.1.0.rc4)
activesupport (3.1.0.rc4)
activerecord (3.1.2)
activemodel (= 3.1.2)
activesupport (= 3.1.2)
arel (~> 2.2.1)
tzinfo (~> 0.3.29)
activeresource (3.1.2)
activemodel (= 3.1.2)
activesupport (= 3.1.2)
activesupport (3.1.2)
multi_json (~> 1.0)
addressable (2.2.6)
archive-tar-minitar (0.5.2)
arel (2.1.4)
bcrypt-ruby (2.1.4)
arel (2.2.1)
builder (3.0.0)
columnize (0.3.4)
columnize (0.3.6)
erubis (2.7.0)
execjs (1.2.4)
execjs (1.3.0)
multi_json (~> 1.0)
faraday (0.7.4)
addressable (~> 2.2.6)
multipart-post (~> 1.1.0)
rack (< 2, >= 1.1.0)
hashie (1.2.0)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.13)
jquery-rails (1.0.19)
railties (~> 3.0)
thor (~> 0.14)
json (1.6.5)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
log4r (1.1.9)
macaddr (1.4.0)
systemu (~> 2.2.0)
log4r (1.1.10)
macaddr (1.5.0)
systemu (>= 2.4.0)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
multi_json (1.0.3)
multi_xml (0.3.0)
multipart-post (1.1.3)
net-ldap (0.2.2)
nokogiri (1.5.0)
oauth (0.4.5)
oauth2 (0.5.0)
faraday (< 0.8, >= 0.6.1)
multi_json (~> 1.0.0)
pg (0.11.0)
polyglot (0.3.2)
pyu-ruby-sasl (0.0.3.3)
rack (1.3.2)
rack-cache (1.0.3)
mime-types (1.17.2)
multi_json (1.0.4)
omniauth (1.0.2)
hashie (~> 1.2)
rack
omniauth-saml (0.9.0)
XMLCanonicalizer (~> 1.0.1)
omniauth (~> 1.0)
uuid (~> 2.3)
pg (0.13.1)
polyglot (0.3.3)
rack (1.3.6)
rack-cache (1.1)
rack (>= 0.4)
rack-mount (0.8.2)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-openid (1.3.1)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.1.0.rc4)
actionmailer (= 3.1.0.rc4)
actionpack (= 3.1.0.rc4)
activerecord (= 3.1.0.rc4)
activeresource (= 3.1.0.rc4)
activesupport (= 3.1.0.rc4)
rails (3.1.2)
actionmailer (= 3.1.2)
actionpack (= 3.1.2)
activerecord (= 3.1.2)
activeresource (= 3.1.2)
activesupport (= 3.1.2)
bundler (~> 1.0)
railties (= 3.1.0.rc4)
railties (3.1.0.rc4)
actionpack (= 3.1.0.rc4)
activesupport (= 3.1.0.rc4)
railties (= 3.1.2)
railties (3.1.2)
actionpack (= 3.1.2)
activesupport (= 3.1.2)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2)
rdoc (3.9.4)
rest-client (1.6.7)
mime-types (>= 1.16)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
ruby-debug-base19 (0.11.25)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
Expand All @@ -151,48 +100,44 @@ GEM
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
ruby-openid (2.1.8)
ruby-openid-apps-discovery (1.2.0)
ruby-openid (>= 2.1.7)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
rubyntlm (0.1.1)
sass (3.1.7)
sass-rails (3.1.0.rc.5)
actionpack (~> 3.1.0.rc1)
railties (~> 3.1.0.rc1)
sass (>= 3.1.4)
sprockets (>= 2.0.0.beta.9)
sprockets (2.0.0.beta.15)
sass (3.1.15)
sass-rails (3.1.5)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass (~> 3.1.10)
tilt (~> 1.3.2)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (!= 1.3.0, ~> 1.1)
sqlite3 (1.3.4)
systemu (2.2.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.5)
systemu (2.4.2)
therubyracer-heroku (0.8.1.pre3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.29)
uglifier (1.0.2)
tzinfo (0.3.31)
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
uuid (2.3.3)
uuid (2.3.5)
macaddr (~> 1.0)

PLATFORMS
ruby

DEPENDENCIES
jquery-rails
omniauth!
omniauth
omniauth-saml
pg
rails (= 3.1.0.rc4)
rails (= 3.1.2)
ruby-debug19
sass-rails (~> 3.1.0.rc)
sass-rails (~> 3.1.2)
sqlite3
therubyracer-heroku (= 0.8.1.pre3)
uglifier
uuid
3 changes: 0 additions & 3 deletions app/views/layouts/application.html.erb
Expand Up @@ -9,9 +9,6 @@
<div style="width:500px;margin:50px auto;">
<h1 style='border-bottom:1px solid #999'>SAML Strategy for OmniAuth</h1>
<%= yield %>
<p style='font-size:12px;color:#666'>
Thanks for the <a href='http://www.onelogin.com' target='_blank'>OneLogin</a> provides the SAML service.
</p>
</div>
</body>
</html>
4 changes: 2 additions & 2 deletions config/initializers/omniauth.rb
@@ -1,9 +1,9 @@
Rails.application.config.middleware.use OmniAuth::Builder do
provider :SAML, {
provider :saml, {
:assertion_consumer_service_url => "http://...",
:issuer => "https://...",
:idp_sso_target_url => "https://...",
:idp_cert_fingerprint => "E7:91:B2:E1:...",
:name_identifier_format => "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
}
end
end
4 changes: 2 additions & 2 deletions config/initializers/session_store.rb
@@ -1,8 +1,8 @@
# Be sure to restart your server when you modify this file.

Saml::Application.config.session_store :cookie_store, key: '_saml_session'
# Saml::Application.config.session_store :cookie_store, key: '_saml_session'

# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Saml::Application.config.session_store :active_record_store
Saml::Application.config.session_store :active_record_store, :key => '_saml_session'
16 changes: 16 additions & 0 deletions db/migrate/20120203171107_add_sessions_table.rb
@@ -0,0 +1,16 @@
class AddSessionsTable < ActiveRecord::Migration
def up
create_table :sessions do |t|
t.string :session_id, :null => false
t.text :data
t.timestamps
end

add_index :sessions, :session_id
add_index :sessions, :updated_at
end

def down
drop_table :sessions
end
end
26 changes: 26 additions & 0 deletions db/schema.rb
@@ -0,0 +1,26 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20120203171107) do

create_table "sessions", :force => true do |t|
t.string "session_id", :null => false
t.text "data"
t.datetime "created_at"
t.datetime "updated_at"
end

add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"

end

0 comments on commit 01b3e67

Please sign in to comment.