| 385 | } |
| 386 | |
| 387 | func (f *Flow) HandleConsentRequest(r *AcceptOAuth2ConsentRequest) error { |
| 388 | if err := f.State.IsAny(FlowStateConsentInitialized, FlowStateConsentUnused, FlowStateConsentError); err != nil { |
| 389 | return err |
| 390 | } |
| 391 | |
| 392 | f.State = FlowStateConsentUnused |
| 393 | |
| 394 | f.GrantedScope = r.GrantedScope |
| 395 | f.GrantedAudience = r.GrantedAudience |
| 396 | f.ConsentRemember = r.Remember |
| 397 | f.ConsentRememberFor = &r.RememberFor |
| 398 | f.ConsentHandledAt = sqlxx.NullTime(time.Now().UTC()) |
| 399 | f.ConsentError = nil |
| 400 | if r.Context != nil { |
| 401 | f.Context = r.Context |
| 402 | } |
| 403 | |
| 404 | if r.Session != nil { |
| 405 | f.SessionIDToken = r.Session.IDToken |
| 406 | f.SessionAccessToken = r.Session.AccessToken |
| 407 | } |
| 408 | return nil |
| 409 | } |
| 410 | |
| 411 | func (f *Flow) HandleConsentError(er *RequestDeniedError) error { |
| 412 | if err := f.State.IsAny(FlowStateConsentInitialized, FlowStateConsentUnused, FlowStateConsentError); err != nil { |