pdnd-ruby-client 0.1.2 → 0.1.4
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/.env.sample +0 -0
- data/.rspec +0 -0
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +16 -0
- data/LICENSE +0 -0
- data/README.md +25 -0
- data/Rakefile +0 -0
- data/configs/sample.json +0 -0
- data/lib/pdnd-ruby-client/client.rb +0 -0
- data/lib/pdnd-ruby-client/config_loader.rb +0 -0
- data/lib/pdnd-ruby-client/errors.rb +0 -0
- data/lib/pdnd-ruby-client/jwt_generator.rb +15 -2
- data/lib/pdnd-ruby-client/token_manager.rb +0 -0
- data/lib/pdnd-ruby-client/version.rb +1 -1
- data/lib/pdnd-ruby-client.rb +0 -0
- data/sig/pdnd-ruby-client.rbs +0 -0
- data/tmp/.gitkeep +0 -0
- metadata +2 -3
- data/tmp/pdnd_token.json +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 295617bcb175c8d9279ba5b868bc11fc804b7398d78b2af558eb2c2fa1e06d08
|
4
|
+
data.tar.gz: 03c8906bf2c58bc9d46f594129abaed252d5060f2e105f6d94607d20a88ee6ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1e7279086fb63f255b378bd10c89a5cacd1b74724eaa0f45a6f8e30339ca0d4d5c27893dfce89fb823a096ecb80198ef204e7eb2002daea5e7b846586ba1feb
|
7
|
+
data.tar.gz: 4aeb11dc42ec87e1434fd2c4e33468b5b7d5883db7b420c0b0d9f6059f43da5728a0f3729b0787d940eb5347c4b50c2e495dda4b501e031d1551a879db8ad870
|
data/.env.sample
CHANGED
File without changes
|
data/.rspec
CHANGED
File without changes
|
data/.rubocop.yml
CHANGED
@@ -125,6 +125,10 @@ Metrics/CollectionLiteralLength: # new in 1.47
|
|
125
125
|
Enabled: true
|
126
126
|
Metrics/AbcSize:
|
127
127
|
Enabled: false
|
128
|
+
Metrics/ClassLength:
|
129
|
+
Enabled: false
|
130
|
+
Metrics/MethodLength:
|
131
|
+
Enabled: false
|
128
132
|
Naming/FileName:
|
129
133
|
Enabled: false
|
130
134
|
Naming/BlockForwarding: # new in 1.24
|
@@ -281,6 +285,8 @@ Style/SingleLineDoEndBlock: # new in 1.57
|
|
281
285
|
Enabled: true
|
282
286
|
Style/StringChars: # new in 1.12
|
283
287
|
Enabled: true
|
288
|
+
Style/StringLiterals:
|
289
|
+
Enabled: false
|
284
290
|
Style/SuperArguments: # new in 1.64
|
285
291
|
Enabled: true
|
286
292
|
Style/SuperWithArgsParentheses: # new in 1.58
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.1.4](https://github.com/isprambiente/pdnd-ruby-client/tree/v0.1.4) (2025-08-05)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/isprambiente/pdnd-ruby-client/compare/v0.1.3...v0.1.4)
|
6
|
+
|
7
|
+
## [v0.1.3](https://github.com/isprambiente/pdnd-ruby-client/tree/v0.1.3) (2025-07-28)
|
8
|
+
|
9
|
+
[Full Changelog](https://github.com/isprambiente/pdnd-ruby-client/compare/v0.1.2...v0.1.3)
|
10
|
+
|
11
|
+
## [v0.1.2](https://github.com/isprambiente/pdnd-ruby-client/tree/v0.1.2) (2025-07-28)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/isprambiente/pdnd-ruby-client/compare/v0.1.1...v0.1.2)
|
14
|
+
|
15
|
+
## [v0.1.1](https://github.com/isprambiente/pdnd-ruby-client/tree/v0.1.1) (2025-07-27)
|
16
|
+
|
17
|
+
[Full Changelog](https://github.com/isprambiente/pdnd-ruby-client/compare/3f6941089b70a828eb2ebeb3778be2e8f92e4325...v0.1.1)
|
18
|
+
|
3
19
|
|
4
20
|
|
5
21
|
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -58,6 +58,31 @@ puts body
|
|
58
58
|
|
59
59
|
```
|
60
60
|
|
61
|
+
## Passa la chiave privata manualmente (disponibile dalla v.0.1.4)
|
62
|
+
```ruby
|
63
|
+
require "pdnd-ruby-client"
|
64
|
+
|
65
|
+
# Inizializza la configurazione
|
66
|
+
# Load the configuration from the specified JSON file and environment key.
|
67
|
+
config = PDND::ConfigLoader.load("configs/sample.json")
|
68
|
+
jwt = PDND::JWTGenerator.new(config)
|
69
|
+
# Inserisci tutta la chiave privata.
|
70
|
+
# La chiave privata passata manualmente ha la priorità
|
71
|
+
# rispetto a quella inserita nel config file json.
|
72
|
+
jwt.priv_key = "-----BEGIN PRIVATE KEY-----"
|
73
|
+
token, exp = jwt.generate_token
|
74
|
+
client = PDND::Client.new(config)
|
75
|
+
client.token = token
|
76
|
+
client.token_exp = exp
|
77
|
+
client.api_url="https://www.tuogateway.example.it/indirizzo/della/api"
|
78
|
+
client.filters="id=1234"
|
79
|
+
code, body = client.request_api
|
80
|
+
|
81
|
+
# Stampa il risultato
|
82
|
+
puts body
|
83
|
+
|
84
|
+
```
|
85
|
+
|
61
86
|
## Leggi e Salva il token
|
62
87
|
|
63
88
|
```ruby
|
data/Rakefile
CHANGED
File without changes
|
data/configs/sample.json
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -26,7 +26,7 @@ module PDND
|
|
26
26
|
# generator = PDND::JWTGenerator.new(config)
|
27
27
|
# token, exp = generator.generate_token
|
28
28
|
class JWTGenerator
|
29
|
-
attr_accessor :env, :config, :debug, :issuer, :client_id, :priv_key_path,
|
29
|
+
attr_accessor :env, :config, :debug, :issuer, :client_id, :priv_key, :priv_key_path,
|
30
30
|
:purpose_id, :kid, :endpoint, :audience, :assertion,
|
31
31
|
:token, :token_exp
|
32
32
|
|
@@ -65,6 +65,7 @@ module PDND
|
|
65
65
|
def assign_config_values(config)
|
66
66
|
@issuer = config[:issuer]
|
67
67
|
@client_id = config[:clientId]
|
68
|
+
@priv_key = config[:privKey]
|
68
69
|
@priv_key_path = config[:privKeyPath]
|
69
70
|
@kid = config[:kid]
|
70
71
|
@purpose_id = config[:purposeId]
|
@@ -84,7 +85,19 @@ module PDND
|
|
84
85
|
# @return [OpenSSL::PKey::RSA] Chiave privata RSA
|
85
86
|
# @raise [PDND::ConfigError] Se la chiave è invalida o il file non esiste
|
86
87
|
def load_private_key
|
87
|
-
|
88
|
+
key = nil
|
89
|
+
|
90
|
+
if @priv_key.to_s.strip != ""
|
91
|
+
key = @priv_key
|
92
|
+
debug_log('✅ Priv Key acquisita manualmente', '**********')
|
93
|
+
elsif @priv_key_path.to_s.strip != ""
|
94
|
+
key = File.read(@priv_key_path)
|
95
|
+
debug_log('✅ Priv Key acquisita da file', '**********')
|
96
|
+
else
|
97
|
+
raise PDND::ConfigError, "❌ Nessuna chiave privata o percorso fornito"
|
98
|
+
end
|
99
|
+
|
100
|
+
OpenSSL::PKey::RSA.new(key)
|
88
101
|
rescue OpenSSL::PKey::RSAError => e
|
89
102
|
raise PDND::ConfigError, "❌ Chiave privata non valida: #{e.message}"
|
90
103
|
rescue Errno::ENOENT => e
|
File without changes
|
data/lib/pdnd-ruby-client.rb
CHANGED
File without changes
|
data/sig/pdnd-ruby-client.rbs
CHANGED
File without changes
|
data/tmp/.gitkeep
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdnd-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francesco Loreti
|
@@ -110,7 +110,6 @@ files:
|
|
110
110
|
- lib/pdnd-ruby-client/version.rb
|
111
111
|
- sig/pdnd-ruby-client.rbs
|
112
112
|
- tmp/.gitkeep
|
113
|
-
- tmp/pdnd_token.json
|
114
113
|
homepage: https://github.com/isprambiente/pdnd-ruby-client
|
115
114
|
licenses:
|
116
115
|
- MIT
|
@@ -132,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
131
|
- !ruby/object:Gem::Version
|
133
132
|
version: '0'
|
134
133
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
134
|
+
rubygems_version: 3.6.9
|
136
135
|
specification_version: 4
|
137
136
|
summary: Client Ruby per la PDND.
|
138
137
|
test_files: []
|
data/tmp/pdnd_token.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"token":"eyJhbGciOiJSUzI1NiIsInVzZSI6InNpZyIsInR5cCI6ImF0K2p3dCIsImtpZCI6Ijk0MzJjMTZiLTdhYWUtNDlkZi1iOWM0LWVhNjFiNTU2NjUyYiJ9.eyJqdGkiOiJlM2RjNDg2MS00NDkwLTRmMmItODQ3OC1mOThkMTM1YWRkNjUiLCJpc3MiOiJpbnRlcm9wLnBhZ29wYS5pdCIsImF1ZCI6IklTUFJBX3JlbmRpcyIsImNsaWVudF9pZCI6ImNjOWE1MWZlLTdhMzYtNGVjMC04MjI0LWMzZjliNWMyN2FjYSIsInN1YiI6ImNjOWE1MWZlLTdhMzYtNGVjMC04MjI0LWMzZjliNWMyN2FjYSIsImlhdCI6MTc1MzU0NTk1MywibmJmIjoxNzUzNTQ1OTUzLCJleHAiOjE3NTM1NDYxMzMsInB1cnBvc2VJZCI6IjFjYjY1NmJjLWVlY2MtNGM1YS1iZTU5LWJmZGE1YjdkMWNmNCIsInByb2R1Y2VySWQiOiIxNGRiOGI1Yy1jZWJhLTQzMzMtODYyYy1iODJiNjRlYmFhZGQiLCJjb25zdW1lcklkIjoiMTRkYjhiNWMtY2ViYS00MzMzLTg2MmMtYjgyYjY0ZWJhYWRkIiwiZXNlcnZpY2VJZCI6IjMyNjYyOGUxLWRkNzItNGI2MS04ZGRlLTRmOGY5NzEwODIxOSIsImRlc2NyaXB0b3JJZCI6IjhjNGE5NmQwLTBiNTMtNDI2MC04YzYyLWFlZThkNmMzODVlNyJ9.O_bjiaLSvHimuNubY-8gYQmzfnDPS381Lg9MOgFdhyN1HCPLhrLRqDDXu9nf-QMkuW5hkdwdeE04AXyHKVonexUK3waGW99eBZdXKpB07iKHpHPPyLxJs07R7VbABtJp668YiZW53CDqLU6kOoYIeBx1tLS-R7_5ZL68pCmu3KZ4yfD8vv0JzFrgxI6QSg3lbvRTT8ycAZruQ9VvNtQEBfJrXiXOuxkcDc-DfWVX7V8PSomgrnHpZbkp0ClXuGKN-Typ8aBB2gOFLb6gL1aL6trnAkZM9RoGjgB3YBGj3sduWgJ1wl49ZlK3SIjiNNqiR7sP2-8qtYbmeu0M_LQK-A","exp":"2025-07-26 18:08:52"}
|