doorkeeper_sso 0.4.6 → 0.4.8
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/client.rb +0 -7
- data/app/serializers/sso/client_serializer.rb +1 -1
- data/db/migrate/20151030064515_add_device_information_to_sso_clients.rb +0 -6
- data/db/migrate/20151221071537_remove_random_token_from_sso_clients.rb +7 -0
- data/lib/sso/version.rb +1 -1
- data/spec/api/schemas/error.json +9 -0
- data/spec/api/schemas/session.json +1 -3
- data/spec/api/schemas/sso_session_id.json +9 -0
- data/spec/models/sso/client_spec.rb +0 -9
- data/spec/test_app/db/schema.rb +1 -2
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 229918057255c549df3c4f5f01fb54df4710c160
|
4
|
+
data.tar.gz: 42ddf70c03c67529561f1cfb35fc055c409baa9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44c906adddda2b0b95057f4eac2e699d3c470400c4e681b32eb6408ee4ffcf21708c361288c4788d74781a05b77fd55f308a732561d880aa457abddbdf8b5f6d
|
7
|
+
data.tar.gz: 1ab043955e3b4375a7bccd034f5f67e0d45f48b8c23fe401aba653a6aac4a11e0f3231b690a04b91413e1009df172b58709c6a6d966f73b2f258a0b51a75ed17
|
data/app/models/sso/client.rb
CHANGED
@@ -13,8 +13,6 @@ module Sso
|
|
13
13
|
scope :with_access_grant, -> { where.not(access_grant: nil) }
|
14
14
|
scope :with_access_token, -> { where.not(access_token: nil) }
|
15
15
|
|
16
|
-
before_save :ensure_random_token
|
17
|
-
|
18
16
|
class << self
|
19
17
|
def find_by_grant_token(token)
|
20
18
|
find_by(access_grant: ::Doorkeeper::AccessGrant.by_token(token))
|
@@ -34,10 +32,5 @@ module Sso
|
|
34
32
|
return false unless oauth_token = ::Doorkeeper::AccessToken.by_token(token)
|
35
33
|
update(access_token_id: oauth_token.id, application_id: oauth_token.application.id)
|
36
34
|
end
|
37
|
-
|
38
|
-
private
|
39
|
-
def ensure_random_token
|
40
|
-
self.random_token ||= SecureRandom.hex
|
41
|
-
end
|
42
35
|
end
|
43
36
|
end
|
@@ -3,7 +3,7 @@ module Sso
|
|
3
3
|
delegate :id, :active?, :revoked_at, :revoke_reason, :secret, to: :session
|
4
4
|
|
5
5
|
attribute :id, :key => :client_id
|
6
|
-
attributes :id, :active?, :revoked_at, :revoke_reason, :secret
|
6
|
+
attributes :id, :active?, :revoked_at, :revoke_reason, :secret
|
7
7
|
|
8
8
|
|
9
9
|
belongs_to :owner, serializer: Sso::OwnerSerializer # WTH : hack to load owner using serializer
|
@@ -6,11 +6,5 @@ class AddDeviceInformationToSsoClients < ActiveRecord::Migration
|
|
6
6
|
t.string "device_model"
|
7
7
|
t.string "random_token"
|
8
8
|
end
|
9
|
-
|
10
|
-
Sso::Client.find_each do |client|
|
11
|
-
client.save
|
12
|
-
end
|
13
|
-
|
14
|
-
change_column :sso_clients, :random_token, :string, :null => true
|
15
9
|
end
|
16
10
|
end
|
data/lib/sso/version.rb
CHANGED
@@ -5,8 +5,7 @@
|
|
5
5
|
"id",
|
6
6
|
"active?",
|
7
7
|
"secret",
|
8
|
-
"owner"
|
9
|
-
"random_token"
|
8
|
+
"owner"
|
10
9
|
],
|
11
10
|
"properties": {
|
12
11
|
"client_id" : { "type" : "string" },
|
@@ -15,7 +14,6 @@
|
|
15
14
|
"revoked_at" : { "type": ["string", "null"], "format": "date-time" },
|
16
15
|
"revoke_reason" : { "type": ["string", "null"] },
|
17
16
|
"secret" : { "type" : "string" },
|
18
|
-
"random_token" : { "type" : "string" },
|
19
17
|
"owner" : {
|
20
18
|
"type" : "object",
|
21
19
|
"required" : [
|
@@ -56,13 +56,4 @@ RSpec.describe Sso::Client, :type => :model do
|
|
56
56
|
expect(client.access_token).to eq access_token
|
57
57
|
end
|
58
58
|
end
|
59
|
-
|
60
|
-
describe "#ensure_random_token" do
|
61
|
-
subject!(:client) { Fabricate('Sso::Client', session: session,
|
62
|
-
application_id: application.id,
|
63
|
-
access_grant_id: access_grant.id) }
|
64
|
-
|
65
|
-
it { expect(client.random_token).not_to be_blank }
|
66
|
-
end
|
67
|
-
|
68
59
|
end
|
data/spec/test_app/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20151221071537) do
|
15
15
|
|
16
16
|
# These are extensions that must be enabled in order to support this database
|
17
17
|
enable_extension "plpgsql"
|
@@ -83,7 +83,6 @@ ActiveRecord::Schema.define(version: 20151104090509) do
|
|
83
83
|
t.string "device_os"
|
84
84
|
t.string "device_os_version"
|
85
85
|
t.string "device_model"
|
86
|
-
t.string "random_token", null: false
|
87
86
|
end
|
88
87
|
|
89
88
|
add_index "sso_clients", ["access_grant_id"], name: "index_sso_clients_on_access_grant_id", using: :btree
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doorkeeper_sso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
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-
|
11
|
+
date: 2015-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: warden
|
@@ -351,6 +351,7 @@ files:
|
|
351
351
|
- db/migrate/20150603145730_add_pingback_uri_to_doorkeeper_applications.rb
|
352
352
|
- db/migrate/20151030064515_add_device_information_to_sso_clients.rb
|
353
353
|
- db/migrate/20151104090509_remove_group_id_from_sessions.rb
|
354
|
+
- db/migrate/20151221071537_remove_random_token_from_sso_clients.rb
|
354
355
|
- lib/doorkeeper_sso.rb
|
355
356
|
- lib/sso.rb
|
356
357
|
- lib/sso/doorkeeper/access_grant_mixin.rb
|
@@ -371,7 +372,9 @@ files:
|
|
371
372
|
- lib/sso/warden/hooks/session_check.rb
|
372
373
|
- lib/sso/warden/support.rb
|
373
374
|
- lib/tasks/sso_tasks.rake
|
375
|
+
- spec/api/schemas/error.json
|
374
376
|
- spec/api/schemas/session.json
|
377
|
+
- spec/api/schemas/sso_session_id.json
|
375
378
|
- spec/controllers/sso/sessions_controller_spec.rb
|
376
379
|
- spec/fabricators/api_application_fabricator.rb
|
377
380
|
- spec/fabricators/doorkeeper_access_grant_fabricator.rb
|
@@ -431,7 +434,9 @@ signing_key:
|
|
431
434
|
specification_version: 4
|
432
435
|
summary: Leveraging Doorkeeper as single-sign-on OAuth server.
|
433
436
|
test_files:
|
437
|
+
- spec/api/schemas/error.json
|
434
438
|
- spec/api/schemas/session.json
|
439
|
+
- spec/api/schemas/sso_session_id.json
|
435
440
|
- spec/controllers/sso/sessions_controller_spec.rb
|
436
441
|
- spec/fabricators/api_application_fabricator.rb
|
437
442
|
- spec/fabricators/doorkeeper_access_grant_fabricator.rb
|