Skip to content

Commit 6722739

Browse files
committed
Add third-party logins page
Add missing participant creation
1 parent 074bcd2 commit 6722739

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: Third-party login
3+
tx_slug: documentation_reference_qfieldcloud_sso_auth
4+
---
5+
6+
# Third-party authentication
7+
8+
QFieldCloud and QField / QFieldSync clients allow authentication using regular login and password, for a user that is already registered on QFieldCloud.
9+
10+
It is also possible to authenticate using a third-party identity provider (e.g. Google, [OpenID Connect](https://openid.net/developers/how-connect-works/)).
11+
12+
Here is a sequence diagram of how a third-party login happens in QFieldCloud (in the browser):
13+
14+
```mermaid
15+
sequenceDiagram
16+
autonumber
17+
18+
actor User
19+
participant QFC as QFieldCloud
20+
21+
User ->> QFC: Access login page
22+
QFC -->> User: Display login form with configured third-party login buttons
23+
24+
User ->> QFC: Click third-party login button
25+
26+
create participant IDP as Identity Provider
27+
QFC ->> IDP: Redirect to IDP for login
28+
IDP -->> User: Display IDP's login form
29+
30+
User ->> IDP: Log in using IDP's credentials
31+
destroy IDP
32+
33+
IDP ->> QFC: Redirect back with auth details
34+
35+
alt User does not already have a QFieldCloud account
36+
note over QFC: QFieldCloud account is created using IDP auth details
37+
end
38+
39+
QFC -->> User: User is logged in
40+
```
41+
42+
Here is a sequence diagram of how third-party authentication happens in QField and QFieldSync:
43+
44+
```mermaid
45+
sequenceDiagram
46+
autonumber
47+
48+
participant IDP as Identity Provider
49+
actor User
50+
participant QF as QField / QFieldSync
51+
participant QFC as QFieldCloud
52+
53+
User ->>+ QF: Open the QFieldCloud login dialog
54+
55+
QF ->> QFC: Ask for configured third-party ID providers
56+
QFC -->> QF: Answer with the list of configured third-party ID providers
57+
QF -->>- User: Display a button for each third-party ID provider
58+
59+
User ->>+ QF: Click on 'Login with XYZ' provider button
60+
61+
Note over QF: A QgsAuthMethodConfig of type OAuth2 is created<br/>QGIS auth manager recognizes that the user is not authenticated yet<br/> QGIS auth manager then redirects to the IDP for authenticating the user
62+
63+
QF ->>+ IDP: Redirect to IDP for login
64+
IDP -->> User: Display IDP's login form in a browser
65+
User ->> IDP: Log in using IDP's credentials in the browser
66+
IDP ->>- QF: Answer with auth details and an id_token token
67+
68+
QF ->>+ QFC: Ask for current user's informations
69+
Note over QF,QFC: The id_token provided by IDP is in in the X-QFC-ID-Token HTTP header<br/>The IDP provider type (e.g. "google") is in the X-QFC-IDP-ID header
70+
71+
QFC -->>- QF: Answer with user information (username, avatar, etc.)
72+
QF -->>- User: User is logged in and authenticated
73+
74+
loop send HTTP regular requests (e.g. file synchronization)
75+
QF ->> QFC: Send a request (e.g. file Download/Upload)
76+
Note over QF,QFC: The id_token provided by IDP is in in the X-QFC-ID-Token HTTP header<br/>The IDP provider type (e.g. "google") is in the X-QFC-IDP-ID header
77+
QFC -->> QF: Reply to the request
78+
end
79+
80+
loop refresh token regularly
81+
QF ->> IDP: Ask for a new token
82+
IDP -->> QF: Send a refreshed token
83+
end
84+
```

0 commit comments

Comments
 (0)