Skip to content

Commit bda204c

Browse files
Merge pull request #1 from stmsat/env-attestazione
Gestione ambiente di attestazione
2 parents 80655f6 + a5836ea commit bda204c

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ MIT
2727
2. Configura il file JSON con i parametri richiesti (esempio in `configs/sample.json`):
2828
```json
2929
{
30+
"attestazione": {
31+
"kid": "kid",
32+
"issuer": "issuer",
33+
"clientId": "clientId",
34+
"purposeId": "purposeId",
35+
"privKeyPath": "/tmp/key.pem"
36+
},
3037
"collaudo": {
3138
"kid": "kid",
3239
"issuer": "issuer",
@@ -51,8 +58,13 @@ from pdnd_client.config import Config
5158
from pdnd_client.jwt_generator import JWTGenerator
5259
from pdnd_client.client import PDNDClient
5360

61+
# per produzione:
5462
config = Config("./configs/sample.json")
63+
# per collaudo usare invece:
64+
#config = Config("./configs/sample.json", "collaudo")
5565
jwt_gen = JWTGenerator(config)
66+
# per collaudo aggiungere:
67+
#jwt_gen.set_env("collaudo")
5668
token, exp = jwt_gen.request_token()
5769
client = PDNDClient()
5870
client.set_token(token)
@@ -228,7 +240,7 @@ Se un parametro non è presente nel file di configurazione, puoi definirlo come
228240
}
229241
}
230242
```
231-
## Esempio di configurazione per collaudo e prosuzione
243+
## Esempio di configurazione per collaudo e produzione
232244

233245
```json
234246
{

configs/sample.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
2+
"attestazione": {
3+
"kid": "kid",
4+
"issuer": "issuer",
5+
"clientId": "clientId",
6+
"purposeId": "purposeId",
7+
"privKeyPath": "/tmp/key.pem"
8+
},
29
"collaudo": {
310
"kid": "kid",
411
"issuer": "issuer",

pdnd_client/jwt_generator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ def set_env(self, env: "produzione") -> bool:
4242
if self.env == "collaudo":
4343
self.endpoint = "https://auth.uat.interop.pagopa.it/token.oauth2"
4444
self.aud = "auth.uat.interop.pagopa.it/client-assertion"
45+
elif self.env == "attestazione":
46+
self.endpoint = "https://auth.att.interop.pagopa.it/token.oauth2"
47+
self.aud = "auth.att.interop.pagopa.it/client-assertion"
4548
return True
4649

4750
def request_token(self) -> [str, int]:

0 commit comments

Comments
 (0)