doorkeeper_hub 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/doorkeeper_hub/engine.rb +2 -0
- data/lib/doorkeeper_hub/helpers.rb +43 -0
- data/lib/doorkeeper_hub/routes.rb +14 -0
- data/lib/doorkeeper_hub/version.rb +1 -1
- data/lib/doorkeeper_hub.rb +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfb7d97ee1cdf3f2b3348d1d5cef1fb7100ccc4db37863111ce6e8f2554a2ebf
|
4
|
+
data.tar.gz: 59c9fe7dd9c9d1d62063d1d0f162c4d42405a7372fc6e8d8a3ca127caaf522f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e381ab5e9a1b0aebeed72bb03d4688ace0e3f2472ec35f8b0ff30b10d1c86f07659e422da68197bc45ece332e61a9d741dd1475f8b7bebf1d5e2bf45d86c349
|
7
|
+
data.tar.gz: ab70a67c61aef22707756fb540c2702d8916a401b278cafd01a727e4ac7e80444b7022079156d30f86be2a8a6973b174dd3b45ed983d2efae79e508e4e7ccae9
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module DoorkeeperHub
|
2
|
+
module Helpers
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
before_action :check_login!, :check_d_token
|
7
|
+
end
|
8
|
+
|
9
|
+
def check_login!
|
10
|
+
redirect_to user_saml_omniauth_authorize_path unless user_signed_in?
|
11
|
+
end
|
12
|
+
|
13
|
+
def company
|
14
|
+
@company ||=
|
15
|
+
current_user.companies.active.find_by(doorkeeper_token: params[:d_token]) ||
|
16
|
+
raise(ActionController::RoutingError.new('Not Found'))
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def check_login!
|
21
|
+
redirect_to user_saml_omniauth_authorize_path unless user_signed_in?
|
22
|
+
end
|
23
|
+
|
24
|
+
def after_sign_in_path_for(current_user)
|
25
|
+
root_path(d_token: params_or_default_d_token)
|
26
|
+
end
|
27
|
+
|
28
|
+
def default_url_options(options = {})
|
29
|
+
options[:d_token] = params[:d_token]
|
30
|
+
options
|
31
|
+
end
|
32
|
+
|
33
|
+
def check_d_token
|
34
|
+
if params[:d_token].nil? && current_user.present?
|
35
|
+
redirect_to root_path d_token: params_or_default_d_token
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def params_or_default_d_token
|
40
|
+
params[:d_token] || current_user.companies.first.doorkeeper_token
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/doorkeeper_hub.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doorkeeper_hub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Fan
|
@@ -88,6 +88,8 @@ files:
|
|
88
88
|
- lib/doorkeeper_hub.rb
|
89
89
|
- lib/doorkeeper_hub/configurator.rb
|
90
90
|
- lib/doorkeeper_hub/engine.rb
|
91
|
+
- lib/doorkeeper_hub/helpers.rb
|
92
|
+
- lib/doorkeeper_hub/routes.rb
|
91
93
|
- lib/doorkeeper_hub/saml.rb
|
92
94
|
- lib/doorkeeper_hub/version.rb
|
93
95
|
homepage: https://devhub.co
|