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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33430ef5e956f8a04b6e3de5b91bd4e3103fa45a005fccea305358f07936eeb3
4
- data.tar.gz: '09a89800ff5dec64ba052f666dce839593ed85e3bf5d226d00050e2850387163'
3
+ metadata.gz: dc85b0700082d2d2a0ac3e85cf582481e5c4f314831e8b6dfcb528f082cb06f8
4
+ data.tar.gz: 7b1e40233abd17a16a6fe292cb7de97d4ffb99cb097c7dfea1f7582124ab8f46
5
5
  SHA512:
6
- metadata.gz: 1965c3091b5a5b205e4c83dd233768889ea91a3585ddb5b81ed2d13643b0fbce2fada58ddcedb9bbb61865477395eafdd18f2fe15b4f49bbef497b130484262f
7
- data.tar.gz: 5869dd930cb4f68189f38f7bc2c7405e92b59c384a82718aed93a2d158b6ce29de563e6363b557a1ef5744ca73985d98661be4a56c901b96a0a0c17cb2a1f04a
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
@@ -1,4 +1,4 @@
1
- FROM ruby:2.7.5-slim-bullseye
1
+ FROM ruby:3.2.2-slim-bullseye
2
2
 
3
3
  RUN apt-get update -qq && apt-get install -y build-essential git ruby-dev && apt-get clean && \
4
4
  mkdir -p /usr/src/app/lib/keycloak-api-rails
data/Gemfile.lock CHANGED
@@ -1,74 +1,74 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- keycloak-api-rails (0.12.0)
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.4.3)
12
- actionpack (= 7.0.4.3)
13
- activesupport (= 7.0.4.3)
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.4.3)
17
- actionpack (= 7.0.4.3)
18
- activejob (= 7.0.4.3)
19
- activerecord (= 7.0.4.3)
20
- activestorage (= 7.0.4.3)
21
- activesupport (= 7.0.4.3)
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.4.3)
27
- actionpack (= 7.0.4.3)
28
- actionview (= 7.0.4.3)
29
- activejob (= 7.0.4.3)
30
- activesupport (= 7.0.4.3)
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.4.3)
37
- actionview (= 7.0.4.3)
38
- activesupport (= 7.0.4.3)
39
- rack (~> 2.0, >= 2.2.0)
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.4.3)
44
- actionpack (= 7.0.4.3)
45
- activerecord (= 7.0.4.3)
46
- activestorage (= 7.0.4.3)
47
- activesupport (= 7.0.4.3)
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.4.3)
51
- activesupport (= 7.0.4.3)
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.4.3)
57
- activesupport (= 7.0.4.3)
56
+ activejob (7.0.5)
57
+ activesupport (= 7.0.5)
58
58
  globalid (>= 0.3.6)
59
- activemodel (7.0.4.3)
60
- activesupport (= 7.0.4.3)
61
- activerecord (7.0.4.3)
62
- activemodel (= 7.0.4.3)
63
- activesupport (= 7.0.4.3)
64
- activestorage (7.0.4.3)
65
- actionpack (= 7.0.4.3)
66
- activejob (= 7.0.4.3)
67
- activerecord (= 7.0.4.3)
68
- activesupport (= 7.0.4.3)
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.4.3)
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.4)
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.12.0)
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.20.0)
101
+ loofah (2.21.3)
102
102
  crass (~> 1.0.2)
103
- nokogiri (>= 1.5.9)
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.1)
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.14.3)
125
- mini_portile2 (~> 2.8.0)
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.6.4)
128
+ rack (2.2.7)
129
129
  rack-test (2.1.0)
130
130
  rack (>= 1.3)
131
- rails (7.0.4.3)
132
- actioncable (= 7.0.4.3)
133
- actionmailbox (= 7.0.4.3)
134
- actionmailer (= 7.0.4.3)
135
- actionpack (= 7.0.4.3)
136
- actiontext (= 7.0.4.3)
137
- actionview (= 7.0.4.3)
138
- activejob (= 7.0.4.3)
139
- activemodel (= 7.0.4.3)
140
- activerecord (= 7.0.4.3)
141
- activestorage (= 7.0.4.3)
142
- activesupport (= 7.0.4.3)
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.4.3)
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.5.0)
149
- loofah (~> 2.19, >= 2.19.1)
150
- railties (7.0.4.3)
151
- actionpack (= 7.0.4.3)
152
- activesupport (= 7.0.4.3)
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.1)
163
+ rspec-core (3.12.2)
163
164
  rspec-support (~> 3.12.0)
164
- rspec-expectations (3.12.2)
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.1)
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.7)
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.1.4
193
+ 2.4.13
data/README.md CHANGED
@@ -219,4 +219,5 @@ From the `keycloak-rails-api` directory:
219
219
 
220
220
  ## Next developments
221
221
 
222
- * Manage multiple realms
222
+ * Manage multiple realms
223
+ * Avoid duplicate code in Keycloak::Middleware and `Keycloak::Authentication`
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Keycloak
2
- VERSION = "0.12.1"
2
+ VERSION = "0.12.2"
3
3
  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.1
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-04-15 00:00:00.000000000 Z
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.0.3.1
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: []