Skip to content

Commit 1ab3bcc

Browse files
Keychain Credentials Update (#695)
* Keychain Credentials Update Contains new content and screenshots on what a keychain credential is and how to use one. * remove new yarn stuff * run format * create a ____, is sub to Keychain Credentials * wording --------- Co-authored-by: Taylor Downs <[email protected]>
1 parent 1956a2f commit 1ab3bcc

File tree

7 files changed

+3526
-3438
lines changed

7 files changed

+3526
-3438
lines changed

docs/manage-projects/manage-credentials.md

Lines changed: 92 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ You can view the Credentials related to a Project under the Project
66
`Settings > Credentials` page. In this article, you'll learn how to manage your
77
credentials related to a project.
88

9-
### View all Project Credentials
9+
## View all Project Credentials
1010

1111
Via this `Credentials` page, you can see a list of all Credentials, including
1212
the name, type, and owner, and whether they are for a production environment.
@@ -21,7 +21,7 @@ etc.).
2121

2222
:::
2323

24-
### Create a new Credential
24+
## Create a new Credential
2525

2626
1. Click on the `New Credential` button, and choose the type of app you want to
2727
connect.
@@ -53,13 +53,101 @@ ask on [Community](https://community.openfn.org).
5353

5454
![New Credential Ready](/img/lightning_new_cred_ready.webp)
5555

56-
### Share Credentials
56+
## Keychain Credentials (Variable Auth)
57+
58+
Keychain credentials allow for a single job to make use of multiple credentials.
59+
They work by inspecting the data in the job's runtime state (i.e., state.data)
60+
and checking for the value of a predetermined identifier. Based on that value,
61+
present in the data for a given source message, for example, another credential
62+
will be selected and applied for that particular job run.
63+
64+
Keychain credentials allow for a single job to make use of multiple credentials.
65+
They work by inspecting the data in the initial input for a given run (e.g.,
66+
state.data) and checking for the value of a predetermined identifier.
67+
68+
Imagine you have 2 credentials in your project:
69+
70+
1. Taylor’s Login, External ID: abc123, Body:
71+
`{ username: “tay”, password: “shhhhh” }`
72+
73+
2. Roina’s Login, External ID: def456, Body:
74+
`{ username: “ro”, password: “veryshh” }`
75+
76+
And a job that uses a “Keychain Credential” with a path of `$.data.myId`.
77+
78+
If a job in your workflow uses the “Keychain Credential” and the initial
79+
dataclip for a given run looks like this:
80+
81+
```json
82+
{
83+
"data": {
84+
"content": "Hello world",
85+
"myId": "abc123"
86+
}
87+
}
88+
```
89+
90+
Then the keychain credential will search for abc123 in your project credentials
91+
and provide those secrets to the same job. I.e., the will run with the “Taylor’s
92+
Login” credential.
93+
94+
If another run is executed, and the initial dataclip for that run is:
95+
96+
```json
97+
{
98+
"data": {
99+
"content": "Goodbye!",
100+
"myId": "def456"
101+
}
102+
}
103+
```
104+
105+
The same job will run with the “Roina’s Login” credential.
106+
107+
:::info Notes & Limitations
108+
109+
Since credential secrets are fetched at the start of a run (not the start of a
110+
step) it’s not currently possible to resolve keychain credentials based on data
111+
that is added to state later in a run. I.e., the data must be present in the
112+
input dataclip for the whole run, not the input dataclip of the step that uses
113+
the keychain credential.
114+
115+
:::
116+
117+
### Create a Keychain Credential
118+
119+
1. On the `Credentials` page under project settings, click on the dropdown icon
120+
on the `Add New` button to select the Keychain option:
121+
122+
![](/img/keychain_credential_dropdown.webp)
123+
124+
2. Name your keychain credential and assign it a JSONPath expression. You can
125+
also select a default credential to use when the JSONPath expression doesn't
126+
match:
127+
128+
![](/img/keychain_modal.webp)
129+
130+
3. Assign an external ID for your keychain to access by creating a new
131+
credential or editing an existing credential:
132+
133+
![](/img/assign_externalID.webp)
134+
135+
4. Now on a job in your workflow, you are able to select and use a keychain
136+
credential:
137+
138+
![](/img/keychain_selection.webp)
139+
140+
5. You can now reference your keychain in your input to use it:
141+
142+
![](/img/keychain_input.webp)
143+
144+
## Share Credentials
57145

58146
If you own a Credential, you can choose which Project has access to it. To
59147
update which Projects your Credential is shared with, follow the steps on the
60148
[User Credentials docs page](/documentation/user-credentials).
61149

62-
### `Raw JSON` Credentials
150+
## `Raw JSON` Credentials
63151

64152
Raw credentials are valid JSON documents which are passed into a job's runtime
65153
state. Note that owners of these credentials will be able to view them, in their

static/img/assign_externalID.webp

18.5 KB
Loading
10.9 KB
Loading

static/img/keychain_input.webp

8.23 KB
Loading

static/img/keychain_modal.webp

13.4 KB
Loading

static/img/keychain_selection.webp

27.8 KB
Loading

0 commit comments

Comments
 (0)