@@ -281,43 +281,45 @@ In other words, authorization callbacks are async, take a nullable OIDCUserModel
281281A table (below ) is available for comparing possible configuration states with the policy that will be enforced .
282282
283283### ` @workflow `
284- The ` @workflow ` decorator accepts the optional parameters ` auth: Authorizer ` and ` retry_auth: Authorizer ` .
285284
286- ` auth ` will be used to determine the authorization of a user to start the workflow .
287- If ` auth ` is omitted , the workflow is authorized for any logged in user .
285+ The ` @workflow ` decorator accepts the optional parameters ` authorize_callback: Authorizer ` and ` retry_auth_callback: Authorizer ` .
288286
289- ` retry_auth ` will be used to determine the authorization of a user to start , resume , or retry the workflow from a failed step .
290- If ` retry_auth ` is omitted , then ` auth ` is used to authorize .
287+ ` authorize_callback ` will be used to determine the authorization of a user to start the workflow .
288+ If ` authorize_callback ` is omitted , the workflow is authorized for any logged in user .
291289
292- (This does not percolate past an ` @inputstep ` that specifies ` resume_auth ` or ` retry_auth ` .)
290+ ` retry_auth_callback ` will be used to determine the authorization of a user to start , resume , or retry the workflow from a failed step .
291+ If ` retry_auth_callback ` is omitted , then ` authorize_callback ` is used to authorize .
292+
293+ (This does not percolate past an ` @inputstep ` that specifies ` resume_auth_callback ` or ` retry_auth_callback ` .)
293294
294295Examples :
295296
296- * ` auth =None, retry_auth =None` : any user may run the workflow .
297- * ` auth =A, retry_auth =B` : users authorized by A may start the workflow . Users authorized by B may retry on failure .
297+ * ` authorize_callback =None, retry_auth_callback =None` : any user may run the workflow .
298+ * ` authorize_callback =A, retry_auth_callback =B` : users authorized by A may start the workflow . Users authorized by B may retry on failure .
298299 * Example : starting the workflow is a decision that must be made by a product owner . Retrying can be made by an on - call member of the operations team .
299- * ` auth =None, retry_auth =B` : any user can start the workflow , but only users authorized by B may retry on failure .
300+ * ` authorize_callback =None, retry_auth_callback =B` : any user can start the workflow , but only users authorized by B may retry on failure .
300301
301302### ` @inputstep `
302- The ` @inputstep ` decorator accepts the optional parameters ` resume_auth : Authorizer` and ` retry_auth : Authorizer` .
303+ The ` @inputstep ` decorator accepts the optional parameters ` resume_auth_callback : Authorizer` and ` retry_auth_callback : Authorizer` .
303304
304- ` resume_auth ` will be used to determine the authorization of a user to resume the workflow when suspended at this inputstep .
305- If ` resume_auth ` is omitted , then the workflow ' s `auth ` will be used.
305+ ` resume_auth_callback ` will be used to determine the authorization of a user to resume the workflow when suspended at this inputstep .
306+ If ` resume_auth_callback ` is omitted , then the workflow ' s `authorize_callback ` will be used.
306307
307- ` retry_auth ` will be used to determine the authorization of a user to retry the workflow from a failed step following the inputstep .
308- If ` retry_auth ` is omitted , then ` resume_auth ` is used to authorize retries .
309- If ` resume_auth ` is also omitted , then the workflow ’s ` retry_auth ` is checked , and then the workflow ’s ` auth ` .
308+ ` retry_auth_callback ` will be used to determine the authorization of a user to retry the workflow from a failed step following the inputstep .
309+ If ` retry_auth_callback ` is omitted , then ` resume_auth_callback ` is used to authorize retries .
310+ If ` resume_auth_callback ` is also omitted , then the workflow ’s ` retry_auth_callback ` is checked , and then the workflow ’s ` authorize_callback ` .
310311
311312In summary :
312313
313- * A workflow establishes ` auth ` for starting , resuming , or retrying .
314- * The workflow can also establish ` retry_auth ` , which will override ` auth ` for retries .
315- * An inputstep can override the existing ` auth ` with ` resume_auth ` and the existing ` retry_auth ` with its own ` retry_auth ` .
314+ * A workflow establishes ` authorize_callback ` for starting , resuming , or retrying .
315+ * The workflow can also establish ` retry_auth_callback ` , which will override ` authorize_callback ` for retries .
316+ * An inputstep can override the existing ` authorize_callback ` with ` resume_auth_callback ` and the existing ` retry_auth_callback ` with its own ` retry_auth_callback ` .
316317* Subsequent inputsteps can do the same , but any None will not overwrite a previous not - None .
317318
318319### Policy resolutions
319320Below is an exhaustive table of how policies (implemented as callbacks ` A ` , ` B ` , ` C ` , and ` D ` )
320321are prioritized in different workflow and inputstep configurations .
322+ For brevity , the ` _callback ` parameter suffix has been ommitted .
321323
322324<table >
323325 <thead >
@@ -334,7 +336,7 @@ are prioritized in different workflow and inputstep configurations.
334336 <th></th>
335337 </tr>
336338 <tr>
337- <th>auth </th>
339+ <th>authorize </th>
338340 <th>retry_auth</th>
339341 <th>resume_auth</th>
340342 <th>retry_auth</th>
@@ -551,11 +553,11 @@ We can now construct a variety of authorization policies.
551553 Suppose we have a workflow W that needs to pause on inputstep `approval` for approval from finance. Ops (and only ops) should be able to start the workflow and retry any failed steps. Finance (and only finance) should be able to resume at the input step.
552554
553555 ```python
554- @workflow("An expensive workflow", auth =allow_roles("ops"))
556+ @workflow("An expensive workflow", authorize_callback =allow_roles("ops"))
555557 def W(...):
556558 return begin >> A >> ... >> notify_finance >> approval >> ... >> Z
557559
558- @inputstep("Approval", resume_auth =allow_roles("finance"), retry_auth =allow_roles("ops"))
560+ @inputstep("Approval", resume_auth_callback =allow_roles("finance"), retry_auth_callback =allow_roles("ops"))
559561 def approval(...):
560562 ...
561563 ```
@@ -568,27 +570,27 @@ We can now construct a variety of authorization policies.
568570 Dev can start the workflow and retry steps prior to S. Once step S is reached, Platform (and only Platform) can resume the workflow and retry later failed steps.
569571
570572 ```python
571- @workflow("An expensive workflow", auth =allow_roles("dev"))
573+ @workflow("An expensive workflow", authorize_callback =allow_roles("dev"))
572574 def W(...):
573575 return begin >> A >> ... >> notify_platform >> handoff >> ... >> Z
574576
575- @inputstep("Hand-off", resume_auth =allow_roles("platform"))
577+ @inputstep("Hand-off", resume_auth_callback =allow_roles("platform"))
576578 def handoff(...):
577579 ...
578580 ```
579- Notice that default behaviors let us ignore `retry_auth ` arguments in both decorators.
581+ Notice that default behaviors let us ignore `retry_auth_callback ` arguments in both decorators.
580582
581583#### Restricted Retries Model
582584!!!example
583585 Suppose we have a workflow that anyone can run, but with steps that should only be retried by users with certain backend access.
584586
585587 ```python
586- @workflow("A workflow for any user", retry_auth =allow_roles("admin"))
588+ @workflow("A workflow for any user", retry_auth_callback =allow_roles("admin"))
587589 def W(...):
588590 return begin >> A >> ... >> S >> ... >> Z
589591 ```
590592
591- Note that we could specify `auth =allow_roles("user")` if helpful, or we can omit `auth ` to fail open to any logged in user.
593+ Note that we could specify `authorize_callback =allow_roles("user")` if helpful, or we can omit `authorize_callback ` to fail over to any logged in user.
592594
593595[1]: https://github.com/workfloworchestrator/example-orchestrator-ui
594596[2]: https://github.com/workfloworchestrator/example-orchestrator
0 commit comments