lex-identity-system 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8fdbebb784907023be65b35dc3c008757ab9eb0a96aeb71f1ef00a800365109d
4
+ data.tar.gz: 7c2a752be8ff16f5a04f66b3ca72ddce74de2daf0c5f155875e545687f09aa64
5
+ SHA512:
6
+ metadata.gz: badf8b601045d8d5bb0858feb22a60a9dc9d21103e40f1eee564249ec33730275ba3e2afa8261567f0f7fb68f807a702ef048a06e7ed15c72bdaf3a5ca319471
7
+ data.tar.gz: 96cb2b408aafda406d7199e73cce91fdb9acc76ae3797c04366649f1a191ff9a82aebde162f055c3ff8e3c2023e83682e7d4f8b089cf4a66f96d4595df1953a3
@@ -0,0 +1,7 @@
1
+ # Auto-generated from team-config.yml
2
+ # Team: extensions
3
+ #
4
+ # To apply: scripts/apply-codeowners.sh lex-identity-system
5
+
6
+ * @LegionIO/maintainers
7
+ * @LegionIO/extensions
@@ -0,0 +1,18 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ day: monday
8
+ open-pull-requests-limit: 5
9
+ labels:
10
+ - "type:dependencies"
11
+ - package-ecosystem: github-actions
12
+ directory: /
13
+ schedule:
14
+ interval: weekly
15
+ day: monday
16
+ open-pull-requests-limit: 5
17
+ labels:
18
+ - "type:dependencies"
@@ -0,0 +1,34 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ schedule:
7
+ - cron: '0 9 * * 1'
8
+
9
+ jobs:
10
+ ci:
11
+ uses: LegionIO/.github/.github/workflows/ci.yml@main
12
+
13
+ excluded-files:
14
+ uses: LegionIO/.github/.github/workflows/excluded-files.yml@main
15
+
16
+ security:
17
+ uses: LegionIO/.github/.github/workflows/security-scan.yml@main
18
+
19
+ version-changelog:
20
+ uses: LegionIO/.github/.github/workflows/version-changelog.yml@main
21
+
22
+ dependency-review:
23
+ uses: LegionIO/.github/.github/workflows/dependency-review.yml@main
24
+
25
+ stale:
26
+ if: github.event_name == 'schedule'
27
+ uses: LegionIO/.github/.github/workflows/stale.yml@main
28
+
29
+ release:
30
+ needs: [ci, excluded-files]
31
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
32
+ uses: LegionIO/.github/.github/workflows/release.yml@main
33
+ secrets:
34
+ rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .rspec_status
10
+ Gemfile.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ inherit_gem:
2
+ rubocop-legion: config/lex.yml
data/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ ## [0.1.1] - 2026-04-09
4
+
5
+ ### Changed
6
+ - Updated documentation (CLAUDE.md)
7
+
8
+ ## [0.1.0] - 2026-04-06
9
+
10
+ ### Added
11
+
12
+ - Initial release
13
+ - `Identity` module implementing the LegionIO identity provider contract
14
+ - `provider_type: :fallback` — last resort when no other provider resolves
15
+ - `resolve` reads `ENV['USER']` and returns a minimal identity hash with `persistent: false`
16
+ - `normalize` strips non-alphanumeric characters (except `_` and `-`) for AMQP-safe names
17
+ - `trust_weight: 200` (least trusted), `priority: 0` (lowest), `capabilities: [:profile]`
18
+ - No actors, no auth, no group resolution — strictly minimal ENV-based fallback
data/CLAUDE.md ADDED
@@ -0,0 +1,69 @@
1
+ # lex-identity-system: System ENV Identity Fallback for LegionIO
2
+
3
+ **Repository Level 3 Documentation**
4
+ - **Parent (Level 2)**: `/Users/miverso2/rubymine/legion/extensions/CLAUDE.md`
5
+ - **Parent (Level 1)**: `/Users/miverso2/rubymine/legion/CLAUDE.md`
6
+
7
+ ## Purpose
8
+
9
+ Identity fallback provider. Reads `ENV['USER']` to produce a minimal identity when no other provider resolves. `provider_type: :fallback` — distinct from `:auth` and `:profile` providers. Last resort in the identity resolution chain.
10
+
11
+ **GitHub**: https://github.com/LegionIO/lex-identity-system
12
+ **License**: MIT
13
+ **Version**: 0.1.0
14
+
15
+ ## Architecture
16
+
17
+ ```
18
+ Legion::Extensions::Identity::System
19
+ └── Identity # provider contract: resolve, normalize, provider_name, provider_type, ...
20
+ ```
21
+
22
+ No runners, no actors, no transport, no helpers. Strictly minimal.
23
+
24
+ ## File Map
25
+
26
+ | File | Purpose |
27
+ |------|---------|
28
+ | `lib/legion/extensions/identity/system.rb` | Entry point, extends Core, declares `identity_provider?` and `remote_invocable?` |
29
+ | `lib/legion/extensions/identity/system/identity.rb` | Provider contract: all methods including `resolve` and `normalize` |
30
+ | `lib/legion/extensions/identity/system/version.rb` | `VERSION = '0.1.0'` |
31
+
32
+ ## Provider Contract
33
+
34
+ | Method | Return |
35
+ |--------|--------|
36
+ | `provider_name` | `:system` |
37
+ | `provider_type` | `:fallback` |
38
+ | `facing` | `nil` |
39
+ | `priority` | `0` |
40
+ | `trust_weight` | `200` |
41
+ | `capabilities` | `[:profile]` |
42
+ | `resolve` | identity hash or `nil` |
43
+ | `normalize(val)` | String |
44
+
45
+ ## Key Rules
46
+
47
+ - `persistent: false` in the resolved hash — signals no durable principal should be created
48
+ - `normalize` removes dots (AMQP word separator) — result must match `^[a-z0-9][a-z0-9_-]*$`
49
+ - Returns `nil` when `ENV['USER']` is nil, empty, or normalizes to empty string
50
+ - No `provide_token`, no `vault_auth`, no group support
51
+
52
+ ## Dependencies
53
+
54
+ | Gem | Purpose |
55
+ |-----|---------|
56
+ | `legion-json` | JSON serialization (framework compat) |
57
+ | `legion-settings` | Configuration management (framework compat) |
58
+
59
+ ## Testing
60
+
61
+ ```bash
62
+ bundle install
63
+ bundle exec rspec # 38 specs across 1 spec file
64
+ bundle exec rubocop # Clean
65
+ ```
66
+
67
+ ---
68
+
69
+ **Maintained By**: Matthew Iverson (@Esity)
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ gemspec
5
+
6
+ group :development, :test do
7
+ gem 'rspec', '~> 3.13'
8
+ gem 'rubocop', '~> 1.75'
9
+ gem 'rubocop-legion', '~> 0.1'
10
+ gem 'simplecov', '~> 0.22'
11
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Esity
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # lex-identity-system
2
+
3
+ LegionIO identity fallback provider. Reads `ENV['USER']` to produce a minimal identity when no other provider resolves. It is the last resort in the identity resolution chain.
4
+
5
+ ## Provider contract
6
+
7
+ | Attribute | Value |
8
+ |-----------|-------|
9
+ | `provider_name` | `:system` |
10
+ | `provider_type` | `:fallback` |
11
+ | `facing` | `nil` |
12
+ | `priority` | `0` (lowest) |
13
+ | `trust_weight` | `200` (least trusted) |
14
+ | `capabilities` | `[:profile]` |
15
+
16
+ ## Behavior
17
+
18
+ `Identity.resolve` reads `ENV['USER']`. If present and non-empty after normalization, it returns:
19
+
20
+ ```ruby
21
+ {
22
+ canonical_name: "jsmith", # normalized: downcase, strip, remove non-alnum except _ and -
23
+ kind: :human,
24
+ source: :system,
25
+ persistent: false, # ephemeral — no durable principal should be created
26
+ groups: [],
27
+ profile: {
28
+ username: "jsmith", # original ENV['USER'] value
29
+ hostname: "my-host.example" # Socket.gethostname
30
+ }
31
+ }
32
+ ```
33
+
34
+ Returns `nil` if `ENV['USER']` is nil, empty, or normalizes to an empty string.
35
+
36
+ `persistent: false` signals to callers that no durable principal should be created from this identity.
37
+
38
+ ## What this provider does NOT do
39
+
40
+ - No token issuance (`provide_token`)
41
+ - No Vault authentication (`vault_auth`)
42
+ - No group resolution
43
+ - No actors (nothing to refresh)
44
+ - No remote calls of any kind (`remote_invocable? => false`)
45
+
46
+ ## Normalization
47
+
48
+ `normalize(val)` applies `val.to_s.downcase.strip.gsub(/[^a-z0-9_-]/, '')`. Dots are stripped because `.` is an AMQP word separator.
49
+
50
+ ## Installation
51
+
52
+ Add to your Gemfile:
53
+
54
+ ```ruby
55
+ gem 'lex-identity-system'
56
+ ```
57
+
58
+ ## License
59
+
60
+ MIT
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/legion/extensions/identity/system/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'lex-identity-system'
7
+ spec.version = Legion::Extensions::Identity::System::VERSION
8
+ spec.authors = ['Esity']
9
+ spec.email = ['matthewdiverson@gmail.com']
10
+
11
+ spec.summary = 'LEX Identity System'
12
+ spec.description = 'LegionIO identity fallback provider — resolves a minimal identity from ENV[\'USER\'] when no other provider succeeds'
13
+ spec.homepage = 'https://github.com/LegionIO/lex-identity-system'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 3.4'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-identity-system'
19
+ spec.metadata['documentation_uri'] = 'https://github.com/LegionIO/lex-identity-system'
20
+ spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-identity-system'
21
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/LegionIO/lex-identity-system/issues'
22
+ spec.metadata['rubygems_mfa_required'] = 'true'
23
+
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ end
27
+ spec.require_paths = ['lib']
28
+
29
+ spec.add_dependency 'legion-json', '>= 1.2.1'
30
+ spec.add_dependency 'legion-settings', '>= 1.3.14'
31
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'socket'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Identity
8
+ module System
9
+ module Identity
10
+ module_function
11
+
12
+ def provider_name
13
+ :system
14
+ end
15
+
16
+ def provider_type
17
+ :fallback
18
+ end
19
+
20
+ def facing
21
+ nil
22
+ end
23
+
24
+ def priority
25
+ 0
26
+ end
27
+
28
+ def trust_weight
29
+ 200
30
+ end
31
+
32
+ def capabilities
33
+ [:profile]
34
+ end
35
+
36
+ def resolve
37
+ raw = ENV.fetch('USER', nil)
38
+ return nil if raw.nil? || raw.strip.empty?
39
+
40
+ normalized = normalize(raw)
41
+ return nil if normalized.empty?
42
+
43
+ {
44
+ canonical_name: normalized,
45
+ kind: :human,
46
+ source: :system,
47
+ persistent: false,
48
+ groups: [],
49
+ profile: {
50
+ username: raw,
51
+ hostname: ::Socket.gethostname
52
+ }
53
+ }
54
+ end
55
+
56
+ def normalize(val)
57
+ val.to_s.downcase.strip.gsub(/[^a-z0-9_-]/, '')
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Identity
6
+ module System
7
+ VERSION = '0.1.1'
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/identity/system/version'
4
+ require 'legion/extensions/identity/system/identity'
5
+
6
+ module Legion
7
+ module Extensions
8
+ module Identity
9
+ module System
10
+ extend Legion::Extensions::Core if Legion::Extensions.const_defined?(:Core, false)
11
+
12
+ def self.identity_provider?
13
+ true
14
+ end
15
+
16
+ def self.remote_invocable?
17
+ false
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lex-identity-system
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Esity
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: legion-json
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 1.2.1
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 1.2.1
26
+ - !ruby/object:Gem::Dependency
27
+ name: legion-settings
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.3.14
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 1.3.14
40
+ description: LegionIO identity fallback provider — resolves a minimal identity from
41
+ ENV['USER'] when no other provider succeeds
42
+ email:
43
+ - matthewdiverson@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".github/CODEOWNERS"
49
+ - ".github/dependabot.yml"
50
+ - ".github/workflows/ci.yml"
51
+ - ".gitignore"
52
+ - ".rubocop.yml"
53
+ - CHANGELOG.md
54
+ - CLAUDE.md
55
+ - Gemfile
56
+ - LICENSE
57
+ - README.md
58
+ - lex-identity-system.gemspec
59
+ - lib/legion/extensions/identity/system.rb
60
+ - lib/legion/extensions/identity/system/identity.rb
61
+ - lib/legion/extensions/identity/system/version.rb
62
+ homepage: https://github.com/LegionIO/lex-identity-system
63
+ licenses:
64
+ - MIT
65
+ metadata:
66
+ homepage_uri: https://github.com/LegionIO/lex-identity-system
67
+ source_code_uri: https://github.com/LegionIO/lex-identity-system
68
+ documentation_uri: https://github.com/LegionIO/lex-identity-system
69
+ changelog_uri: https://github.com/LegionIO/lex-identity-system
70
+ bug_tracker_uri: https://github.com/LegionIO/lex-identity-system/issues
71
+ rubygems_mfa_required: 'true'
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '3.4'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubygems_version: 3.6.9
87
+ specification_version: 4
88
+ summary: LEX Identity System
89
+ test_files: []