doorkeeper_sso 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/sso/notifier.rb +29 -0
- data/app/models/sso/pingback.rb +48 -0
- data/app/models/sso/session.rb +1 -30
- data/db/migrate/20150603145730_add_pingback_uri_to_doorkeeper_applications.rb +5 -0
- data/lib/sso/doorkeeper/authorizations_controller_mixin.rb +6 -6
- data/lib/sso/engine.rb +1 -1
- data/lib/sso/version.rb +1 -1
- data/lib/sso/warden/hooks/after_authentication.rb +3 -3
- data/lib/sso/warden/hooks/before_logout.rb +6 -5
- data/lib/sso/warden/hooks/session_check.rb +6 -6
- data/spec/fabricators/doorkeeper_application_fabricator.rb +1 -0
- data/spec/lib/sso/warden/hooks/after_authentication_spec.rb +30 -31
- data/spec/lib/sso/warden/hooks/before_logout_spec.rb +22 -21
- data/spec/models/sso/pingback_spec.rb +7 -0
- data/spec/models/sso/session_spec.rb +12 -0
- data/spec/test_app/db/schema.rb +50 -1
- metadata +43 -25
- data/lib/sso/engine.rb.orig +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7500d887a41e51199aa7b09c67f0df44cb5357a
|
4
|
+
data.tar.gz: bb586ba0ff4f6874038b91154b67f8fff7fb40a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89194886152c3b7542589c1324fa3336bfb1e571e6dd570077a09743452559470a66fcf31ce23132767ece4e737c5e63add736da6a00b292e28190fcc2d68fa6
|
7
|
+
data.tar.gz: 1376932af7f824a74f533db70d8318aafb5b138933f63ee7a05c5327853536565e0734f55df7e40bf58f9761824721fdcdff819481be6d80503b2e3a6857ad35
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_dependency "api_auth"
|
2
|
+
require_dependency "rest-client"
|
3
|
+
|
4
|
+
module Sso
|
5
|
+
class Notifier
|
6
|
+
|
7
|
+
attr_accessor :url
|
8
|
+
attr_reader :data, :api_id, :api_secret
|
9
|
+
|
10
|
+
def initialize(url, api_id, api_secret, data)
|
11
|
+
@url = url
|
12
|
+
@data = data
|
13
|
+
@api_id = api_id
|
14
|
+
@api_secret = api_secret
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute
|
18
|
+
signed_request.execute
|
19
|
+
end
|
20
|
+
|
21
|
+
def request
|
22
|
+
@request ||= ::RestClient::Request.new(url: url, method: :post, payload: data.to_json, headers: {:content_type => :json, :accept => :json})
|
23
|
+
end
|
24
|
+
|
25
|
+
def signed_request
|
26
|
+
@signed_request ||= ::ApiAuth.sign!(request, api_id, api_secret)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Sso
|
2
|
+
class Pingback
|
3
|
+
include ::Sso::Logging
|
4
|
+
|
5
|
+
attr_reader :user, :warden, :options
|
6
|
+
delegate :request, to: :warden
|
7
|
+
delegate :params, to: :request
|
8
|
+
|
9
|
+
def self.to_proc
|
10
|
+
proc do |user, warden, options|
|
11
|
+
new(user, warden, options).call
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize(user, warden, options)
|
16
|
+
@user, @warden, @options = user, warden, options
|
17
|
+
end
|
18
|
+
|
19
|
+
def call
|
20
|
+
execute if logged_in?
|
21
|
+
end
|
22
|
+
|
23
|
+
def execute
|
24
|
+
return false unless sso_session = ::Sso::Session.find_by_id(session["sso_session_id"])
|
25
|
+
::Doorkeeper::Application.all.each do |app|
|
26
|
+
debug { "Pingback Sso::Pingback for #{app.inspect}" }
|
27
|
+
unless app.pingback_uri.blank?
|
28
|
+
data = ::Sso::SessionSerializer.new(sso_session)
|
29
|
+
debug { data.inspect }
|
30
|
+
notifier = ::Sso::Notifier.new(app.pingback_uri, app.uid, app.secret, data)
|
31
|
+
notifier.execute
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def scope
|
37
|
+
scope = options[:scope]
|
38
|
+
end
|
39
|
+
|
40
|
+
def session
|
41
|
+
warden.session(scope)
|
42
|
+
end
|
43
|
+
|
44
|
+
def logged_in?
|
45
|
+
warden.authenticated?(scope) && session && user
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/app/models/sso/session.rb
CHANGED
@@ -63,43 +63,14 @@ module Sso
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def logout(sso_session_id)
|
66
|
-
session = find_by_id(sso_session_id)
|
67
|
-
return false if session.blank?
|
66
|
+
return false unless session = find_by_id(sso_session_id)
|
68
67
|
session.logout
|
69
68
|
end
|
70
|
-
|
71
|
-
# def update_master_with_grant(master_sso_session_id, oauth_grant)
|
72
|
-
# master_sso_session = active.find(master_sso_session_id)
|
73
|
-
|
74
|
-
# if master_sso_session.update_attribute(:access_grant_id, oauth_grant.id)
|
75
|
-
# debug { "#update_master_with_grant : #{master_sso_session.id} with Access Grant ID #{oauth_grant.id} which is #{oauth_grant.token}" }
|
76
|
-
# else
|
77
|
-
# error { "#update_master_with_grant : FAILED to update oauth_grant" }
|
78
|
-
# end
|
79
|
-
# end
|
80
|
-
|
81
|
-
# def update_master_with_access_token(grant_token, access_token)
|
82
|
-
# oauth_grant = ::Doorkeeper::AccessGrant.by_token(grant_token)
|
83
|
-
# oauth_token = ::Doorkeeper::AccessToken.by_token(access_token)
|
84
|
-
# return false if oauth_token.blank? or oauth_grant.blank?
|
85
|
-
|
86
|
-
# master_sso_session = active.with_grant_id(oauth_grant.id).first
|
87
|
-
|
88
|
-
# if master_sso_session.update_attributes(access_token_id: oauth_token.id, application_id: oauth_token.application_id)
|
89
|
-
# debug { "#register_access_token : #{master_sso_session.id} with Access Token ID #{oauth_token.id} which is #{oauth_token.token}" }
|
90
|
-
# else
|
91
|
-
# error { "#register_access_token : FAILED to update oauth_access_token_id" }
|
92
|
-
# end
|
93
|
-
# master_sso_session
|
94
|
-
# end
|
95
69
|
end
|
96
70
|
|
97
71
|
def create_session(token, options = {})
|
98
72
|
create(access_token_id)
|
99
73
|
end
|
100
|
-
# def to_s
|
101
|
-
# ['Sso:Session', owner_id, ip, activity_at].join ', '
|
102
|
-
# end
|
103
74
|
|
104
75
|
def active?
|
105
76
|
revoked_at.blank?
|
@@ -16,18 +16,18 @@ module Sso
|
|
16
16
|
oauth_grant = code_response.try(:auth).try(:token)
|
17
17
|
|
18
18
|
warden_session = session["warden.user.user.session"]
|
19
|
-
|
19
|
+
sso_session = Sso::Session.find(warden_session["sso_session_id"].to_s)
|
20
20
|
|
21
|
-
if
|
22
|
-
error { "AuthorizationsControllerMixin
|
21
|
+
if !sso_session.try(:active?)
|
22
|
+
error { "ERROR : AuthorizationsControllerMixin - Sso::Session INACTIVE) #{sso_session.inspect}"}
|
23
23
|
warden.logout(:user) and return
|
24
24
|
end
|
25
25
|
|
26
26
|
if oauth_grant
|
27
|
-
debug { "Sso::Session.update_master_with_grant - #{
|
28
|
-
|
27
|
+
debug { "Sso::Session.update_master_with_grant - #{sso_session.id.inspect}, #{oauth_grant.inspect}" }
|
28
|
+
sso_session.clients.find_or_create_by!(access_grant_id: oauth_grant.id)
|
29
29
|
else
|
30
|
-
error { "AuthorizationsControllerMixin - Unable to get grant id"}
|
30
|
+
error { "ERROR : AuthorizationsControllerMixin - Unable to get grant id from #{oauth_grant.inspect}"}
|
31
31
|
warden.logout(:user) and return
|
32
32
|
end
|
33
33
|
end
|
data/lib/sso/engine.rb
CHANGED
@@ -35,7 +35,7 @@ module Sso
|
|
35
35
|
::Warden::Manager.after_authentication(scope: :user, &::Sso::Warden::Hooks::AfterAuthentication.to_proc)
|
36
36
|
::Warden::Manager.before_logout(scope: :user, &::Sso::Warden::Hooks::BeforeLogout.to_proc)
|
37
37
|
|
38
|
-
# TODO :
|
38
|
+
# TODO : Do we want to ensure that session is always active?
|
39
39
|
# ::Warden::Manager.after_fetch(scope: :user, &::Sso::Warden::Hooks::SessionCheck.to_proc)
|
40
40
|
|
41
41
|
# TODO : Why does it need a passport strategy
|
data/lib/sso/version.rb
CHANGED
@@ -10,11 +10,11 @@ module Sso
|
|
10
10
|
|
11
11
|
def self.to_proc
|
12
12
|
proc do |user, warden, options|
|
13
|
-
new(user
|
13
|
+
new(user, warden, options).call
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def initialize(user
|
17
|
+
def initialize(user, warden, options)
|
18
18
|
@user, @warden, @options = user, warden, options
|
19
19
|
end
|
20
20
|
|
@@ -41,7 +41,7 @@ module Sso
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def logged_in?
|
44
|
-
warden.authenticated?(
|
44
|
+
warden.authenticated?(scope) && session && user
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -10,19 +10,20 @@ module Sso
|
|
10
10
|
|
11
11
|
def self.to_proc
|
12
12
|
proc do |user, warden, options|
|
13
|
-
new(user
|
13
|
+
new(user, warden, options).call
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def initialize(user
|
17
|
+
def initialize(user, warden, options)
|
18
18
|
@user, @warden, @options = user, warden, options
|
19
19
|
end
|
20
20
|
|
21
21
|
def call
|
22
22
|
# Only run if user is logged in
|
23
23
|
if logged_in?
|
24
|
-
debug { "
|
25
|
-
|
24
|
+
debug { "#BeforeLogout Sso::Session - #{session["sso_session_id"]}" }
|
25
|
+
debug { "user is #{user.inspect}" }
|
26
|
+
::Sso::Session.logout(session["sso_session_id"])
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
@@ -35,7 +36,7 @@ module Sso
|
|
35
36
|
end
|
36
37
|
|
37
38
|
def logged_in?
|
38
|
-
warden.authenticated?(
|
39
|
+
warden.authenticated?(scope) && session && user
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
@@ -10,11 +10,11 @@ module Sso
|
|
10
10
|
|
11
11
|
def self.to_proc
|
12
12
|
proc do |user, warden, options|
|
13
|
-
new(user
|
13
|
+
new(user, warden, options).call
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def initialize(user
|
17
|
+
def initialize(user, warden, options)
|
18
18
|
@user, @warden, @options = user, warden, options
|
19
19
|
end
|
20
20
|
|
@@ -22,9 +22,9 @@ module Sso
|
|
22
22
|
debug { "Starting hook after user is fetched into the session" }
|
23
23
|
|
24
24
|
# Infinite loop with BeforeLogout - before logout runs this too
|
25
|
-
unless Sso::Session.
|
26
|
-
warden.logout(
|
27
|
-
throw(:warden, :scope => scope, :reason => "Sso::Session
|
25
|
+
unless logged_in? && Sso::Session.find_by_id(session["sso_session_id"]).try(:active?)
|
26
|
+
warden.logout(scope)
|
27
|
+
throw(:warden, :scope => scope, :reason => "Sso::Session INACTIVE")
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -37,7 +37,7 @@ module Sso
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def logged_in?
|
40
|
-
warden.authenticated?(
|
40
|
+
warden.authenticated?(scope) && session && user
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -1,37 +1,36 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
+
# These tests are moot
|
3
4
|
RSpec.describe Sso::Warden::Hooks::AfterAuthentication do
|
4
5
|
#include Warden::Test::Helpers
|
5
6
|
|
6
|
-
let(:user) { Fabricate(:user) }
|
7
|
-
let(:warden_mock) { double }
|
8
|
-
let(:attributes) { { :ip => "202.188.0.133", :agent => "Chrome", format: :json } }
|
9
|
-
|
10
|
-
let(:after_authentication) { Sso::Warden::Hooks::AfterAuthentication.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
let(:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
pending "#call"
|
7
|
+
# let(:user) { Fabricate(:user) }
|
8
|
+
# let(:warden_mock) { double }
|
9
|
+
# let(:attributes) { { :ip => "202.188.0.133", :agent => "Chrome", format: :json } }
|
10
|
+
|
11
|
+
# let(:after_authentication) { Sso::Warden::Hooks::AfterAuthentication.new(user, warden_mock, {:scope => :user}) }
|
12
|
+
|
13
|
+
# let(:master_sso_session) { Sso::Session.generate_master(user, attributes) }
|
14
|
+
# let(:access_token) { Fabricate("Doorkeeper::AccessToken",
|
15
|
+
# resource_owner_id: user.id) }
|
16
|
+
# let(:access_grant) { Fabricate('Doorkeeper::AccessGrant',
|
17
|
+
# resource_owner_id: user.id,
|
18
|
+
# redirect_uri: 'http://localhost:3002/oauth/callback'
|
19
|
+
# ) }
|
20
|
+
|
21
|
+
# before do
|
22
|
+
# master_sso_session.access_token_id = access_token.id
|
23
|
+
# master_sso_session.access_grant_id = access_grant.id
|
24
|
+
# master_sso_session.save
|
25
|
+
# end
|
26
|
+
|
27
|
+
# describe 'attributes' do
|
28
|
+
# it do
|
29
|
+
# expect(after_authentication.user).to eq user
|
30
|
+
# expect(after_authentication.warden).to eq warden_mock
|
31
|
+
# expect(after_authentication.options).to eq({})
|
32
|
+
# end
|
33
|
+
# end
|
34
|
+
|
35
|
+
# pending "#call"
|
37
36
|
end
|
@@ -1,30 +1,31 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
+
# These tests are moot
|
3
4
|
RSpec.describe Sso::Warden::Hooks::BeforeLogout do
|
4
5
|
|
5
|
-
let(:proc) { described_class.to_proc }
|
6
|
-
let(:calling) { proc.call(user, warden, options) }
|
7
|
-
let(:user) { double :user }
|
8
|
-
let(:params) { { passport_id: 1337 } } #passport.id } }
|
9
|
-
let(:options) { double :options }
|
10
|
-
let(:request) { double :request, params: params.stringify_keys }
|
11
|
-
let(:warden) { double :warden, request: request, :session => user }
|
6
|
+
# let(:proc) { described_class.to_proc }
|
7
|
+
# let(:calling) { proc.call(user, warden, options) }
|
8
|
+
# let(:user) { double :user }
|
9
|
+
# let(:params) { { passport_id: 1337 } } #passport.id } }
|
10
|
+
# let(:options) { double :options, scope: :user }
|
11
|
+
# let(:request) { double :request, params: params.stringify_keys }
|
12
|
+
# let(:warden) { double :warden, request: request, :session => user }
|
12
13
|
|
13
|
-
before do
|
14
|
-
|
15
|
-
|
16
|
-
end
|
14
|
+
# before do
|
15
|
+
# allow(warden).to receive(:authenticated?)
|
16
|
+
# Timecop.freeze
|
17
|
+
# end
|
17
18
|
|
18
|
-
describe '.to_proc' do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
19
|
+
# describe '.to_proc' do
|
20
|
+
# it 'is a proc' do
|
21
|
+
# expect(proc).to be_instance_of Proc
|
22
|
+
# end
|
23
|
+
# end
|
23
24
|
|
24
|
-
describe '#call' do
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
25
|
+
# describe '#call' do
|
26
|
+
# it 'accepts the three warden arguments and returns nothing' do
|
27
|
+
# expect(calling).to be_nil
|
28
|
+
# end
|
29
|
+
# end
|
29
30
|
|
30
31
|
end
|
@@ -137,6 +137,18 @@ RSpec.describe Sso::Session, :type => :model do
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
+
describe "::active?" do
|
141
|
+
context "active" do
|
142
|
+
subject(:sso_session) { Fabricate('Sso::Session') }
|
143
|
+
it { expect(sso_session.active?).to be_truthy }
|
144
|
+
end
|
145
|
+
|
146
|
+
context "inactive" do
|
147
|
+
subject(:sso_session) { Fabricate('Sso::Session', revoked_at: Time.now, revoke_reason: "logout") }
|
148
|
+
it { expect(sso_session.active?).to be_falsey }
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
140
152
|
# describe "::update_master_with_grant" do
|
141
153
|
# let(:user) { Fabricate(:user) }
|
142
154
|
# let(:attributes) { { ip: "10.1.1.1", agent: "Safari" } }
|
data/spec/test_app/db/schema.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
# This file is auto-generated from the current state of the database. Instead
|
2
3
|
# of editing this file, please use the migrations feature of Active Record to
|
3
4
|
# incrementally modify your database, and then regenerate this schema definition.
|
@@ -10,7 +11,7 @@
|
|
10
11
|
#
|
11
12
|
# It's strongly recommended that you check this file into your version control system.
|
12
13
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20150603145730) do
|
14
15
|
|
15
16
|
# These are extensions that must be enabled in order to support this database
|
16
17
|
enable_extension "plpgsql"
|
@@ -62,10 +63,58 @@ ActiveRecord::Schema.define(version: 20150519065143) do
|
|
62
63
|
t.string "scopes", default: "", null: false
|
63
64
|
t.datetime "created_at"
|
64
65
|
t.datetime "updated_at"
|
66
|
+
t.text "pingback_uri"
|
65
67
|
end
|
66
68
|
|
67
69
|
add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
|
68
70
|
|
71
|
+
create_table "sso_clients", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
|
72
|
+
t.uuid "sso_session_id"
|
73
|
+
t.integer "access_grant_id"
|
74
|
+
t.integer "access_token_id"
|
75
|
+
t.integer "application_id"
|
76
|
+
t.string "ip"
|
77
|
+
t.string "agent"
|
78
|
+
t.string "location"
|
79
|
+
t.string "device"
|
80
|
+
t.datetime "activity_at"
|
81
|
+
t.datetime "created_at", null: false
|
82
|
+
t.datetime "updated_at", null: false
|
83
|
+
end
|
84
|
+
|
85
|
+
add_index "sso_clients", ["access_grant_id"], name: "index_sso_clients_on_access_grant_id", using: :btree
|
86
|
+
add_index "sso_clients", ["access_token_id"], name: "index_sso_clients_on_access_token_id", using: :btree
|
87
|
+
add_index "sso_clients", ["application_id"], name: "index_sso_clients_on_application_id", using: :btree
|
88
|
+
add_index "sso_clients", ["sso_session_id"], name: "index_sso_clients_on_sso_session_id", using: :btree
|
89
|
+
|
90
|
+
create_table "sso_pingbacks", force: :cascade do |t|
|
91
|
+
t.datetime "created_at", null: false
|
92
|
+
t.datetime "updated_at", null: false
|
93
|
+
end
|
94
|
+
|
95
|
+
create_table "sso_sessions", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
|
96
|
+
t.integer "access_grant_id"
|
97
|
+
t.integer "access_token_id"
|
98
|
+
t.integer "application_id"
|
99
|
+
t.integer "owner_id", null: false
|
100
|
+
t.string "group_id", null: false
|
101
|
+
t.string "secret", null: false
|
102
|
+
t.datetime "activity_at", null: false
|
103
|
+
t.datetime "revoked_at"
|
104
|
+
t.string "revoke_reason"
|
105
|
+
t.datetime "created_at", null: false
|
106
|
+
t.datetime "updated_at", null: false
|
107
|
+
end
|
108
|
+
|
109
|
+
add_index "sso_sessions", ["access_grant_id"], name: "index_sso_sessions_on_access_grant_id", using: :btree
|
110
|
+
add_index "sso_sessions", ["access_token_id"], name: "index_sso_sessions_on_access_token_id", using: :btree
|
111
|
+
add_index "sso_sessions", ["application_id"], name: "index_sso_sessions_on_application_id", using: :btree
|
112
|
+
add_index "sso_sessions", ["group_id"], name: "index_sso_sessions_on_group_id", using: :btree
|
113
|
+
add_index "sso_sessions", ["owner_id", "access_token_id", "application_id"], name: "one_access_token_per_owner", unique: true, where: "((revoked_at IS NULL) AND (access_token_id IS NOT NULL))", using: :btree
|
114
|
+
add_index "sso_sessions", ["owner_id"], name: "index_sso_sessions_on_owner_id", using: :btree
|
115
|
+
add_index "sso_sessions", ["revoke_reason"], name: "index_sso_sessions_on_revoke_reason", using: :btree
|
116
|
+
add_index "sso_sessions", ["secret"], name: "index_sso_sessions_on_secret", using: :btree
|
117
|
+
|
69
118
|
create_table "users", force: :cascade do |t|
|
70
119
|
t.string "email", default: "", null: false
|
71
120
|
t.string "encrypted_password", default: "", null: false
|
metadata
CHANGED
@@ -1,57 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doorkeeper_sso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Wong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: warden
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.2.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: doorkeeper
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
33
|
+
version: '2.0'
|
20
34
|
type: :runtime
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
38
|
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
40
|
+
version: '2.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
42
|
+
name: rails
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
47
|
+
version: '4.0'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '4.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: devise
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '3.4'
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '3.4'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: omniauth-oauth2
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,47 +81,47 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '1.2'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: active_model_serializers
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
89
|
+
version: 0.10.0.rc1
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
96
|
+
version: 0.10.0.rc1
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: api-auth
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- - "
|
101
|
+
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
103
|
+
version: 1.3.1
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- - "
|
108
|
+
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
110
|
+
version: 1.3.1
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: rest-client
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
117
|
+
version: 1.8.0
|
104
118
|
type: :runtime
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
124
|
+
version: 1.8.0
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: database_cleaner
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -307,6 +321,8 @@ files:
|
|
307
321
|
- app/controllers/sso/sessions_controller.rb
|
308
322
|
- app/helpers/sso/application_helper.rb
|
309
323
|
- app/models/sso/client.rb
|
324
|
+
- app/models/sso/notifier.rb
|
325
|
+
- app/models/sso/pingback.rb
|
310
326
|
- app/models/sso/session.rb
|
311
327
|
- app/serializers/sso/owner_serializer.rb
|
312
328
|
- app/serializers/sso/session_serializer.rb
|
@@ -317,6 +333,7 @@ files:
|
|
317
333
|
- db/migrate/20150521102248_create_sso_sessions.rb
|
318
334
|
- db/migrate/20150521142926_create_sso_clients.rb
|
319
335
|
- db/migrate/20150521165143_remove_extra_columns_from_sso_sessions.rb
|
336
|
+
- db/migrate/20150603145730_add_pingback_uri_to_doorkeeper_applications.rb
|
320
337
|
- lib/doorkeeper_sso.rb
|
321
338
|
- lib/sso.rb
|
322
339
|
- lib/sso/doorkeeper/access_grant_mixin.rb
|
@@ -325,7 +342,6 @@ files:
|
|
325
342
|
- lib/sso/doorkeeper/authorizations_controller_mixin.rb
|
326
343
|
- lib/sso/doorkeeper/tokens_controller_mixin.rb
|
327
344
|
- lib/sso/engine.rb
|
328
|
-
- lib/sso/engine.rb.orig
|
329
345
|
- lib/sso/logging.rb
|
330
346
|
- lib/sso/version.rb
|
331
347
|
- lib/sso/warden/hooks/after_authentication.rb
|
@@ -347,6 +363,7 @@ files:
|
|
347
363
|
- spec/lib/sso/warden/hooks/after_authentication_spec.rb
|
348
364
|
- spec/lib/sso/warden/hooks/before_logout_spec.rb
|
349
365
|
- spec/models/sso/client_spec.rb
|
366
|
+
- spec/models/sso/pingback_spec.rb
|
350
367
|
- spec/models/sso/session_spec.rb
|
351
368
|
- spec/rails_helper.rb
|
352
369
|
- spec/spec_helper.rb
|
@@ -404,6 +421,7 @@ test_files:
|
|
404
421
|
- spec/lib/sso/warden/hooks/after_authentication_spec.rb
|
405
422
|
- spec/lib/sso/warden/hooks/before_logout_spec.rb
|
406
423
|
- spec/models/sso/client_spec.rb
|
424
|
+
- spec/models/sso/pingback_spec.rb
|
407
425
|
- spec/models/sso/session_spec.rb
|
408
426
|
- spec/rails_helper.rb
|
409
427
|
- spec/spec_helper.rb
|
data/lib/sso/engine.rb.orig
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
module Sso
|
2
|
-
class Engine < ::Rails::Engine
|
3
|
-
isolate_namespace Sso
|
4
|
-
|
5
|
-
<<<<<<< HEAD
|
6
|
-
# New test framework integration
|
7
|
-
config.generators do |g|
|
8
|
-
g.test_framework :rspec,
|
9
|
-
:fixtures => true,
|
10
|
-
:view_specs => false,
|
11
|
-
:helper_specs => false,
|
12
|
-
:routing_specs => false,
|
13
|
-
:controller_specs => true,
|
14
|
-
:request_specs => false
|
15
|
-
g.fixture_replacement :fabrication
|
16
|
-
=======
|
17
|
-
initializer :append_migrations do |app|
|
18
|
-
unless app.root.to_s.match root.to_s
|
19
|
-
config.paths["db/migrate"].expanded.each do |expanded_path|
|
20
|
-
app.config.paths["db/migrate"] << expanded_path
|
21
|
-
end
|
22
|
-
end
|
23
|
-
>>>>>>> 4400323a20d61fedd59372c74cf3d32e72a52f09
|
24
|
-
end
|
25
|
-
|
26
|
-
config.after_initialize do
|
27
|
-
::Doorkeeper::Application.send(:include, Sso::Doorkeeper::ApplicationMixin)
|
28
|
-
::Doorkeeper::AccessGrant.send(:include, Sso::Doorkeeper::AccessGrantMixin)
|
29
|
-
::Doorkeeper::AccessToken.send(:include, Sso::Doorkeeper::AccessTokenMixin)
|
30
|
-
|
31
|
-
|
32
|
-
::Doorkeeper::TokensController.send(:include, AbstractController::Callbacks)
|
33
|
-
::Doorkeeper::TokensController.send(:include, Sso::Doorkeeper::TokensControllerMixin)
|
34
|
-
::Doorkeeper::AuthorizationsController.send(:include, Sso::Doorkeeper::AuthorizationsControllerMixin)
|
35
|
-
|
36
|
-
::Warden::Manager.after_authentication(scope: :user, &::Sso::Warden::Hooks::AfterAuthentication.to_proc)
|
37
|
-
::Warden::Manager.before_logout(scope: :user, &::Sso::Warden::Hooks::BeforeLogout.to_proc)
|
38
|
-
|
39
|
-
# TODO : Infinite loop with before_logout
|
40
|
-
# ::Warden::Manager.after_fetch(scope: :user, &::Sso::Warden::Hooks::SessionCheck.to_proc)
|
41
|
-
|
42
|
-
# TODO : Why does it need a passport strategy
|
43
|
-
# Warden::Strategies.add :passport, ::Sso::Server::Warden::Strategies::Passport
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|