Skip to content

[ResponseOps][Connectors] Use profileUid in actions client#254589

Merged
jcger merged 12 commits intoelastic:connectors-auth-code-grantfrom
jcger:issue-251047-use-profile-uid-task-exe_stack
Feb 25, 2026
Merged

[ResponseOps][Connectors] Use profileUid in actions client#254589
jcger merged 12 commits intoelastic:connectors-auth-code-grantfrom
jcger:issue-251047-use-profile-uid-task-exe_stack

Conversation

@jcger
Copy link
Copy Markdown
Contributor

@jcger jcger commented Feb 23, 2026

Summary

Closes #251047

Adds a getCurrentUserProfileId method to the Actions plugin so OAuth authorization-code connectors can use the user’s profile UID when running in per-user auth mode. Like proposed by the PoC bcb8207#diff-77a930ac5bc56dbf3f1c1165f9cc35b729e38a36a9b3dae00fc47782ec646b19R615

Add { unknowns: 'allow' } to the query schema so OAuth providers can include extra query parameters (e.g. scope, authuser) in the redirect URL without validation failures.

@jcger jcger marked this pull request as ready for review February 23, 2026 20:17
@jcger jcger requested a review from a team as a code owner February 23, 2026 20:17
…a into issue-251047-use-profile-uid-task-exe_stack
…a into issue-251047-use-profile-uid-task-exe_stack
…a into issue-251047-use-profile-uid-task-exe_stack
Copy link
Copy Markdown
Contributor

@lorenabalan lorenabalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small qs & nits but LGTM otherwise

return null;
}

const token = connectorToken as ConnectorToken;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keep the casting here but add the | UserConnectorToken? Wouldn't it be valid for L182-185 too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typescript wouldn't complain, but I think it's unnecessary because the properties we use (expiresAt/refreshTokenExpiresAt) exist in both types. It's also dangerous for us, hypothetically, you could have a per-user token here and the type would allow you to cast it as a ConnectorToken, but it would be wrong because per-user tokens have no top level token/refreshToken

Comment on lines +58 to +59
accessToken: string | null;
refreshToken: string | undefined;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this distinction null vs undefined, rather than both undefined? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can see null as "unexpected shape" error, whereas undefined means it's ok but just not set

Copy link
Copy Markdown
Contributor

@js-jankisalvi js-jankisalvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally with google drive workflow, works as expected 🎉

@jcger jcger force-pushed the connectors-auth-code-grant branch from 47b9df6 to 1907ce9 Compare February 24, 2026 22:08
@jcger jcger requested review from a team as code owners February 24, 2026 22:08
@jcger jcger force-pushed the issue-251047-use-profile-uid-task-exe_stack branch from 1d06d8e to 14a0a7e Compare February 24, 2026 22:12
@jcger jcger removed request for a team February 24, 2026 22:12
@jcger jcger force-pushed the issue-251047-use-profile-uid-task-exe_stack branch from ad54e5c to c7ac44d Compare February 25, 2026 09:39
@jcger jcger force-pushed the connectors-auth-code-grant branch from 20719b9 to e7e0dd0 Compare February 25, 2026 09:40
…a into issue-251047-use-profile-uid-task-exe_stack
@jcger jcger force-pushed the issue-251047-use-profile-uid-task-exe_stack branch from c7ac44d to 7bfc7a7 Compare February 25, 2026 09:42
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Feb 25, 2026

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #8 / discover responsive sidebar should not render buttons in data view picker when in viewer mode
  • [job] [logs] Jest Integration Tests #9 / SO type registrations does not remove types from registrations without updating excludeOnUpgradeQuery
  • [job] [logs] Jest Integration Tests #9 / SO type registrations does not remove types from registrations without updating excludeOnUpgradeQuery
  • [job] [logs] Jest Tests #1 / Stack Connectors Plugin setup() should register built in connector types
  • [job] [logs] Jest Tests #1 / Stack Connectors Plugin setup() should register built in connector types
  • [job] [logs] FTR Configs #29 / task_manager check_registered_task_types should check changes on all registered task types
  • [job] [logs] FTR Configs #29 / task_manager check_registered_task_types should check changes on all registered task types
  • [job] [logs] Jest Integration Tests #8 / workflow with retry retry is on workflow level does not perform retries when condition is ${{error.type == "SomeOtherError"}} should have correct workflow duration

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [e7e0dd0]

History

@jcger jcger merged commit 82a2597 into elastic:connectors-auth-code-grant Feb 25, 2026
12 of 13 checks passed
@jcger
Copy link
Copy Markdown
Contributor Author

jcger commented Feb 25, 2026

