doorkeeper_hub 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/routes.rb +3 -1
- data/lib/doorkeeper_hub/configurator.rb +2 -0
- data/lib/doorkeeper_hub/helpers.rb +5 -1
- data/lib/doorkeeper_hub/saml.rb +5 -3
- data/lib/doorkeeper_hub/version.rb +1 -1
- data/lib/doorkeeper_hub.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2003e63a8f06385f671a2d721627f464a1674ab5d5c59133f0bbd4ce0a330b07
|
4
|
+
data.tar.gz: cdc61a7e345792ba6237786b1d890cfa55be0d3d03775292a102ce03a5dcfed0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb1be655cc62257997527740ce6cd1fcf32cb194ea2acb75bb03f316c780cf708579b7ddf87cebd83293de561fbbc1a64d2b43ab05e42c2ee0b5583a952e8cd3
|
7
|
+
data.tar.gz: 81833e76cce3e967975c4010c8c4c1fa15a0a138df04bc0c672d601f158b6a2c680669449e0edd7471bcb4e97eb7b46f048adbf02d891c8fab04894ab52993ca
|
data/config/routes.rb
CHANGED
@@ -4,5 +4,7 @@ Rails.application.routes.draw do
|
|
4
4
|
omniauth_callbacks: 'doorkeeper_hub/omniauth_callbacks'
|
5
5
|
}
|
6
6
|
|
7
|
-
|
7
|
+
unless DoorkeeperHub.client_mode?
|
8
|
+
post 'doorkeeper/activation', to: 'doorkeeper_hub/callbacks#activation'
|
9
|
+
end
|
8
10
|
end
|
@@ -4,12 +4,14 @@ module DoorkeeperHub
|
|
4
4
|
attr_accessor :scope_model
|
5
5
|
attr_accessor :user_model
|
6
6
|
attr_accessor :doorkeeper_token_name
|
7
|
+
attr_accessor :client_mode
|
7
8
|
|
8
9
|
def initialize
|
9
10
|
self.service_token = ENV["SERVICE_TOKEN"]
|
10
11
|
self.scope_model = ::Company
|
11
12
|
self.user_model = ::User
|
12
13
|
self.doorkeeper_token_name = :doorkeeper_token
|
14
|
+
self.client_mode = false
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -3,11 +3,13 @@ module DoorkeeperHub
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
before_action :authenticate_doorkeeper
|
6
|
+
before_action :authenticate_doorkeeper!, unless: -> { DoorkeeperHub.client_mode? }
|
7
7
|
end
|
8
8
|
|
9
9
|
def authenticate_doorkeeper!
|
10
10
|
if signed_in?(DoorkeeperHub.devise_scope)
|
11
|
+
return if DoorkeeperHub.client_mode?
|
12
|
+
|
11
13
|
redirect_to root_path_with_token if params[DoorkeeperHub.token_param].nil?
|
12
14
|
else
|
13
15
|
redirect_to omniauth_authorize_path(
|
@@ -18,6 +20,8 @@ module DoorkeeperHub
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def default_url_options(options = {})
|
23
|
+
return options if DoorkeeperHub.client_mode?
|
24
|
+
|
21
25
|
options[DoorkeeperHub.token_param] = params[DoorkeeperHub.token_param]
|
22
26
|
options
|
23
27
|
end
|
data/lib/doorkeeper_hub/saml.rb
CHANGED
@@ -10,14 +10,16 @@ module DoorkeeperHub
|
|
10
10
|
|
11
11
|
class_methods do
|
12
12
|
def from_omniauth(auth)
|
13
|
-
return if scope_results(auth).empty?
|
13
|
+
return if DoorkeeperHub.client_mode? && scope_results(auth).empty?
|
14
14
|
|
15
15
|
user = where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
|
16
16
|
user.email = auth.info.email
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
unless DoorkeeperHub.client_mode?
|
20
|
+
scope_results(auth).each do |result|
|
21
|
+
user.users_companies.find_or_create_by(company: result)
|
22
|
+
end
|
21
23
|
end
|
22
24
|
|
23
25
|
user
|
data/lib/doorkeeper_hub.rb
CHANGED