HandleDeviceUserAuthRequest updates the flows fields from a handled request.
(h *HandledDeviceUserAuthRequest)
| 275 | |
| 276 | // HandleDeviceUserAuthRequest updates the flows fields from a handled request. |
| 277 | func (f *Flow) HandleDeviceUserAuthRequest(h *HandledDeviceUserAuthRequest) error { |
| 278 | if err := f.State.IsAny(DeviceFlowStateInitialized, DeviceFlowStateUnused); err != nil { |
| 279 | return err |
| 280 | } |
| 281 | |
| 282 | f.State = DeviceFlowStateUnused |
| 283 | |
| 284 | f.Client = h.Client |
| 285 | f.ClientID = h.Client.GetID() |
| 286 | f.DeviceCodeRequestID = sqlxx.NullString(h.DeviceCodeRequestID) |
| 287 | f.DeviceHandledAt = sqlxx.NullTime(time.Now().UTC()) |
| 288 | f.RequestedScope = h.RequestedScope |
| 289 | f.RequestedAudience = h.RequestedAudience |
| 290 | |
| 291 | return nil |
| 292 | } |
| 293 | |
| 294 | // InvalidateDeviceRequest shifts the flow state to DeviceFlowStateUsed. This |
| 295 | // transition is executed upon device completion. |