Skip to content

Commit 9546e43

Browse files
authored
Merge pull request #12865 from nextcloud/enh/noid/oidc-admin-dev
Add small Oidc sections in admin and developer docs
2 parents 861c527 + 9a0a2e1 commit 9546e43

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

admin_manual/configuration_user/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ User management
1616
user_auth_ldap_api
1717
user_provisioning_api
1818
profile_configuration
19+
user_auth_oidc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
=======================================
2+
User authentication with OpenID Connect
3+
=======================================
4+
5+
Nextcloud users can authenticate via an external identity provider.
6+
Nextcloud can also be an identity provider itself.
7+
8+
Authentication in Nextcloud
9+
---------------------------
10+
11+
The `OpenID Connect user backend app <https://apps.nextcloud.com/apps/user_oidc>`_ makes it possible for users to
12+
authenticate using external Oidc identity providers.
13+
14+
This app can optionally be in charge of user provisioning (by creating users when they first connect) or rely on
15+
other user backends and only take care of authentication.
16+
17+
`More details in the project's README <https://github.com/nextcloud/user_oidc#user_oidc>`_
18+
19+
Using Nextcloud as an identity provider
20+
---------------------------------------
21+
22+
The `OIDC Identity Provider community app <https://apps.nextcloud.com/apps/oidc>`_
23+
can be installed to make Nextcloud an identity provider for other services.
24+
25+
This app will allow any Nextcloud user (managed by any user backend) to authenticate during an Oidc login flow.
26+
This is useful if you want your Nextcloud instance to be the authority regarding authentication and user profile data
27+
among multiple services.
28+
29+
Bearer token validation
30+
-----------------------
31+
32+
Nextcloud can accept Oidc ID tokens and access tokens as valid bearer token for API requests.
33+
If using an external identity provider, only the ``user_oidc`` app is necessary.
34+
35+
If Nextcloud is the identity provider, you will naturally need the ``oidc`` app to make Nextcloud an Oidc provider,
36+
and also the ``user_oidc`` app because it will take care of validating API requests authentication.
37+
In user_oidc, the ``oidc_provider_bearer_validation`` config flag needs to be set to true so ``user_oidc`` knows
38+
it needs to ask the ``oidc`` app to validate the received bearer tokens.
39+
40+
`More details on bearer token validation <https://github.com/nextcloud/user_oidc#bearer-token-validation>`_

developer_manual/digging_deeper/index.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Digging deeper
2121
flow
2222
npm
2323
notifications
24+
oidc
2425
out_of_office
2526
performance
2627
phonenumberutil
@@ -44,6 +45,6 @@ Digging deeper
4445
two-factor-provider
4546
status
4647
user_migration
47-
users
48+
users
4849
web_host_metadata
4950
time
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
=====================
2+
OpenID Connect (Oidc)
3+
=====================
4+
5+
There are multiple ways for apps to interact with the ``user_oidc`` and ``oidc`` apps.
6+
It is possible to get tokens from those apps and to ask them to validate tokens.
7+
All available events are in the ``user_oidc`` app even if some use case don't involve the main feature of this app.
8+
9+
`user_oidc events doc <https://github.com/nextcloud/user_oidc/tree/main/docs>`_
10+
11+
Getting the login token
12+
-----------------------
13+
14+
When using ``user_oidc``, which uses an external identity provider, the login token can be stored so apps can later
15+
get it via an event.
16+
17+
The ``store_login_token`` config flag must be enabled.
18+
The login token is automatically refreshed by ``user_oidc`` when needed during the user session.
19+
The login token can be obtained by apps by emitting the ``OCA\UserOIDC\Event\ExternalTokenRequestedEvent`` event.
20+
21+
Token exchange
22+
--------------
23+
24+
If the external identity provider supports token exchange, apps can ask ``user_oidc`` to perform one
25+
and deliver the exchanged token by emitting the ``OCA\UserOIDC\Event\ExchangedTokenRequestedEvent`` event.
26+
27+
Generating a token if Nextcloud is the provider
28+
-----------------------------------------------
29+
30+
If the ``oidc`` app is used to make Nextcloud an identity provider, some Nextcloud apps might need to ask
31+
Nextcloud to generate a token that they will use to authenticate against an external service.
32+
This requires both ``oidc`` and ``user_oidc`` apps installed (even if ``user_oidc`` is not used as a user backend).
33+
The token can be generated by emitting the ``OCA\UserOIDC\Event\InternalTokenRequestedEvent`` event.

0 commit comments

Comments
 (0)