ldap_groups_lookup 0.10.0 → 0.11.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: 4d6da72dceefbf3ea333aeb46b7288da0d3ec3517c05fbcbc77f53eb3fc955f2
4
- data.tar.gz: 1720d92a5e416dbb2f4fafec7c2fc85239d82bb8ef6982909646217260d91457
3
+ metadata.gz: 9e7affc77773609169dc9b5bd910bd7c1d9e8a3e157f0c9f33e843dd626df735
4
+ data.tar.gz: 9b1c0bf677410247aec9634defcd67e5ade14ec40a86ad72d7ea59aae9dead55
5
5
  SHA512:
6
- metadata.gz: b05d74e63567fb0e0272cf2242a395c9a0dc0125306112e1671eba47bd9460c73c1fff154d1b5708fc4669f0877d9d30dd87320256fcbdf7f39ca56269d8d9cc
7
- data.tar.gz: 5becbdb0a9356bfa9b53df4133d9ffc955b77a0c50757265d80457ee7a0c86b59d74cca811732fefbb8700879d1210de3cd120c50095bd81cc4fb464f686f468
6
+ metadata.gz: 7f98193e36b4165186f6aaa6aeb99f213d71f84feb90391a231084d61395ea022fabdbe38031a8607ffd8c97cebf02420036a6ff0327cb2537a60ad17d49f7c7
7
+ data.tar.gz: 6d7456b672ec139e12c60a428c279cb02cd5bebaea54f25e02467a1b7663836057c352fa32baa1010d8999eef9ef0c47da7950a8a5ea195476dabeb2a30b93e3
@@ -18,19 +18,17 @@ permissions:
18
18
 
19
19
  jobs:
20
20
  test:
21
-
22
21
  runs-on: ubuntu-latest
23
22
  strategy:
24
23
  matrix:
25
- ruby-version: ['2.7', '3.2']
26
-
24
+ ruby-version: ['2.7', '3.3']
27
25
  steps:
28
26
  - uses: actions/checkout@v4
29
27
  - name: Set up Ruby
30
28
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
29
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
30
  # uses: ruby/setup-ruby@v1
33
- uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
31
+ uses: ruby/setup-ruby@v1
34
32
  with:
35
33
  ruby-version: ${{ matrix.ruby-version }}