Merging because CI errors seem to come from the feature branch, not this one

jcger added a commit that referenced this pull request Mar 18, 2026
## Description

Currently, all Kibana connectors use a shared service account for
authentication. This approach lacks per user level access support, as it
does not distinguish between individual users and service account user
levels of permission. To support more secure, flexible, and user-aware
integrations, we need to introduce per-user authentication for
connectors in Kibana, alongside the existing service account method.

## 2-step release

As there are changes that require a 2-step release, this PR won't add
`oauth_authorization_code` auth type to any connector type. Therefore,
it won't be usable for now. The changes that require a 2-step release
are:
- we are adding `refreshTokenExpiresAt` to AAD for `connector_token` SO
- we are adding `refreshToken` as an encrypted attribute for
`connector_token` SO

## Config to run this locally
```
uiSettings:
  overrides:
    'workflows:ui:enabled': true
server.publicBaseUrl: 'http://localhost:5601'
```
Also, the auth type needs to be used in a connector. Reach out privately
to get the necessary info.

## Involved PRs:

- #246655
- #251873
- #251717
- #252566
- #252104
- #252307
- #252262
- #252501
- #253606
- #254589
- #254916
- Rename rate limit kbn setting 15d2c19
- Fix refresh token 34708e5

---------

Co-authored-by: Sean Story <sean.story@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Lorena Bălan <lorena.balan@elastic.co>
Co-authored-by: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Christos Nasikas <xristosnasikas@gmail.com>
Co-authored-by: Dennis Tismenko <dennis.tismenko@elastic.co>
qn895 pushed a commit to qn895/kibana that referenced this pull request Mar 18, 2026
## Description

Currently, all Kibana connectors use a shared service account for
authentication. This approach lacks per user level access support, as it
does not distinguish between individual users and service account user
levels of permission. To support more secure, flexible, and user-aware
integrations, we need to introduce per-user authentication for
connectors in Kibana, alongside the existing service account method.

## 2-step release

As there are changes that require a 2-step release, this PR won't add
`oauth_authorization_code` auth type to any connector type. Therefore,
it won't be usable for now. The changes that require a 2-step release
are:
- we are adding `refreshTokenExpiresAt` to AAD for `connector_token` SO
- we are adding `refreshToken` as an encrypted attribute for
`connector_token` SO

## Config to run this locally
```
uiSettings:
  overrides:
    'workflows:ui:enabled': true
server.publicBaseUrl: 'http://localhost:5601'
```
Also, the auth type needs to be used in a connector. Reach out privately
to get the necessary info.

## Involved PRs:

- elastic#246655
- elastic#251873
- elastic#251717
- elastic#252566
- elastic#252104
- elastic#252307
- elastic#252262
- elastic#252501
- elastic#253606
- elastic#254589
- elastic#254916
- Rename rate limit kbn setting 15d2c19
- Fix refresh token 34708e5

---------

Co-authored-by: Sean Story <sean.story@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Lorena Bălan <lorena.balan@elastic.co>
Co-authored-by: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Christos Nasikas <xristosnasikas@gmail.com>
Co-authored-by: Dennis Tismenko <dennis.tismenko@elastic.co>
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
## Description

Currently, all Kibana connectors use a shared service account for
authentication. This approach lacks per user level access support, as it
does not distinguish between individual users and service account user
levels of permission. To support more secure, flexible, and user-aware
integrations, we need to introduce per-user authentication for
connectors in Kibana, alongside the existing service account method.

## 2-step release

As there are changes that require a 2-step release, this PR won't add
`oauth_authorization_code` auth type to any connector type. Therefore,
it won't be usable for now. The changes that require a 2-step release
are:
- we are adding `refreshTokenExpiresAt` to AAD for `connector_token` SO
- we are adding `refreshToken` as an encrypted attribute for
`connector_token` SO

## Config to run this locally
```
uiSettings:
  overrides:
    'workflows:ui:enabled': true
server.publicBaseUrl: 'http://localhost:5601'
```
Also, the auth type needs to be used in a connector. Reach out privately
to get the necessary info.

## Involved PRs:

- elastic#246655
- elastic#251873
- elastic#251717
- elastic#252566
- elastic#252104
- elastic#252307
- elastic#252262
- elastic#252501
- elastic#253606
- elastic#254589
- elastic#254916
- Rename rate limit kbn setting 15d2c19
- Fix refresh token 34708e5

---------

Co-authored-by: Sean Story <sean.story@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Lorena Bălan <lorena.balan@elastic.co>
Co-authored-by: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Christos Nasikas <xristosnasikas@gmail.com>
Co-authored-by: Dennis Tismenko <dennis.tismenko@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants