ancient-wolf-19325
08/22/2024, 6:41 PMuser_identity = context.execution_metadata.security_context.user_identity
I followed the references to some merged PRs. Is this still not released or is there a way to get the authenticated user in a workflow or task?
# Answer
The user_identity feature has been merged and is available in Flyte. You can access the authenticated user identity in a workflow or task using the context.execution_metadata.security_context.user_identity. This feature was introduced to allow tasks to access the identity of the user who initiated the workflow.
For example, you can access the user_identity in a Flyte task as follows:
from flytekit import task, workflow, current_context
@task
def my_task():
context = current_context()
user_identity = context.execution_metadata.security_context.user_identity
print(f"User Identity: {user_identity}")
@workflow
def my_workflow():
my_task()
Would you like more details on how to configure and use this feature?
Sources:
- Add identity to task execution metadata
- Flyte Project isolation
Slack Link
https://flyte-org.slack.com/archives/CP2HDHKE1/p1724352051.634969 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.