Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
Expand Down Expand Up @@ -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
{
Expand Down
7 changes: 7 additions & 0 deletions configs/sample.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"attestazione": {
"kid": "kid",
"issuer": "issuer",
"clientId": "clientId",
"purposeId": "purposeId",
"privKeyPath": "/tmp/key.pem"
},
"collaudo": {
"kid": "kid",
"issuer": "issuer",
Expand Down
3 changes: 3 additions & 0 deletions pdnd_client/jwt_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
Loading