keycloak-api-rails 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Dockerfile +1 -1
- data/Gemfile.lock +71 -70
- data/README.md +2 -1
- data/lib/keycloak-api-rails/authentication.rb +6 -20
- data/lib/keycloak-api-rails/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dc85b0700082d2d2a0ac3e85cf582481e5c4f314831e8b6dfcb528f082cb06f8
|
|
4
|
+
data.tar.gz: 7b1e40233abd17a16a6fe292cb7de97d4ffb99cb097c7dfea1f7582124ab8f46
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ec86c805549cb170f3c7bc5cd426e3259532a67e749da24821fa0a6a70b8490802ea8445ed4f8e44f129b22ea745ba1f407c901538731ee271215cadebdde8c
|
|
7
|
+
data.tar.gz: ddd4010fae25886bded42e92eca32509540450f313c0e943dee711d14ece540cad5c03ae13a1882358e9f221a07ae723d72f7ed0ca2ab3d508b8ee4ce2e15667
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.12.2] - 2023-06-03
|
|
9
|
+
|
|
10
|
+
* Avoid methods `logger`, `service` an `config` of `Keycloak::Authentication` to conflict with other concerns, such as rails. (thanks to @mkrawc)
|
|
11
|
+
|
|
8
12
|
## [0.12.1] - 2023-04-15
|
|
9
13
|
|
|
10
14
|
* Fixes for opt-in mode (#48) (thanks to @theSteveMitchell)
|
data/Dockerfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
keycloak-api-rails (0.12.
|
|
4
|
+
keycloak-api-rails (0.12.2)
|
|
5
5
|
json-jwt (>= 1.11.0)
|
|
6
6
|
rails (>= 4.2)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
actioncable (7.0.
|
|
12
|
-
actionpack (= 7.0.
|
|
13
|
-
activesupport (= 7.0.
|
|
11
|
+
actioncable (7.0.5)
|
|
12
|
+
actionpack (= 7.0.5)
|
|
13
|
+
activesupport (= 7.0.5)
|
|
14
14
|
nio4r (~> 2.0)
|
|
15
15
|
websocket-driver (>= 0.6.1)
|
|
16
|
-
actionmailbox (7.0.
|
|
17
|
-
actionpack (= 7.0.
|
|
18
|
-
activejob (= 7.0.
|
|
19
|
-
activerecord (= 7.0.
|
|
20
|
-
activestorage (= 7.0.
|
|
21
|
-
activesupport (= 7.0.
|
|
16
|
+
actionmailbox (7.0.5)
|
|
17
|
+
actionpack (= 7.0.5)
|
|
18
|
+
activejob (= 7.0.5)
|
|
19
|
+
activerecord (= 7.0.5)
|
|
20
|
+
activestorage (= 7.0.5)
|
|
21
|
+
activesupport (= 7.0.5)
|
|
22
22
|
mail (>= 2.7.1)
|
|
23
23
|
net-imap
|
|
24
24
|
net-pop
|
|
25
25
|
net-smtp
|
|
26
|
-
actionmailer (7.0.
|
|
27
|
-
actionpack (= 7.0.
|
|
28
|
-
actionview (= 7.0.
|
|
29
|
-
activejob (= 7.0.
|
|
30
|
-
activesupport (= 7.0.
|
|
26
|
+
actionmailer (7.0.5)
|
|
27
|
+
actionpack (= 7.0.5)
|
|
28
|
+
actionview (= 7.0.5)
|
|
29
|
+
activejob (= 7.0.5)
|
|
30
|
+
activesupport (= 7.0.5)
|
|
31
31
|
mail (~> 2.5, >= 2.5.4)
|
|
32
32
|
net-imap
|
|
33
33
|
net-pop
|
|
34
34
|
net-smtp
|
|
35
35
|
rails-dom-testing (~> 2.0)
|
|
36
|
-
actionpack (7.0.
|
|
37
|
-
actionview (= 7.0.
|
|
38
|
-
activesupport (= 7.0.
|
|
39
|
-
rack (~> 2.0, >= 2.2.
|
|
36
|
+
actionpack (7.0.5)
|
|
37
|
+
actionview (= 7.0.5)
|
|
38
|
+
activesupport (= 7.0.5)
|
|
39
|
+
rack (~> 2.0, >= 2.2.4)
|
|
40
40
|
rack-test (>= 0.6.3)
|
|
41
41
|
rails-dom-testing (~> 2.0)
|
|
42
42
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
43
|
-
actiontext (7.0.
|
|
44
|
-
actionpack (= 7.0.
|
|
45
|
-
activerecord (= 7.0.
|
|
46
|
-
activestorage (= 7.0.
|
|
47
|
-
activesupport (= 7.0.
|
|
43
|
+
actiontext (7.0.5)
|
|
44
|
+
actionpack (= 7.0.5)
|
|
45
|
+
activerecord (= 7.0.5)
|
|
46
|
+
activestorage (= 7.0.5)
|
|
47
|
+
activesupport (= 7.0.5)
|
|
48
48
|
globalid (>= 0.6.0)
|
|
49
49
|
nokogiri (>= 1.8.5)
|
|
50
|
-
actionview (7.0.
|
|
51
|
-
activesupport (= 7.0.
|
|
50
|
+
actionview (7.0.5)
|
|
51
|
+
activesupport (= 7.0.5)
|
|
52
52
|
builder (~> 3.1)
|
|
53
53
|
erubi (~> 1.4)
|
|
54
54
|
rails-dom-testing (~> 2.0)
|
|
55
55
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
56
|
-
activejob (7.0.
|
|
57
|
-
activesupport (= 7.0.
|
|
56
|
+
activejob (7.0.5)
|
|
57
|
+
activesupport (= 7.0.5)
|
|
58
58
|
globalid (>= 0.3.6)
|
|
59
|
-
activemodel (7.0.
|
|
60
|
-
activesupport (= 7.0.
|
|
61
|
-
activerecord (7.0.
|
|
62
|
-
activemodel (= 7.0.
|
|
63
|
-
activesupport (= 7.0.
|
|
64
|
-
activestorage (7.0.
|
|
65
|
-
actionpack (= 7.0.
|
|
66
|
-
activejob (= 7.0.
|
|
67
|
-
activerecord (= 7.0.
|
|
68
|
-
activesupport (= 7.0.
|
|
59
|
+
activemodel (7.0.5)
|
|
60
|
+
activesupport (= 7.0.5)
|
|
61
|
+
activerecord (7.0.5)
|
|
62
|
+
activemodel (= 7.0.5)
|
|
63
|
+
activesupport (= 7.0.5)
|
|
64
|
+
activestorage (7.0.5)
|
|
65
|
+
actionpack (= 7.0.5)
|
|
66
|
+
activejob (= 7.0.5)
|
|
67
|
+
activerecord (= 7.0.5)
|
|
68
|
+
activesupport (= 7.0.5)
|
|
69
69
|
marcel (~> 1.0)
|
|
70
70
|
mini_mime (>= 1.1.0)
|
|
71
|
-
activesupport (7.0.
|
|
71
|
+
activesupport (7.0.5)
|
|
72
72
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
73
73
|
i18n (>= 1.6, < 2)
|
|
74
74
|
minitest (>= 5.1)
|
|
@@ -82,7 +82,7 @@ GEM
|
|
|
82
82
|
date (3.3.3)
|
|
83
83
|
diff-lcs (1.5.0)
|
|
84
84
|
erubi (1.12.0)
|
|
85
|
-
faraday (2.7.
|
|
85
|
+
faraday (2.7.5)
|
|
86
86
|
faraday-net_http (>= 2.0, < 3.1)
|
|
87
87
|
ruby2_keywords (>= 0.0.4)
|
|
88
88
|
faraday-follow_redirects (0.3.0)
|
|
@@ -90,7 +90,7 @@ GEM
|
|
|
90
90
|
faraday-net_http (3.0.2)
|
|
91
91
|
globalid (1.1.0)
|
|
92
92
|
activesupport (>= 5.0)
|
|
93
|
-
i18n (1.
|
|
93
|
+
i18n (1.14.0)
|
|
94
94
|
concurrent-ruby (~> 1.0)
|
|
95
95
|
json-jwt (1.16.3)
|
|
96
96
|
activesupport (>= 4.2)
|
|
@@ -98,9 +98,9 @@ GEM
|
|
|
98
98
|
bindata
|
|
99
99
|
faraday (~> 2.0)
|
|
100
100
|
faraday-follow_redirects
|
|
101
|
-
loofah (2.
|
|
101
|
+
loofah (2.21.3)
|
|
102
102
|
crass (~> 1.0.2)
|
|
103
|
-
nokogiri (>= 1.
|
|
103
|
+
nokogiri (>= 1.12.0)
|
|
104
104
|
mail (2.8.1)
|
|
105
105
|
mini_mime (>= 0.1.1)
|
|
106
106
|
net-imap
|
|
@@ -109,7 +109,7 @@ GEM
|
|
|
109
109
|
marcel (1.0.2)
|
|
110
110
|
method_source (1.0.0)
|
|
111
111
|
mini_mime (1.1.2)
|
|
112
|
-
mini_portile2 (2.8.
|
|
112
|
+
mini_portile2 (2.8.2)
|
|
113
113
|
minitest (5.18.0)
|
|
114
114
|
net-imap (0.3.4)
|
|
115
115
|
date
|
|
@@ -121,35 +121,36 @@ GEM
|
|
|
121
121
|
net-smtp (0.3.3)
|
|
122
122
|
net-protocol
|
|
123
123
|
nio4r (2.5.9)
|
|
124
|
-
nokogiri (1.
|
|
125
|
-
mini_portile2 (~> 2.8.
|
|
124
|
+
nokogiri (1.15.2)
|
|
125
|
+
mini_portile2 (~> 2.8.2)
|
|
126
126
|
racc (~> 1.4)
|
|
127
127
|
racc (1.6.2)
|
|
128
|
-
rack (2.2.
|
|
128
|
+
rack (2.2.7)
|
|
129
129
|
rack-test (2.1.0)
|
|
130
130
|
rack (>= 1.3)
|
|
131
|
-
rails (7.0.
|
|
132
|
-
actioncable (= 7.0.
|
|
133
|
-
actionmailbox (= 7.0.
|
|
134
|
-
actionmailer (= 7.0.
|
|
135
|
-
actionpack (= 7.0.
|
|
136
|
-
actiontext (= 7.0.
|
|
137
|
-
actionview (= 7.0.
|
|
138
|
-
activejob (= 7.0.
|
|
139
|
-
activemodel (= 7.0.
|
|
140
|
-
activerecord (= 7.0.
|
|
141
|
-
activestorage (= 7.0.
|
|
142
|
-
activesupport (= 7.0.
|
|
131
|
+
rails (7.0.5)
|
|
132
|
+
actioncable (= 7.0.5)
|
|
133
|
+
actionmailbox (= 7.0.5)
|
|
134
|
+
actionmailer (= 7.0.5)
|
|
135
|
+
actionpack (= 7.0.5)
|
|
136
|
+
actiontext (= 7.0.5)
|
|
137
|
+
actionview (= 7.0.5)
|
|
138
|
+
activejob (= 7.0.5)
|
|
139
|
+
activemodel (= 7.0.5)
|
|
140
|
+
activerecord (= 7.0.5)
|
|
141
|
+
activestorage (= 7.0.5)
|
|
142
|
+
activesupport (= 7.0.5)
|
|
143
143
|
bundler (>= 1.15.0)
|
|
144
|
-
railties (= 7.0.
|
|
144
|
+
railties (= 7.0.5)
|
|
145
145
|
rails-dom-testing (2.0.3)
|
|
146
146
|
activesupport (>= 4.2.0)
|
|
147
147
|
nokogiri (>= 1.6)
|
|
148
|
-
rails-html-sanitizer (1.
|
|
149
|
-
loofah (~> 2.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
rails-html-sanitizer (1.6.0)
|
|
149
|
+
loofah (~> 2.21)
|
|
150
|
+
nokogiri (~> 1.14)
|
|
151
|
+
railties (7.0.5)
|
|
152
|
+
actionpack (= 7.0.5)
|
|
153
|
+
activesupport (= 7.0.5)
|
|
153
154
|
method_source
|
|
154
155
|
rake (>= 12.2)
|
|
155
156
|
thor (~> 1.0)
|
|
@@ -159,9 +160,9 @@ GEM
|
|
|
159
160
|
rspec-core (~> 3.12.0)
|
|
160
161
|
rspec-expectations (~> 3.12.0)
|
|
161
162
|
rspec-mocks (~> 3.12.0)
|
|
162
|
-
rspec-core (3.12.
|
|
163
|
+
rspec-core (3.12.2)
|
|
163
164
|
rspec-support (~> 3.12.0)
|
|
164
|
-
rspec-expectations (3.12.
|
|
165
|
+
rspec-expectations (3.12.3)
|
|
165
166
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
166
167
|
rspec-support (~> 3.12.0)
|
|
167
168
|
rspec-mocks (3.12.5)
|
|
@@ -169,7 +170,7 @@ GEM
|
|
|
169
170
|
rspec-support (~> 3.12.0)
|
|
170
171
|
rspec-support (3.12.0)
|
|
171
172
|
ruby2_keywords (0.0.5)
|
|
172
|
-
thor (1.2.
|
|
173
|
+
thor (1.2.2)
|
|
173
174
|
timecop (0.9.6)
|
|
174
175
|
timeout (0.3.2)
|
|
175
176
|
tzinfo (2.0.6)
|
|
@@ -177,7 +178,7 @@ GEM
|
|
|
177
178
|
websocket-driver (0.7.5)
|
|
178
179
|
websocket-extensions (>= 0.1.0)
|
|
179
180
|
websocket-extensions (0.1.5)
|
|
180
|
-
zeitwerk (2.6.
|
|
181
|
+
zeitwerk (2.6.8)
|
|
181
182
|
|
|
182
183
|
PLATFORMS
|
|
183
184
|
ruby
|
|
@@ -189,4 +190,4 @@ DEPENDENCIES
|
|
|
189
190
|
timecop (= 0.9.6)
|
|
190
191
|
|
|
191
192
|
BUNDLED WITH
|
|
192
|
-
2.
|
|
193
|
+
2.4.13
|
data/README.md
CHANGED
|
@@ -11,23 +11,21 @@ module Keycloak
|
|
|
11
11
|
protected
|
|
12
12
|
|
|
13
13
|
def keycloak_authenticate
|
|
14
|
-
|
|
15
14
|
env = request.env
|
|
16
15
|
method = env["REQUEST_METHOD"]
|
|
17
16
|
path = env["PATH_INFO"]
|
|
18
17
|
uri = env["REQUEST_URI"]
|
|
19
18
|
|
|
20
|
-
logger.debug("Start authentication for #{method} : #{path}")
|
|
21
|
-
token = service.read_token(uri, env)
|
|
22
|
-
decoded_token = service.decode_and_verify(token)
|
|
19
|
+
Keycloak.logger.debug("Start authentication for #{method} : #{path}")
|
|
20
|
+
token = Keycloak.service.read_token(uri, env)
|
|
21
|
+
decoded_token = Keycloak.service.decode_and_verify(token)
|
|
23
22
|
authentication_succeeded(env, decoded_token)
|
|
24
|
-
|
|
25
23
|
rescue TokenError => e
|
|
26
24
|
authentication_failed(e.message)
|
|
27
25
|
end
|
|
28
26
|
|
|
29
27
|
def authentication_failed(message)
|
|
30
|
-
logger.info(message)
|
|
28
|
+
Keycloak.logger.info(message)
|
|
31
29
|
render status: :unauthorized, json: { error: message }
|
|
32
30
|
end
|
|
33
31
|
|
|
@@ -36,22 +34,10 @@ module Keycloak
|
|
|
36
34
|
Helper.assign_current_authorized_party(env, decoded_token)
|
|
37
35
|
Helper.assign_current_user_email(env, decoded_token)
|
|
38
36
|
Helper.assign_current_user_locale(env, decoded_token)
|
|
39
|
-
Helper.assign_current_user_custom_attributes(env, decoded_token, config.custom_attributes)
|
|
37
|
+
Helper.assign_current_user_custom_attributes(env, decoded_token, Keycloak.config.custom_attributes)
|
|
40
38
|
Helper.assign_realm_roles(env, decoded_token)
|
|
41
39
|
Helper.assign_resource_roles(env, decoded_token)
|
|
42
40
|
Helper.assign_keycloak_token(env, decoded_token)
|
|
43
41
|
end
|
|
44
|
-
|
|
45
|
-
def service
|
|
46
|
-
Keycloak.service
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def logger
|
|
50
|
-
Keycloak.logger
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def config
|
|
54
|
-
Keycloak.config
|
|
55
|
-
end
|
|
56
42
|
end
|
|
57
|
-
end
|
|
43
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: keycloak-api-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.12.
|
|
4
|
+
version: 0.12.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lorent Lempereur
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-06-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -120,7 +120,7 @@ homepage: https://github.com/looorent/keycloak-api-rails
|
|
|
120
120
|
licenses:
|
|
121
121
|
- MIT
|
|
122
122
|
metadata: {}
|
|
123
|
-
post_install_message:
|
|
123
|
+
post_install_message:
|
|
124
124
|
rdoc_options: []
|
|
125
125
|
require_paths:
|
|
126
126
|
- lib
|
|
@@ -135,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
135
135
|
- !ruby/object:Gem::Version
|
|
136
136
|
version: '0'
|
|
137
137
|
requirements: []
|
|
138
|
-
rubygems_version: 3.
|
|
139
|
-
signing_key:
|
|
138
|
+
rubygems_version: 3.4.10
|
|
139
|
+
signing_key:
|
|
140
140
|
specification_version: 4
|
|
141
141
|
summary: Rails middleware that validates Authorization token emitted by Keycloak
|
|
142
142
|
test_files: []
|