samples-python icon indicating copy to clipboard operation
samples-python copied to clipboard

Add sample workflow for reauthentication after risk event

Open pankajtaneja5 opened this issue 7 months ago • 1 comments

🛠 What was changed

Added a new sample workflow: ReauthenticationAfterRiskEventWorkflow.
This workflow demonstrates an adaptive authentication pattern where users are required to reauthenticate after suspicious activity — such as login from a new device or after completing account recovery.

The worker listens for a reauth_complete signal, and the workflow can be configured with a timeout to handle cases where reauthentication isn't completed in time.

🔐 Why?

This use case is relevant for security-conscious applications that need to enforce reauthentication following risk events.
The sample highlights how Temporal can model secure, stateful authentication workflows that are durable, auditable, and cleanly separated from business logic.

It aligns with modern security practices around risk-based session validation and account protection.

✅ Checklist

  • [x] New sample added to samples-python
  • [x] Demonstrates secure workflow pattern using Temporal signals and timeouts
  • [x] Includes worker and starter code for demonstration

Notes

There wasn’t a separate issue filed for this PR.
If preferred, I can open one and link it here for tracking purposes.

Let me know if any adjustments are needed!

pankajtaneja5 avatar Jun 11 '25 23:06 pankajtaneja5