auth-centric-firewall 0.0.7 → 0.0.8

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: 5b9400abeb47ed8c8bf280ba09f8f8a5f8fa4a95fbf28ed0197709ae3bc77f41
4
- data.tar.gz: 7bd5484e78cdd517f79de8eb8772c5ea0d7a136f439b5adb689bd2be0ac25d6c
3
+ metadata.gz: 2ca931e9e27524abe35c770b392bf989fbeef9fa314e411beb5863cbe565b013
4
+ data.tar.gz: 1665611b78e7e35d8ccd25aefa51ed99d6758ac0d7a370dc116d533f6c52dc1a
5
5
  SHA512:
6
- metadata.gz: d44130ea3e21c21ab8e29637f72534a1142f912fe40aa3726c7a1c7cc7beccdedded5f15cd2a5e46c92256a51f0c653e7fe8c0ac2d37b98cbfa9ff7ac529e8ca
7
- data.tar.gz: 4f46cd0a3c71e0b1dda02479ed190c90e1c3907ac652b0ef45074b23954e25788c69ab8372d7f6f3c3bf01182cc33cf27717bff380f0682ac853aafdb225c616
6
+ metadata.gz: c952b34b519168cdcc7dd129863b935d9588c6f8d535778eb2d11b7555ea96b5a11aeb8fe4abd1cd8c2c230277944b1ec1104bbeb737c7c61e60feeca98eed4b
7
+ data.tar.gz: 7d947fad93a6f8ac03434787b9aa1a258122915633217ece5c6db9b28e93d922f876069532f3d6da3aa4ef1b3e707b5d00e53e555543010d544d08bbf188169c
data/.rbenv-vars.example CHANGED
@@ -1,3 +1,4 @@
1
+ AUTH_CENTRIC_ENABLED=true
1
2
  AUTH_CENTRIC_HOST=https://...
2
3
  AUTH_CENTRIC_API_KEY=
3
4
  AUTH_CENTRIC_TIMEOUT_SECONDS=3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.0.8] - 2025-03-29
4
+
5
+ - Added a enabled or disabled
6
+
3
7
  ## [0.0.2] - 2025-03-20
4
8
 
5
9
  - Add a 403 page
data/README.md CHANGED
@@ -20,6 +20,7 @@ gem install auth-centric-firewall
20
20
  ### Env Variables
21
21
 
22
22
  ```bash
23
+ AUTH_CENTRIC_ENABLED=true
23
24
  AUTH_CENTRIC_HOST=http://localhost:3003
24
25
  AUTH_CENTRIC_API_KEY=...
25
26
  AUTH_CENTRIC_TIMEOUT_SECONDS=3
@@ -3,7 +3,7 @@
3
3
  module Auth
4
4
  module Centric
5
5
  module Firewall
6
- VERSION = '0.0.7'
6
+ VERSION = '0.0.8'
7
7
  end
8
8
  end
9
9
  end
@@ -14,6 +14,8 @@ module Auth
14
14
  class Error < StandardError; end
15
15
 
16
16
  def log_firewall(request, forced: false)
17
+ return true unless enabled?
18
+
17
19
  unless forced
18
20
  return true if IGNORE_IP.include?(request.remote_ip)
19
21
  return true if IGNORE_REQUEST.include?(request.original_fullpath)
@@ -33,6 +35,8 @@ module Auth
33
35
  end
34
36
 
35
37
  def valid_ip?(request)
38
+ return true unless enabled?
39
+
36
40
  ip_address = request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip
37
41
  return true if IGNORE_IP.include?(ip_address)
38
42
 
@@ -74,6 +78,10 @@ module Auth
74
78
  def timeout_seconds
75
79
  @timeout_seconds ||= (ENV['AUTH_CENTRIC_TIMEOUT_SECONDS'] || 3).to_i
76
80
  end
81
+
82
+ def enabled?
83
+ @enabled ||= %w[true 1 yes on enabled].include?(ENV['AUTH_CENTRIC_ENABLED']&.downcase)
84
+ end
77
85
  end
78
86
  end
79
87
  end
@@ -5,6 +5,7 @@ module Auth
5
5
 
6
6
  @host: string
7
7
  @apikey: string
8
+ @enabled: bool
8
9
  @capture_path: string
9
10
  @timeout_seconds: int
10
11
 
@@ -13,8 +14,10 @@ module Auth
13
14
 
14
15
  private
15
16
 
17
+
16
18
  def host: -> string
17
19
  def apikey: -> string
20
+ def enabled?: -> bool
18
21
  def capture_path: -> string
19
22
  def ip_status_path: -> string
20
23
  def timeout_seconds: -> int
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth-centric-firewall
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saimon Lovell