Skip to content

Commit c3c5716

Browse files
committed
doc: various improvements
1 parent 69ceb8c commit c3c5716

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

doc/client-applications.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ OIDC Client registration
6666
~~~~~~~~~~~~~~~~~~~~~~~~
6767

6868
Before your application can authenticate against the IAM server, it must register and give provide details
69-
such as the allowed redirection URIs. To achieve this you can use the :class:`~canaille.oidc.models.Client`
69+
such as the allowed redirection URIs. To achieve this you can use the :class:`~canaille.oidc.basemodels.Client`
7070
model. Let us suppose your application have a ``/authorize`` endpoint for the authorization code - token exchange:
7171

7272
.. code:: python
@@ -109,6 +109,12 @@ client registration. Here is an example of dynamic registration you can implemen
109109
client_id = response.json["client_id"]
110110
client_secret = response.json["client_secret"]
111111
112+
.. note::
113+
114+
Canaille has a :attr:`~canaille.oidc.basemodels.Client.trusted` parameter.
115+
When it is :data:`True` for a client, end-users won't be showed a consent page
116+
when the client redirect them to the IAM authorization page.
117+
112118
Nominal authentication workflow
113119
-------------------------------
114120

@@ -255,3 +261,12 @@ to the IAM authorization endpoint with the ``prompt=create`` parameters.
255261
assert "User account successfully created" in res.text
256262
257263
Unfortunately there is no helpers for account creation in the fashion of :meth:`~pytest_iam.Server.login`.
264+
265+
Provisioning
266+
------------
267+
268+
The ``iam_server`` instance provides a `SCIM2 provisioning API <https://scim.libre.sh>`_ at the address ``/scim/v2``.
269+
You can use it to update your user profiles directly at the IAM.
270+
You can have a look to the :doc:`Canaille documentation <canaille:tutorial/provisioning>` to see implementation details.
271+
272+
To perform SCIM requests you might be interested in tools such as `scim2-client <https://scim2-cli.readthedocs.io>`_.

pytest_iam/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __init__(self, app: Flask, port: int, backend: Backend, logging: bool = Fals
5151
self.port = port
5252
self.logging = logging
5353
self.httpd = wsgiref.simple_server.make_server(
54-
"localhost", port, app, handler_class=self.make_request_handler()
54+
"localhost", port, app, handler_class=self._make_request_handler()
5555
)
5656
self.models = models
5757
self.logged_user = None
@@ -75,7 +75,7 @@ def logged_user():
7575
except AttributeError:
7676
pass
7777

78-
def make_request_handler(self):
78+
def _make_request_handler(self):
7979
server = self
8080

8181
class RequestHandler(WSGIRequestHandler):
@@ -114,7 +114,7 @@ def random_group(self, **kwargs) -> Group:
114114

115115
return group
116116

117-
def random_token(self, subject, client, **kwargs) -> Token:
117+
def random_token(self, subject: User, client: Client, **kwargs) -> Token:
118118
"""Generate a test :class:`~canaille.oidc.basemodels.Token` with random values.
119119
120120
Any parameter will be used instead of a random value.
@@ -138,7 +138,7 @@ def random_token(self, subject, client, **kwargs) -> Token:
138138

139139
return token
140140

141-
def login(self, user):
141+
def login(self, user: User):
142142
"""Open a session for the user in the IAM session.
143143
144144
This allows to skip the connection screen.
@@ -151,7 +151,7 @@ def logout(self):
151151
self.logged_user = None
152152
self.login_datetime = None
153153

154-
def consent(self, user, client=None):
154+
def consent(self, user: User, client: Client | None = None):
155155
"""Make a user consent to share data with OIDC clients.
156156
157157
:param client: If :const:`None`, all existing clients are consented.

0 commit comments

Comments
 (0)