Skip to content

Commit

Permalink
Updates please build (#1674)
Browse files Browse the repository at this point in the history
* Updates please build

* Updates

* Updates

* Updates
  • Loading branch information
TheTechArch authored Jun 11, 2024
1 parent d794193 commit 1cd2aa1
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 3 deletions.
68 changes: 68 additions & 0 deletions content/authentication/_index.nb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: Authentication
description: The authentication component provides functionality to authenticate users and systems accessing Altinn Apps and Altinn platform.
tags: [platform, authentication]
toc: true
weight: 1
---

The authentication component is not an ID-provider and only create authentication sessions based on external ID-providers.

The authentication component creates JWT tokens with claims about user and system.
The claims are based on the authentication information coming from the ID-providers.

## Token exchange for Altinn Portal
When a user logs in to the Altinn Portal (Legacy Solution) it gets a Cookie containing information about the logged-in user. This cookie is
a [propiaritary format for ASP.NET](https://support.microsoft.com/en-us/help/301240/how-to-implement-forms-based-authentication-in-your-asp-net-applicatio) (Full Framework)
and can only be understood with application based on .NET Framework having access to the symmetric encryption key.

The Altinn Platform is based on .ASP.NET Core and can`t understand the cookie.

To allow for a user accessing an App in Altinn Apps or a component in Altinn Platform the current platform will
expose an API that can decrypt an ASP.NET cookie and return user information to the Authentication component in Altinn Platform.

## Token exchange for maskinporten
Organizations authenticated in maskinporten can exchange their JWT token for a valid Altinn Platform JWT token to be used against Altinn Apps and Altinn Platform.

## Token exchange for ID-porten
End users authenticated through ID-porten can exchange their JWT token for a valid Altinn Platform JWT token to be used agains Altinn Apps and Altinn Platform.


The solution is available at https://platform.altinn.cloud/authentication/api/v1.

## Authenticate user
The authentication resource enables authenticating a user and redirecting it to another Altinn-url.
If the user is not authenticated already it will be sent to the login page before redirecting the user to its final destination {url}.

```http
GET /authentication?goto={url}
```

## Refresh a valid JwtToken

```http
GET /refresh
```

## Exchange a JWT token from an external token provider

Accepted providers include: `maskinporten` and `id-porten`.
Request must include a bearer token in the authorization header.
Set test equal to true if retrieving a token for Testdepartementet.
(This ony works with maskinporten as the token provider.)

{{%notice info%}}
A token from id-porten contains both an id-token and and access-token.
Only the access token it to be exhanged using this endpoint.
{{% /notice%}}

```http
GET /exchange/{tokenProvider}?test={bool}
```



## Architecture

The [application construction components](/authentication/architecture/)
for details how this component is constructued.
6 changes: 3 additions & 3 deletions content/authentication/guides/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: User Guides
linktitle: User Guides
description: Read our collection of user guides related to Altinn Authentication.
title: "User Guides Authentication"
linktitle: "User Guides"
description: "Read our collection of user guides related to Altinn Authentication."
toc: false
weight: 4
---
Expand Down
11 changes: 11 additions & 0 deletions content/authentication/guides/_index.nb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: "User Guides Authentication"
linktitle: "Bruker guider"
description: "Read our collection of user guides related to Altinn Authentication."
toc: false
weight: 4
---

## Using Systemuser as system providers

This guide explains how a system vendor can use the system user concept in their software
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
title: Ta i bruk systembruker for systemleverandører
linktitle: Systembruker for systemleverandører
description: Systembruker er et nytt konsept for API autentisering. Denne guiden beskriver hvordan man som systemleverandør kan benytte seg av dette.
toc: false
weight: 1
---

{{<notice warning>}}
Denne funksjonaliteten er i test og kan endres
{{</notice>}}

## Bakgrunn

Bakgrunnen til systembruker konsept kan leses om her.

## Forutsetninger

Forutsetninger for at man systemleverandør kan benytte seg systembruker er.

- Avtale med maskinporten som klient
- Avtale med Digdir som gir tilgang til systemregister

## Sette opp maskinporten integrasjon

For å konsumere offentlige API med systembrukere trenger man å registrere minst en MaskinPorten integrasjon.
Dette kan gjøres i [sammarbeidsportalen](https://docs.digdir.no/docs/Maskinporten/maskinporten_sjolvbetjening_web#opprette-klient-for-%C3%A5-konsumere-api) eller via [API](https://docs.digdir.no/docs/Maskinporten/maskinporten_sjolvbetjening_api#registrere-klient).

## Registrere system

Første steg etter man har fått tilgang til systemregisteret er å registrere systemet.

Systemet er da typisk en nettbasert programvare som er tilgjengelig i markedet som sluttkunder (virksomheter) kan
benytte seg av for kommunukasjon med det offentlige.

Systemet må beskrives med følgende egenskaper

### SystemTypeId

Dette er en unik ID som vil benyttes for å identifisere programvaren. Gyldige tegn er a-z 0-9 og _

### KlientId

Dette er klientidene for integrasjonen som er opprettet i Maskinporten.
Det er kun pålogginger med Maskinportenintegrasjoner som er knyttet mot oppgitte klientider.


```json
{
"SystemTypeId": "visma_supertax",
"SystemVendor": "978234522",
"Name": {
"en": "Visma Super Tax",
"nb" : "Visma superskatt"
"Description": {
"en": "Visma Super Tax allows for .........",
"nb": "Visma superskatt gir deg mulighet...."
}
},
"AccessGroupNeeds": ["MVA", "SKATT"],
"ResourceNeeds": ["urn:altinn:resource:skd/mva"],.
"ClientId":["123123","234534552345"]
}
```

## Maskinporten autentisering

Når system skal autentisere seg som systembrukeren til kunden må JWT grant forespørselen til maskinporten inneholde informasjon om kunden


### JWT Grant

```json
{
"aud": "https://maskinporten.no/",
"iss": "0e85a8ba-77e8-4a6c-a0f5-74fc328a9ffb",

"scope": "digdir:dialogporten skatteetaten:mva"

"authorization_details": [ {
"type": "urn:altinn:systemuser",
"systemuser_org": {
"authority" : "iso6523-actorid-upis",
"ID": "0192:999888777"
}
}]
}

```


### JWT Token


```json
{
"iss": "https://maskinporten.no",
"scope": "some_scope",
"client_id": "my_client_id",
"exp": 1520589928,
"iat": 1520589808,
"jti": "asdjkl5434jlkfds"

"authorization_details": [ {
"type": "urn:altinn:systemuser",
"systemuser_id": [ "a_unique_identifier_for_the_systemuser" ],
"systemuser_org": {"authority" : "iso6523-actorid-upis", "ID": "0192:999888777" },
"system_id": "a_unique_identifier_for_the_system",
}]
}

```
Se også dokumentasjon hos [Maskinporten](https://docs.digdir.no/docs/Maskinporten/maskinporten_func_systembruker).


## Bruk av systembrukertoken mot API

Tokenet man får fra maskinporten legges ved som et bearer token mot de API man skal kalle.


## Test av systembruker i TT02

For å teste systembruker i TT02 kreves følgende

- Systemleverandør opprettet i maskinporten. Gjøres via [email protected]
- Systemleverandør opprettet i Altinn. Gjøres vie [email protected]
- Systemintegrasjon opprettet i maskinporten test.


For opprettelse av systembrukere kan testbrukere/organisasjoner fra Tenor benyttes

0 comments on commit 1cd2aa1

Please sign in to comment.