Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechArch committed Jun 11, 2024
1 parent 8cd25d3 commit 49b2720
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 63 deletions.
4 changes: 2 additions & 2 deletions content/authentication/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ weight: 1
<h2 class="a-h3">Find out more</h2>
<p class="a-js-truncate-2">Read more about Altinn Authentication</p>
<div class="a-illustration-icon">
<img src="./authorization-1.drawio.svg">
<img src="./authentication.drawio.svg">
<div class="a-illustration-overlay">
<span class="sr-only">About Altinn Authentication</span>
</div>
Expand Down Expand Up @@ -46,7 +46,7 @@ weight: 1
<h2 class="a-h3">Get started</h2>
<p class="a-js-truncate-2">Create your first resource</p>
<div class="a-illustration-icon">
<img src="./authorization-1.drawio.svg">
<img src="./authentication.drawio.svg">
<div class="a-illustration-overlay">
<span class="sr-only">Create your first resource</span>
</div>
Expand Down
113 changes: 52 additions & 61 deletions content/authentication/_index.nb.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,55 @@ 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.
<div class="row adocs-featuredBlocks">
<div class="col-12 col-lg-6 mb-5">
<div style="text-align: center;">
<h2 class="a-h3">Find out more</h2>
<p class="a-js-truncate-2">Read more about Altinn Authentication</p>
<div class="a-illustration-icon">
<img src="./authentication.drawio.svg">
<div class="a-illustration-overlay">
<span class="sr-only">About Altinn Authentication</span>
</div>
</div>
</div>
<div class="a-list-container mb-2 mx-auto mx-lg-6">
<ul class="a-list a-list-noIcon">
<li class="a-dotted a-clickable a-list-hasRowLink">
<a href="about" class="a-list-rowLink">
<div class="row">
<div class="col">
About Altinn Authentication
</div>
</div>
</a>
</li>
<li class="a-dotted a-clickable a-list-hasRowLink">
<a href="what-do-you-get" class="a-list-rowLink">
<div class="row">
<div class="col">
What do you get?
</div>
</div>
</a>
</li>
</ul>
</div>
</div>
<div class="col-12 col-lg-6 mb-5">
<div style="text-align: center;">
<h2 class="a-h3">Get started</h2>
<p class="a-js-truncate-2">Create your first resource</p>
<div class="a-illustration-icon">
<img src="./authentication.drawio.svg">
<div class="a-illustration-overlay">
<span class="sr-only">Create your first resource</span>
</div>
</div>
</div>
<div class="a-list-container mb-2 mx-auto mx-lg-6">
<ul class="a-list a-list-noIcon">
</ul>
</div>
</div>
</div>
6 changes: 6 additions & 0 deletions content/authentication/authentication.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ To access Altinn's API, the service owner needs the following

This can be ordered from Altinn [email protected]

When API scopes are assigned to the organization, an integration in Maskinporten can be set up and assigned the scopes.

By authenticating against Maskinporten with the relevant client, one then receives a token that is authorized for these APIs.

This Maskinporten token must be exchanged for an Altinn token.

The setup of the Maskinporten client and the exchange process are described [here](/api/authentication/maskinporten/).

## Set up access management in your own application

In the application that offers the service, the service owner must set up access management for when users access functionality
Expand Down

0 comments on commit 49b2720

Please sign in to comment.