Kom i gang med Altinn Autorisasjon
Her finner informasjon om hvordan komme i gang med Altinn autorisasjon
For å bruke Altinn API, krever flere scenarier en Maskinporten-klient:
- Kalle Altinn API som en organisasjon
- Autentisering som en bedriftsbruker
- Autentisering som systembruker
Sette opp Maskinporten-integrasjon
Maskinporten-klienter administreres i Samarbeidsportalen testmiljøet
Valg av scopes
Avhengig av bruk må du velge de riktige scopene
Scope | Usage | Description |
---|---|---|
altinn:instances.read | Altinn Apps API read | |
altinn:instances.write | Altinn Apps API write | |
altinn:authentication/systemregister | Access to system register | For system providers that need to mange systems available in system register |
altinn:authorization/authorize | Access to PDP endpoint | For orgs that need to authorize access |
For en liste over eldre scopes, se her.
Opprette JWK
Du må oppgi din egen JWK for klienten. Et alternativ for å opprette JWK er å bruke Altinn JWKS-verktøyet til dette.
Tilgjengelig her
PS C:\keys> altinn-jwks create testklient
Generating key testklient-TEST.2024-07-10
Generating key testklient-PROD.2024-07-10
PS C:\keys> altinn-jwks export maskinporten testklient
[{"alg":"RS256","e":"AQAB","key_ops":[],"kid":"testklient-TEST.2024-07-10","kty":"RSA","n":"va4lqufzxUFe9WkTnmA7EvJ0G6LT1MHpDqSepil_F6JZJ7quG8t65pSMJVu-BDlVNep9KTikmnZLks0ifaI60vsvV0JbvU6DtGNmA8QNGFDGpLedChkA1AwBhYflrvAX_fag8tUg2WTxuLclyJ4zpyOUP3F72bf7OP5r5YIBKM4QkBYwQm2FmK70RirhU4vC_wzvOTt5weDuu_Dvx74FXaB3YtEPM1c5unS-AAkKLbRyrEsD78Fh8EMp0ZtWSsceqhOOIeDL2iY1_KGk8yT585xvO1id8iNcQUoAggJ2s6qCCPAqg13y5X1_CtvPvEG179h2AJT100D85AtDvYr2LQ","oth":[],"use":"sig","x5c":[]}]
Når offentlige nøkler er opprettet, kan de lastes opp i portalen
Hvis du bruker Azure Keyvault til å lagre dine private nøkler, må disse være base64-kodet før de legges til i hemmelighetene
PS C:\keys> altinn-jwks export key testklient --base64
eyJhbGciOiJS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MGJsMXZpbUdRU0R6UUtsbkRkYk5XX2phVWl5LUJOU1lFZ1BMVnB1dDFpSzFnWWQyaENyX1BrV2hLWmV1TFh0SExJaUFPRGpuV2RzYW5STTN6VE9udyIsInVzZSI6InNpZyIsIng1YyI6W119
Autentisering med klient
En detaljert beskrivelse av hvordan du autentiserer klienten din med JWT Grant, finner du her.
Hvis du bruker .Net, kan du vurdere vår .Net Maskinporten-klient.