diff --git a/README.md b/README.md index ec1204d..6fa9777 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,13 @@ MIT 2. Configura il file JSON con i parametri richiesti (esempio in `configs/sample.json`): ```json { + "attestazione": { + "kid": "kid", + "issuer": "issuer", + "clientId": "clientId", + "purposeId": "purposeId", + "privKeyPath": "/tmp/key.pem" + }, "collaudo": { "kid": "kid", "issuer": "issuer", @@ -51,8 +58,13 @@ from pdnd_client.config import Config from pdnd_client.jwt_generator import JWTGenerator from pdnd_client.client import PDNDClient +# per produzione: config = Config("./configs/sample.json") +# per collaudo usare invece: +#config = Config("./configs/sample.json", "collaudo") jwt_gen = JWTGenerator(config) +# per collaudo aggiungere: +#jwt_gen.set_env("collaudo") token, exp = jwt_gen.request_token() client = PDNDClient() client.set_token(token) @@ -228,7 +240,7 @@ Se un parametro non รจ presente nel file di configurazione, puoi definirlo come } } ``` -## Esempio di configurazione per collaudo e prosuzione +## Esempio di configurazione per collaudo e produzione ```json { diff --git a/configs/sample.json b/configs/sample.json index 227ddbf..78e3906 100644 --- a/configs/sample.json +++ b/configs/sample.json @@ -1,4 +1,11 @@ { + "attestazione": { + "kid": "kid", + "issuer": "issuer", + "clientId": "clientId", + "purposeId": "purposeId", + "privKeyPath": "/tmp/key.pem" + }, "collaudo": { "kid": "kid", "issuer": "issuer", diff --git a/pdnd_client/jwt_generator.py b/pdnd_client/jwt_generator.py index ed5a1de..0a03d73 100644 --- a/pdnd_client/jwt_generator.py +++ b/pdnd_client/jwt_generator.py @@ -42,6 +42,9 @@ def set_env(self, env: "produzione") -> bool: if self.env == "collaudo": self.endpoint = "https://auth.uat.interop.pagopa.it/token.oauth2" self.aud = "auth.uat.interop.pagopa.it/client-assertion" + elif self.env == "attestazione": + self.endpoint = "https://auth.att.interop.pagopa.it/token.oauth2" + self.aud = "auth.att.interop.pagopa.it/client-assertion" return True def request_token(self) -> [str, int]: