katalyst-basic-auth 0.4.0 → 1.0.0

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: 2ba4ca13e4d93df610df02a04c6282aa5320c47ffe44cf15b17ee9484ff7ec4b
4
- data.tar.gz: 0fab877c0d5f4cd3dda28b2cd169c2339fda404e4d0033efbf202e4ed583c8ea
3
+ metadata.gz: 6986b0c9b3f2e9731aaead2c1b74db0008be2ab82ee91e377b772caad2a9397d
4
+ data.tar.gz: 87daff02ae81a92bcb90d3d24be50e7109e70fcf865521fc5edb8bcf861dfde5
5
5
  SHA512:
6
- metadata.gz: 30d91927431d0f6c1a823ca25876c6995614f66e676fd3d4f83a4607becc6edb861ae1c52e5afb7ff247ce375e3f5401c4c0b12abecb94f166542ddb7595a925
7
- data.tar.gz: 730907dfaca349496752303bee3778fabff379255ef6255a1db9e8c5ae39889040e22f69a112e291fc507c95bb28cf42bf1b6e7f161c00f4e2c5452ca27cc718
6
+ metadata.gz: 7936209ed48a5403081c7a89f5842af9fd9bb5828cb15a6c82a57fa0a8ae2708aa25dd797acbd6b92bd675174853365fd2b8a01fc30d2de356235d151b5f7ad5
7
+ data.tar.gz: 1371ef21dd3f0a059d929e2e4e095567873b440002a449fd2e35a622cc85753e9679dd368ea432d8595465db03c4cc3ebc238215af64d6849d2f0a1a46d3e915
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.5.0] - 2024-04-26
2
+
3
+ - Add `/up` as a default allowed path (Rails 7.1+ health check)
4
+
1
5
  ## [0.4.0] - 2022-06-10
2
6
 
3
7
  - Add support for IP address allowlists
data/README.md CHANGED
@@ -56,7 +56,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
56
56
 
57
57
  ## Contributing
58
58
 
59
- Bug reports and pull requests are welcome on GitHub at https://github.com/katalyst/katalyst-basic-auth. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/katalyst-basic-auth/blob/master/CODE_OF_CONDUCT.md).
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/katalyst/basic-auth. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/katalyst-basic-auth/blob/master/CODE_OF_CONDUCT.md).
60
60
 
61
61
  ## License
62
62
 
@@ -19,8 +19,8 @@ module Katalyst
19
19
  def for_path(path)
20
20
  path ||= ROOT_PATH
21
21
  all.sort_by(&:path)
22
- .reverse
23
- .detect { |i| path.match(/^#{i.path}/) } || global
22
+ .reverse
23
+ .detect { |i| path.match(/^#{i.path}/) } || global
24
24
  end
25
25
 
26
26
  # @return [Config] The global configuration
@@ -39,23 +39,27 @@ module Katalyst
39
39
  username: username,
40
40
  password: password,
41
41
  enabled: enabled,
42
- ip_allowlist: ip_allowlist
42
+ ip_allowlist: ip_allowlist,
43
43
  )
44
44
  all.delete(all.detect { |i| i.path == config.path })
45
45
  all << config
46
46
  config
47
47
  end
48
48
 
49
+ def up(path = "/up")
50
+ new(path: path, enabled: false)
51
+ end
52
+
49
53
  def all
50
- @all ||= [new]
54
+ @all ||= [new, up]
51
55
  end
52
56
 
53
57
  def reset!
54
- @all = [new]
58
+ @all = [new, up]
55
59
  end
56
60
 
57
- def each(&block)
58
- all.each(&block)
61
+ def each(&)
62
+ all.each(&)
59
63
  end
60
64
 
61
65
  def description
@@ -75,7 +79,7 @@ module Katalyst
75
79
  def enabled_rails_env?
76
80
  return false unless rails?
77
81
 
78
- Rails.env.staging? || Rails.env.uat?
82
+ %w[staging uat].include?(Rails.env)
79
83
  end
80
84
 
81
85
  def rails?
@@ -103,7 +107,7 @@ module Katalyst
103
107
  if rails? && Rails.application.respond_to?(:secret_key_base)
104
108
  Rails.application.secret_key_base
105
109
  else
106
- ENV["SECRET_KEY_BASE"]
110
+ ENV.fetch("SECRET_KEY_BASE", nil)
107
111
  end
108
112
  end
109
113
 
@@ -132,7 +136,7 @@ module Katalyst
132
136
 
133
137
  def description
134
138
  output = []
135
- output << "path: #{root_path? ? "(global)" : path}"
139
+ output << "path: #{root_path? ? '(global)' : path}"
136
140
  output << "enabled: #{enabled?}"
137
141
  output << "username: #{username}"
138
142
  output << "password: #{password}"
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "auth/version"
4
3
  require_relative "auth/config"
5
4
  require_relative "auth/middleware"
6
5
  require_relative "auth/rails" if defined?(Rails)
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "katalyst/basic/auth"
metadata CHANGED
@@ -1,32 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-basic-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-06-14 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rack
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
27
12
  description: Makes it easy to add basic auth on staging and development apps.
28
13
  email:
29
- - admin@katalyst.com.au
14
+ - developers@katalyst.com.au
30
15
  executables: []
31
16
  extensions: []
32
17
  extra_rdoc_files: []
@@ -34,12 +19,12 @@ files:
34
19
  - CHANGELOG.md
35
20
  - LICENSE.txt
36
21
  - README.md
22
+ - lib/katalyst-basic-auth.rb
37
23
  - lib/katalyst/basic/auth.rb
38
24
  - lib/katalyst/basic/auth/config.rb
39
25
  - lib/katalyst/basic/auth/middleware.rb
40
26
  - lib/katalyst/basic/auth/rails.rb
41
27
  - lib/katalyst/basic/auth/tasks/auth.rake
42
- - lib/katalyst/basic/auth/version.rb
43
28
  homepage: https://github.com/katalyst/katalyst-basic-auth
44
29
  licenses:
45
30
  - MIT
@@ -47,9 +32,8 @@ metadata:
47
32
  allowed_push_host: https://rubygems.org
48
33
  rubygems_mfa_required: 'true'
49
34
  homepage_uri: https://github.com/katalyst/katalyst-basic-auth
50
- source_code_uri: https://github.com/katalyst/katalyst-basic-auth
51
- changelog_uri: https://github.com/katalyst/katalyst-basic-auth/blob/main/CHANGELOG.md
52
- post_install_message:
35
+ source_code_uri: https://github.com/katalyst/basic-auth
36
+ changelog_uri: https://github.com/katalyst/basic-auth/blob/main/CHANGELOG.md
53
37
  rdoc_options: []
54
38
  require_paths:
55
39
  - lib
@@ -57,15 +41,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
57
41
  requirements:
58
42
  - - ">="
59
43
  - !ruby/object:Gem::Version
60
- version: 2.3.8
44
+ version: '3.3'
61
45
  required_rubygems_version: !ruby/object:Gem::Requirement
62
46
  requirements:
63
47
  - - ">="
64
48
  - !ruby/object:Gem::Version
65
49
  version: '0'
66
50
  requirements: []
67
- rubygems_version: 3.3.15
68
- signing_key:
51
+ rubygems_version: 3.6.9
69
52
  specification_version: 4
70
53
  summary: Gem to add basic auth on staging websites
71
54
  test_files: []
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Katalyst
4
- module Basic
5
- module Auth
6
- VERSION = "0.4.0"
7
- end
8
- end
9
- end