You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* docs(orchestrator): added section on required workflow application.properties configuration and more improvements
* fix following code review and added section about backstage auth config requirement
# Requesting Authentication in Workflow Input Schema
2
2
3
-
This guide explains how to declare authentication requirements in a SonataFlow workflow input schema. This is necessary when a workflow interacts with external APIs that require user authorization — such as GitHub, GitLab, or Microsoft Graph.
4
-
5
-
Common use cases include:
6
-
7
-
- Creating a GitHub pull request
8
-
- Accessing private GitLab repositories
9
-
- Calling Microsoft Graph APIs on behalf of the user
3
+
This guide explains how to declare authentication requirements in a SonataFlow workflow input schema for the orchestrator plugin. It enables workflows to access external APIs on behalf of the user by forwarding authentication tokens from the user’s active Backstage session to SonataFlow.
10
4
11
5
## Key Concept
12
6
13
-
To request tokens, you define a **virtual field** in the input schema that triggers Backstage’s authentication system. This field:
14
-
15
-
- Does **not appear** in the form
16
-
- Is **not persisted** or included in the workflow input data
17
-
- Can have **any field name**
18
-
- Uses a special widget to signal token requirements
19
-
20
-
## What Matters
7
+
To request tokens, you define a **virtual field** in the workflow’s input schema that triggers Backstage’s authentication system. Once tokens are obtained, Backstage forwards them to the SonataFlow `execute` API as HTTP headers. These headers must match the configuration defined in the workflow’s OpenAPI specification.
> 🔗 See the [SonataFlow token propagation documentation](https://www.rhdhorchestrator.io/main/docs/serverless-workflows/configuration/token-propagation/) for more details.
52
27
53
-
### ✅ `ui:widget`: must be `"AuthRequester"`
28
+
##Input Schema AuthRequester Field
54
29
55
-
### ✅ `ui:props.authTokenDescriptors`: required
30
+
### Field Behavior
56
31
57
-
## Field Definition Reference
32
+
- Does **not appear** in the form
33
+
- Is **not persisted** or included in the workflow input data
34
+
- Can have **any field name**
35
+
- Must **not be listed** in the schema's `required` array
36
+
- Only one `AuthRequester` field is needed, even for multiple providers. If multiple are included, only one will be applied.
|`ui:widget`| string | Yes | Must be `"AuthRequester"`|
47
+
|`ui:props.authTokenDescriptors`| array of objects | Yes | List of token requirements |
48
+
| — `provider`| string | Yes | One of `github`, `gitlab`, `microsoft`|
49
+
| — `tokenType`| string | Yes |`"oauth"` or `"openId"`|
50
+
| — `scope`| string or string[]| Optional | Scope(s) to request, e.g., `"repo"` or `["repo", "read:user"]`|
74
51
75
-
## Multiple Providers Example
52
+
## Example
76
53
77
-
```json
54
+
```
78
55
{
79
56
"authSetup": {
80
57
"type": "string",
@@ -96,20 +73,20 @@ All other properties are either ignored or required solely for schema validity.
96
73
}
97
74
```
98
75
99
-
In this example, the form will trigger login/token requests for GitHub and Microsoft, using the specified scopes where given.
76
+
In this example, the form will trigger the login popup for GitHub and Microsoft, using the specified scopes where given. If the user is already logged in with the specified scopes, the popup will not appear, and the tokens from earlier login will be propagated.
100
77
101
-
## About `tokenType`
78
+
## `tokenType` details
102
79
103
80
The `tokenType` field defines which type of token Backstage should return:
|`"openId"`| Retrieves an **ID token** (OpenID Connect) — used mainly for identity verification. Uses Backstage [getIdToken](https://backstage.io/docs/reference/core-app-api.oauth2.getidtoken/). |
109
86
110
-
> ⚠️ Github backstage OAuth provider doesn't support openId tokens.
87
+
> ⚠️ GitHub's Backstage OAuth provider does **not**support `openId` tokens.
111
88
112
-
## About Scopes
89
+
## Scopes details
113
90
114
91
When specifying the `scope` field, refer to the official documentation for available scopes and their meanings:
115
92
@@ -121,9 +98,9 @@ GitHub scopes control access to repositories, user data, and other GitHub featur
121
98
122
99
**Examples:**
123
100
124
-
-`"repo"` – Full control of private and public repositories
125
-
-`"read:user"` – Read profile info
126
-
-`"workflow"` – Access GitHub Actions
101
+
- "repo" – Full control of private and public repositories
102
+
- "read:user" – Read profile info
103
+
- "workflow" – Access GitHub Actions
127
104
128
105
---
129
106
@@ -135,9 +112,9 @@ GitLab scopes are used in OAuth and determine what actions the token allows.
135
112
136
113
**Examples:**
137
114
138
-
-`"read_user"` – Read user profile
139
-
-`"api"` – Full API access
140
-
-`"write_repository"` – Push access
115
+
- "read_user" – Read user profile
116
+
- "api" – Full API access
117
+
- "write_repository" – Push access
141
118
142
119
---
143
120
@@ -149,13 +126,14 @@ Microsoft tokens usually access Microsoft Graph, covering users, calendar, mail,
149
126
150
127
**Examples:**
151
128
152
-
-`"User.Read"` – Read user profile
153
-
-`"Mail.Read"` – Read email
154
-
-`"Calendars.Read"` – Read calendar events
129
+
- "User.Read" – Read user profile
130
+
- "Mail.Read" – Read email
131
+
- "Calendars.Read" – Read calendar events
155
132
156
-
---
133
+
## ⚙️ Required Backstage Auth Configuration
157
134
158
-
## Notes
135
+
To use this feature, the relevant authentication providers must be properly configured in your Backstage app. This ensures the necessary tokens can be obtained when the workflow requests them. Each provider must be declared under the `auth.providers` section in `app-config.yaml`.
159
136
160
-
- Only one `AuthRequester` field is needed per form, even for multiple providers. If multiple ones are included, only one of them will be applied.
161
-
- Never rely on the value of this field — it will always be `undefined`.
0 commit comments