36
34
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # IU LDAP Groups Lookup
2
+ [![Gem Version](https://badge.fury.io/rb/ldap_groups_lookup.svg)](https://badge.fury.io/rb/ldap_groups_lookup)
2
3
 
3
4
  ## Usage
4
5
 
@@ -32,12 +33,37 @@ u.member_of_ldap_group?(['Some-Group'])
32
33
 
33
34
  ## Configuration
34
35
 
35
- Create a file `config/ldap_groups_lookup.yml` that looks like:
36
+ ### Initializer
37
+ Create an initializer `config/initializers/ldap_groups_lookup.rb` that looks like:
38
+ ```ruby
39
+ LDAPGroupsLookup.config = {
40
+ enabled: true,
41
+ config: { host: 'ads.example.net',
42
+ port: 636,
43
+ encryption: {
44
+ method: :simple_tls,
45
+ tls_options: OpenSSL::SSL::SSLContext::DEFAULT_PARAMS,
46
+ },
47
+ auth: {
48
+ method: :simple,
49
+ username: "cn=example",
50
+ password: 'changeme',
51
+ }
52
+ },
53
+ tree: 'dc=ads,dc=example,dc=net',
54
+ account_ou: 'ou=Accounts',
55
+ group_ou: 'ou=Groups',
56
+ member_allowlist: ['OU=Groups']
57
+ }
58
+ ```
59
+
60
+ ### YAML
61
+ Alternatively, create a file `config/ldap_groups_lookup.yml` that looks like:
36
62
 
37
63
  ```yaml
38
64
  :enabled: true
39
65
  :host: ads.example.net
40
- :port: 636
66
+ :port: 389
41
67
  :auth:
42
68
  :method: :simple
43
69
  :username: example
@@ -45,6 +71,7 @@ Create a file `config/ldap_groups_lookup.yml` that looks like:
45
71
  :tree: dc=ads,dc=example,dc=net
46
72
  :account_ou: ou=Accounts
47
73
  :group_ou: ou=Groups
48
- :member_whitelist:
74
+ :member_allowlist:
49
75
  - OU=Groups
50
- ```
76
+ ```
77
+ Note: The yaml style does not allow for easy configuration of some properties like tls_options or other auth methods.
@@ -50,8 +50,8 @@ module LDAPGroupsLookup
50
50
  config[:tree]
51
51
  end
52
52
 
53
- def member_whitelist
54
- config[:member_whitelist].to_a
53
+ def member_allowlist
54
+ config[:member_allowlist] || ['OU=Groups']
55
55
  end
56
56
 
57
57
  private
@@ -57,7 +57,7 @@ module LDAPGroupsLookup
57
57
  next if seen.include? g
58
58
  seen << g
59
59
  member_groups = members.collect do |mg|
60
- dn_to_cn(mg) if member_whitelist.empty? || member_whitelist.any? do |fil|
60
+ dn_to_cn(mg) if member_allowlist.empty? || member_allowlist.any? do |fil|
61
61
  mg.include? fil
62
62
  end
63
63
  end
@@ -1,5 +1,5 @@
1
1
  # Gem version release tracking
2
2
  module LDAPGroupsLookup
3
3
  # Define release version
4
- VERSION = '0.10.0'.freeze
4
+ VERSION = '0.11.0'.freeze
5
5
  end
@@ -8,5 +8,5 @@
8
8
  :tree: dc=ads,dc=example,dc=net
9
9
  :account_ou: ou=Accounts
10
10
  :group_ou: ou=Groups
11
- :member_whitelist:
11
+ :member_allowlist:
12
12
  - OU=Groups
@@ -243,25 +243,25 @@ RSpec.describe LDAPGroupsLookup do
243
243
  hash_including(filter: Net::LDAP::Filter.equals('cn', 'Nested-Group'),
244
244
  attributes: ['member;range=1-*'])).and_return([@nested_group_page_2])
245
245
  end
246
- context 'when the group is whitelisted' do
246
+ context 'when the group is allowlisted' do
247
247
  before do
248
- allow(LDAPGroupsLookup).to receive(:member_whitelist).and_return(['OU=Groups'])
248
+ allow(LDAPGroupsLookup).to receive(:member_allowlist).and_return(['OU=Groups'])
249
249
  end
250
250
  it 'should return true' do
251
251
  expect(user.member_of_ldap_group?('Top-Group')).to eq(true)
252
252
  end
253
253
  end
254
- context 'when the whitelist is empty' do
254
+ context 'when the allowlist is empty' do
255
255
  before do
256
- allow(LDAPGroupsLookup).to receive(:member_whitelist).and_return([])
256
+ allow(LDAPGroupsLookup).to receive(:member_allowlist).and_return([])
257
257
  end
258
- it 'should return true (whitelisting is disabled)' do
258
+ it 'should return true (allowlisting is disabled)' do
259
259
  expect(user.member_of_ldap_group?('Top-Group')).to eq(true)
260
260
  end
261
261
  end
262
- context 'when the group is not whitelisted' do
262
+ context 'when the group is not allowlisted' do
263
263
  before do
264
- allow(LDAPGroupsLookup).to receive(:member_whitelist).and_return(['OU=Not-A-Match'])
264
+ allow(LDAPGroupsLookup).to receive(:member_allowlist).and_return(['OU=Not-A-Match'])
265
265
  end
266
266
  it 'should return false' do
267
267
  expect(user.member_of_ldap_group?('Top-Group')).to eq(false)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ldap_groups_lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Ploshay
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-11-18 00:00:00.000000000 Z
13
+ date: 2024-11-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: net-ldap