verikloak-rails 0.1.0 → 0.1.1
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 +12 -0
- data/lib/verikloak/rails/middleware_integration.rb +21 -2
- data/lib/verikloak/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d7d44a12b8963c944bc63c16ed0890ce63df67f5f6226f1db61aac701dbbc00
|
4
|
+
data.tar.gz: ff24126d34ee02f4eaa220c97db88e7f379657c9a26ece23f868be6ad46ecb9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 968b2516670f1d4dd17dc3a4c2ddbb398b26ed0bc93007612ec4ee35c84d2066b3458e3d790f4e6211183d76daffa605464d9cf645da3050ad2e34af0468f4a0
|
7
|
+
data.tar.gz: dc05a2a815b3be7d9d67921bcc2bc2ddcbd9afdd71264de0f421e1b666906e862cc0963f64fef883a89ac66025c27abd10de967f77ff8d32665d81e895b28c57
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
---
|
9
9
|
|
10
|
+
## [0.1.1] - 2025-09-13
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- ForwardedAccessToken: fix `ensure_bearer` accepting malformed values (e.g., `BearerXYZ`).
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
- Strengthen Bearer scheme normalization to always produce `Bearer <token>`.
|
17
|
+
- Detect scheme case-insensitively.
|
18
|
+
- Collapse tabs/multiple spaces after the scheme to a single space.
|
19
|
+
- Normalize missing-space form `BearerXYZ` to `Bearer XYZ`.
|
20
|
+
- Add/update middleware specs to cover the above normalization.
|
21
|
+
|
10
22
|
## [0.1.0] - 2025-09-07
|
11
23
|
|
12
24
|
### Added
|
@@ -12,6 +12,8 @@ module Verikloak
|
|
12
12
|
# - Never overwrites an existing `Authorization` header
|
13
13
|
# - Can derive the token from a prioritized list of headers
|
14
14
|
class ForwardedAccessToken
|
15
|
+
BEARER_SCHEME = 'Bearer'
|
16
|
+
BEARER_SCHEME_LENGTH = BEARER_SCHEME.length
|
15
17
|
# Initialize the middleware.
|
16
18
|
#
|
17
19
|
# @param app [#call] next Rack app
|
@@ -76,11 +78,28 @@ module Verikloak
|
|
76
78
|
env['HTTP_AUTHORIZATION'] ||= ensure_bearer(token)
|
77
79
|
end
|
78
80
|
|
79
|
-
#
|
81
|
+
# Normalize to a proper 'Bearer <token>' header value.
|
82
|
+
# - Detects scheme case-insensitively
|
83
|
+
# - Inserts a missing space (e.g., 'BearerXYZ' => 'Bearer XYZ')
|
84
|
+
# - Collapses multiple spaces/tabs after the scheme to a single space
|
80
85
|
# @param token [String]
|
81
86
|
# @return [String]
|
82
87
|
def ensure_bearer(token)
|
83
|
-
|
88
|
+
s = token.to_s.strip
|
89
|
+
# Case-insensitive 'Bearer' with spaces/tabs after
|
90
|
+
if s =~ /\A#{BEARER_SCHEME}[ \t]+/i
|
91
|
+
rest = s.sub(/\A#{BEARER_SCHEME}[ \t]+/i, '')
|
92
|
+
return "#{BEARER_SCHEME} #{rest}"
|
93
|
+
end
|
94
|
+
|
95
|
+
# Case-insensitive 'Bearer' with no separator (e.g., 'BearerXYZ')
|
96
|
+
if s =~ /\A#{BEARER_SCHEME}(?![ \t])/i
|
97
|
+
rest = s[BEARER_SCHEME_LENGTH..] || ''
|
98
|
+
return "#{BEARER_SCHEME} #{rest}"
|
99
|
+
end
|
100
|
+
|
101
|
+
# No scheme present; add it
|
102
|
+
"#{BEARER_SCHEME} #{s}"
|
84
103
|
end
|
85
104
|
|
86
105
|
# Whether the request originates from a trusted proxy subnet.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: verikloak-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- taiyaky
|
@@ -74,7 +74,7 @@ metadata:
|
|
74
74
|
source_code_uri: https://github.com/taiyaky/verikloak-rails
|
75
75
|
changelog_uri: https://github.com/taiyaky/verikloak-rails/blob/main/CHANGELOG.md
|
76
76
|
bug_tracker_uri: https://github.com/taiyaky/verikloak-rails/issues
|
77
|
-
documentation_uri: https://rubydoc.info/gems/verikloak-rails/0.1.
|
77
|
+
documentation_uri: https://rubydoc.info/gems/verikloak-rails/0.1.1
|
78
78
|
rubygems_mfa_required: 'true'
|
79
79
|
rdoc_options: []
|
80
80
|
require_paths:
|