Skip to content

Commit d9d3aa9

Browse files
committed
docs: add screenshots for clarity, update usage docs for credential provider utility functions
1 parent 922585a commit d9d3aa9

1 file changed

Lines changed: 59 additions & 5 deletions

File tree

docs/user/getting_started.rst

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ Credential Provider Utility Functions
7373

7474
The SDK contains three helper functions that will *return* an instantiated credential provider of the specified type. When leveraging these functions, ensure you have the required extra dependencies installed.
7575

76+
When using ``load_from_keychain``, **you must provide the identity keyword argument** required by the specified provider:
77+
78+
- ``username=`` for ``UserCredentialsProvider``
79+
- ``client_id=`` for ``ApiClientCredentialsProvider``
80+
7681
Prompting for Credentials
7782
^^^^^^^^^^^^^^^^^^^^^^^^^
7883

@@ -93,7 +98,11 @@ Loading from AWS Secrets Manager
9398

9499
.. important::
95100

96-
The ``aws`` dependency is required for this function and can be installed with ``% python3 -m pip install 'jamf-pro-sdk[aws]'``.
101+
The ``aws`` dependency is required for this function and can be installed via:
102+
103+
.. code-block:: console
104+
105+
% python3 -m pip install 'jamf-pro-sdk[aws]'
97106
98107
The ``SecretString`` is expected to be a JSON string in the following format:
99108

@@ -127,11 +136,38 @@ Loading from Keychain
127136

128137
.. important::
129138

130-
This utility requires the ``keyring`` extra dependency, which can be installed via ``% python3 -m pip install 'jamf-pro-sdk[macOS]'``.
139+
This utility requires the ``keyring`` extra dependency, which can be installed via:
140+
141+
.. code-block:: console
142+
143+
% python3 -m pip install 'jamf-pro-sdk[macOS]'
131144
132-
When using :class:`~jamf_pro_sdk.clients.auth.ApiClientCredentialsProvider`, the SDK expects the client ID and client secret to be stored using the format ``CLIENT_ID`` and ``CLIENT_SECRET`` respectively. For :class:`~jamf_pro_sdk.clients.auth.UserCredentialsProvider`, you will be prompted for a username.
145+
When using :class:`~jamf_pro_sdk.clients.auth.ApiClientCredentialsProvider`, the SDK expects:
133146

134-
Additionally, the :ref:`server scheme <server_scheme>` does not need to be passed to the ``server`` argument, as the SDK handles this for you.
147+
- The API **client ID** to be stored in the keychain under your Jamf Pro server name (as the *service_name*) with the client ID as the *username*, and its associated secret as the *password*.
148+
149+
.. image:: ../_static/api-keychain.png
150+
:alt: Example macOS Keychain entry for API credentials (client_id)
151+
:align: center
152+
:width: 400px
153+
154+
When using :class:`~jamf_pro_sdk.clients.auth.UserCredentialsProvider`, the SDK expects:
155+
156+
- A **username** to be passed, and the password to be retrieved from the keychain under the same server name and username.
157+
158+
.. image:: ../_static/user-keychain.png
159+
:alt: Example keychain entry for User credentials
160+
:align: center
161+
:width: 400px
162+
163+
.. note::
164+
165+
The ``server`` argument should not include the :ref:`scheme <server_scheme>`. The SDK normalizes this internally.
166+
167+
Use the appropriate keyword argument depending on the credential provider class:
168+
169+
- Use ``client_id=`` when using :class:`~jamf_pro_sdk.clients.auth.ApiClientCredentialsProvider`.
170+
- Use ``username=`` when using :class:`~jamf_pro_sdk.clients.auth.UserCredentialsProvider`.
135171

136172
.. code-block:: python
137173
@@ -140,10 +176,28 @@ Loading from Keychain
140176
... server="jamf.my.org",
141177
... credentials=load_from_keychain(
142178
... provider_type=ApiClientCredentialsProvider,
143-
... server="jamf.my.org"
179+
... server="jamf.my.org",
180+
... client_id="<client_id_here>" # Required keyword
144181
... )
145182
... )
146183
184+
.. code-block:: python
185+
186+
>>> from jamf_pro_sdk import JamfProClient, UserCredentialsProvider, load_from_keychain
187+
>>> client = JamfProClient(
188+
... server="jamf.my.org",
189+
... credentials=load_from_keychain(
190+
... provider_type=UserCredentialsProvider,
191+
... server="jamf.my.org",
192+
... username="<username_here>" # Required keyword
193+
... )
194+
... )
195+
196+
.. tip::
197+
198+
You can manage entries using the **Keychain Access** app on macOS. See: `Apple's Keychain User Guide <https://support.apple.com/guide/keychain-access/welcome/mac>`_.
199+
200+
147201
Access Tokens
148202
-------------
149203

0 commit comments

Comments
 (0)