Skip to content

Commit aff2b1e

Browse files
committed
Add Authentication topic
Example and graphics contributed by @ojeker
1 parent 585880b commit aff2b1e

File tree

5 files changed

+106
-2
lines changed

5 files changed

+106
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
QWC2 Documentation
2-
==================
1+
QWC Documentation
2+
=================
33

44
Published at [qwc-services.github.io](https://qwc-services.github.io).
55

qwc2.yml.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ nav:
2424
- Reports: topics/Reports.md
2525
- 3D View: topics/View3D.md
2626
- Translations: topics/Translations.md
27+
- Authentication: topics/authentication.md
2728
- Interfacing with applications: topics/Interfacing.md
2829
- Multi-tenancy: topics/MultiTenancy.md
2930
- References: references/index.md

src/images/iam-diagram.puml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@startuml
2+
3+
package Identity-Management{
4+
component "Authentication\nService 1" as as1 {
5+
artifact "Private-Key"
6+
}
7+
component "Authentication\nService 2" as as2 {
8+
artifact "Private-Key" as pk2
9+
}
10+
11+
component "Map Viewer" as client {
12+
artifact "ID-Token"
13+
}
14+
15+
package Benutzer-Register{
16+
database "IDP" as idp
17+
database "LDAP" as ldap
18+
}
19+
20+
as1 -- idp
21+
as2 -- ldap
22+
client -- as1
23+
client -- as2
24+
}
25+
26+
package Access-Management {
27+
component dataservice as ds {
28+
component "Access-Manager" {
29+
file permissions.json
30+
artifact "Public-Key"
31+
}
32+
33+
}
34+
}
35+
36+
client -- ds
37+
38+
@enduml

src/images/iam-diagram.svg

Lines changed: 1 addition & 0 deletions
Loading

src/topics/authentication.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Authentication
2+
3+
## Authentication Service
4+
5+
An authentication service uses a specific user identity store (e.g. DB, LDAP) or interacts with an Identity Provider (IdP) to confirm the user's identity. The service issues the JWT token, signs the token with a JWT secret key and transfers it to the web client.
6+
7+
QWC provides several authentication services:
8+
9+
- [Database Authentication Service](../../references/qwc-db-auth_readme/): Authenticates users against a database.
10+
- [LDAP Authentication Service](../../references/qwc-ldap-auth_readme/): Authenticates users against an LDAP server.
11+
- [OpenID Connect Authentication Service](../../references/qwc-oidc-auth_readme/): Authenticates users against OIDC providers like Keycloak, AD, etc.
12+
13+
### Access management
14+
15+
qwc-services-core library:
16+
17+
* Verifies the signature of the JWT token with the JTW secret key
18+
* Ensures that the JWT token has not expired
19+
* Extract permissions of a user from `permissions.json`
20+
21+
QWC Service:
22+
23+
* Uses `qwc-services-core` to read the permissions of the current user
24+
* Handles user permissions for certain resources (maps, layers, etc.)
25+
26+
## Artifacts
27+
28+
### JWT token
29+
30+
Token with a common structure between different authentication services, which contains the user name of the user logged in to the IDP.
31+
32+
The JWT token is usually transferred as part of the session cookie.
33+
34+
### permissions.json
35+
36+
Contains information about which users have read and write access to which layers.
37+
38+
## IAM example
39+
40+
![diagram.svg](../images/iam-diagram.svg)
41+
42+
Using the example of the Map Viewer, the Data Service, and the Authentication Services, the diagram explains how identity and access management works in conjunction with the various components of the QWC.
43+
44+
### Map Viewer
45+
46+
Web GIS component running in the browser. Retrieves an JWT token from the Authentication Service for the user and then uses it when communicating with the Data Service. Retrieves a new token when the currently used token expires.
47+
48+
Oauth2 role: Client
49+
50+
### Authentication Service
51+
52+
Issues the singed JWT token and returns it to the Map Viewer.
53+
54+
Oauth2 role: Authorization Server (authentication part).
55+
56+
Of the two tasks of authentication and authorization performed by an authorization server, the AS performs only authentication.
57+
58+
### Data Service
59+
60+
* Uses `qwc-services-core` to read the permissions of the current user.
61+
* Checks whether access to the layer is permitted for the user ID in the JWT token.
62+
* Then accesses the layer in read/write mode.
63+
64+
Oauth2 role: Resource server

0 commit comments

Comments
 (0)