verikloak-bff 0.2.2 → 0.2.3
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 +5 -0
- data/README.md +6 -2
- data/lib/generators/verikloak/bff/install/install_generator.rb +57 -0
- data/lib/verikloak/bff/railtie.rb +13 -15
- data/lib/verikloak/bff/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e2d5b0966fddd564dcd1b6e48fb871f3239542204176f0291f4249f5770b713
|
|
4
|
+
data.tar.gz: c1f1c43a58c7428263757d2f051c3f988921d84b30fc5fbdc8995f0c5d55ef4c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a4c8c80a0fccd793d93b2ef98374fd0bca253d5a36ff4d690dbd67de622bebd92ad27ef141d3c65c56ddd8c1934b9e9818a51eb3ef0a40b780ad0bc491263503
|
|
7
|
+
data.tar.gz: 339f5c58833ebb8ef19b511725c3f540e7506f097032235852088e0594dc917702723f8084f1abbdfd050b41f738486665d1c8b93891fb9fc7293c31d6e0483d
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [0.2.3] - 2025-09-23
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Stop inserting `Verikloak::BFF::HeaderGuard` automatically via the Railtie and provide a `rails g verikloak:bff:install` generator that drops an initializer to opt in when the core middleware is ready.
|
|
14
|
+
|
|
10
15
|
## [0.2.2] - 2025-09-23
|
|
11
16
|
|
|
12
17
|
### Changed
|
data/README.md
CHANGED
|
@@ -31,12 +31,16 @@ use Verikloak::BFF::HeaderGuard, trusted_proxies: ['127.0.0.1', '10.0.0.0/8']
|
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### Rails Applications
|
|
34
|
-
|
|
34
|
+
Add the gem to your Gemfile and run the install generator to drop an initializer that wires the middleware into Rails:
|
|
35
35
|
```ruby
|
|
36
36
|
gem 'verikloak-bff'
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
```sh
|
|
40
|
+
bin/rails g verikloak:bff:install
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The generated initializer inserts `Verikloak::BFF::HeaderGuard` after the core `Verikloak::Middleware` during boot. If the core middleware is not present (for example, when verikloak-rails has not been fully configured yet), the initializer logs a warning and allows Rails to boot normally.
|
|
40
44
|
|
|
41
45
|
For detailed configuration, proxy setup examples, and troubleshooting, see [docs/rails.md](docs/rails.md).
|
|
42
46
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rails/generators/base'
|
|
4
|
+
|
|
5
|
+
module Verikloak
|
|
6
|
+
module BFF
|
|
7
|
+
# Namespace for Rails generators related to Verikloak BFF
|
|
8
|
+
module Generators
|
|
9
|
+
# Rails generator for installing Verikloak BFF middleware integration.
|
|
10
|
+
#
|
|
11
|
+
# This generator creates a Rails initializer that safely inserts the
|
|
12
|
+
# Verikloak::BFF::HeaderGuard middleware into the Rails middleware stack.
|
|
13
|
+
# It replaces automatic middleware insertion to avoid boot failures when
|
|
14
|
+
# core Verikloak middleware is not yet configured.
|
|
15
|
+
#
|
|
16
|
+
# @example Basic usage
|
|
17
|
+
# rails g verikloak:bff:install
|
|
18
|
+
#
|
|
19
|
+
# @example Custom initializer path
|
|
20
|
+
# rails g verikloak:bff:install --initializer=config/initializers/custom_bff.rb
|
|
21
|
+
#
|
|
22
|
+
# @see Verikloak::BFF::Rails::Middleware
|
|
23
|
+
class InstallGenerator < ::Rails::Generators::Base
|
|
24
|
+
source_root File.expand_path('templates', __dir__)
|
|
25
|
+
|
|
26
|
+
# Configuration option for specifying the initializer file path.
|
|
27
|
+
#
|
|
28
|
+
# @option options [String] :initializer ('config/initializers/verikloak_bff.rb')
|
|
29
|
+
# The path where the initializer file will be created
|
|
30
|
+
class_option :initializer, type: :string,
|
|
31
|
+
default: 'config/initializers/verikloak_bff.rb',
|
|
32
|
+
desc: 'Path for the generated initializer'
|
|
33
|
+
|
|
34
|
+
# Creates the Rails initializer file from template.
|
|
35
|
+
#
|
|
36
|
+
# Generates a Rails initializer that safely inserts the HeaderGuard
|
|
37
|
+
# middleware into the middleware stack with proper error handling.
|
|
38
|
+
# The initializer uses Verikloak::BFF::Rails::Middleware.insert_after_core
|
|
39
|
+
# to ensure graceful handling when core middleware is missing.
|
|
40
|
+
#
|
|
41
|
+
# @return [void]
|
|
42
|
+
def create_initializer
|
|
43
|
+
template 'initializer.rb.tt', initializer_path
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
# Returns the path where the initializer should be created.
|
|
49
|
+
#
|
|
50
|
+
# @return [String] The initializer file path from options
|
|
51
|
+
def initializer_path
|
|
52
|
+
options[:initializer]
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -5,29 +5,27 @@ require_relative 'rails'
|
|
|
5
5
|
module Verikloak
|
|
6
6
|
# Module providing Verikloak BFF (Backend for Frontend) functionality
|
|
7
7
|
module BFF
|
|
8
|
-
# Railtie
|
|
8
|
+
# Railtie for integrating Verikloak BFF with Rails applications.
|
|
9
9
|
#
|
|
10
|
-
# This
|
|
11
|
-
#
|
|
12
|
-
#
|
|
10
|
+
# This Railtie provides access to the BFF installation generator instead of
|
|
11
|
+
# automatically inserting middleware, which could cause boot failures when
|
|
12
|
+
# core Verikloak middleware is not yet configured.
|
|
13
13
|
#
|
|
14
|
-
# @example
|
|
15
|
-
#
|
|
16
|
-
# gem 'verikloak-bff'
|
|
14
|
+
# @example Installing BFF middleware
|
|
15
|
+
# rails g verikloak:bff:install
|
|
17
16
|
#
|
|
18
17
|
# @see Verikloak::BFF::Rails::Middleware
|
|
19
18
|
class Railtie < ::Rails::Railtie
|
|
20
|
-
#
|
|
19
|
+
# Loads the install generator when Rails generator infrastructure is available.
|
|
21
20
|
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
# Uses Rails.logger as the logger if available.
|
|
21
|
+
# Makes the `verikloak:bff:install` generator discoverable through `rails g`
|
|
22
|
+
# while keeping generators optional for non-Rails environments.
|
|
25
23
|
#
|
|
26
|
-
# @
|
|
27
|
-
initializer 'verikloak.bff.
|
|
28
|
-
|
|
24
|
+
# @return [void]
|
|
25
|
+
initializer 'verikloak.bff.load_generators' do
|
|
26
|
+
next unless defined?(Rails::Generators)
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
require_relative '../../generators/verikloak/bff/install/install_generator'
|
|
31
29
|
end
|
|
32
30
|
end
|
|
33
31
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: verikloak-bff
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- taiyaky
|
|
@@ -78,6 +78,7 @@ files:
|
|
|
78
78
|
- CHANGELOG.md
|
|
79
79
|
- LICENSE
|
|
80
80
|
- README.md
|
|
81
|
+
- lib/generators/verikloak/bff/install/install_generator.rb
|
|
81
82
|
- lib/verikloak-bff.rb
|
|
82
83
|
- lib/verikloak/bff.rb
|
|
83
84
|
- lib/verikloak/bff/configuration.rb
|
|
@@ -98,7 +99,7 @@ metadata:
|
|
|
98
99
|
source_code_uri: https://github.com/taiyaky/verikloak-bff
|
|
99
100
|
changelog_uri: https://github.com/taiyaky/verikloak-bff/blob/main/CHANGELOG.md
|
|
100
101
|
bug_tracker_uri: https://github.com/taiyaky/verikloak-bff/issues
|
|
101
|
-
documentation_uri: https://rubydoc.info/gems/verikloak-bff/0.2.
|
|
102
|
+
documentation_uri: https://rubydoc.info/gems/verikloak-bff/0.2.3
|
|
102
103
|
rubygems_mfa_required: 'true'
|
|
103
104
|
rdoc_options: []
|
|
104
105
|
require_paths:
|