fallBackToUserAction promotes a running secure flow to the manual user-action channel after its prompt could not be delivered. The background flow keeps running, so the user can complete authorization out of band and retry. It is a no-op if the flow has already resolved.
(ua *UserAction)
| 231 | // running, so the user can complete authorization out of band and retry. It is a |
| 232 | // no-op if the flow has already resolved. |
| 233 | func (m *Manager) fallBackToUserAction(ua *UserAction) { |
| 234 | m.mu.Lock() |
| 235 | defer m.mu.Unlock() |
| 236 | if m.status != statusInProgress { |
| 237 | return |
| 238 | } |
| 239 | m.status = statusAwaitingUser |
| 240 | m.pending = ua |
| 241 | // Wake any callers joined on this flow so they receive the action, and clear |
| 242 | // done so complete() does not double-close it when run() later finishes. |
| 243 | if m.done != nil { |
| 244 | close(m.done) |
| 245 | m.done = nil |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | // complete records the flow result, installing a refreshing token source on |
| 250 | // success, and wakes any joined callers. |