AuthorizationCodeFlow defines an authorizationCode OAuth2 flow as described in section 1.3.1 of RFC 6749. AuthorizationCodeFlow must be used in OAuth2Security. AuthorizationCodeFlow accepts three arguments: the authorization, token and refresh URLs.
(authorizationURL, tokenURL, refreshURL string)
| 690 | // AuthorizationCodeFlow accepts three arguments: the authorization, token and |
| 691 | // refresh URLs. |
| 692 | func AuthorizationCodeFlow(authorizationURL, tokenURL, refreshURL string) { |
| 693 | current, ok := eval.Current().(*expr.SchemeExpr) |
| 694 | if !ok { |
| 695 | eval.IncompatibleDSL() |
| 696 | return |
| 697 | } |
| 698 | if current.Kind != expr.OAuth2Kind { |
| 699 | eval.ReportError("cannot specify flow for non-oauth2 security scheme.") |
| 700 | return |
| 701 | } |
| 702 | current.Flows = append(current.Flows, &expr.FlowExpr{ |
| 703 | Kind: expr.AuthorizationCodeFlowKind, |
| 704 | AuthorizationURL: authorizationURL, |
| 705 | TokenURL: tokenURL, |
| 706 | RefreshURL: refreshURL, |
| 707 | }) |
| 708 | } |
| 709 | |
| 710 | // ImplicitFlow defines an implicit OAuth2 flow as described in section 1.3.2 |
| 711 | // of RFC 6749. |
no test coverage detected