MCPcopy Create free account
hub / github.com/goadesign/goa / AuthorizationCodeFlow

Function AuthorizationCodeFlow

dsl/security.go:692–708  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

690// AuthorizationCodeFlow accepts three arguments: the authorization, token and
691// refresh URLs.
692func 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.

Callers 3

openapi_dsls.goFile · 0.85
security_dsls.goFile · 0.85

Calls 3

CurrentFunction · 0.92
IncompatibleDSLFunction · 0.92
ReportErrorFunction · 0.92

Tested by

no test coverage detected