From c4e0587df11566311056f711a4be2f8df7b84204 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Wed, 24 Jul 2019 12:17:11 +0200 Subject: [PATCH] cmd/example-app: expose connector_id As a piece of "living documentation" for #1481. Signed-off-by: Stephan Renatus --- cmd/example-app/main.go | 7 +++++++ cmd/example-app/templates.go | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/example-app/main.go b/cmd/example-app/main.go index 21b025d2..ccf9c4ca 100644 --- a/cmd/example-app/main.go +++ b/cmd/example-app/main.go @@ -237,6 +237,10 @@ func (a *app) handleLogin(w http.ResponseWriter, r *http.Request) { for _, client := range clients { scopes = append(scopes, "audience:server:client_id:"+client) } + connectorID := "" + if id := r.FormValue("connector_id"); id != "" { + connectorID = id + } authCodeURL := "" scopes = append(scopes, "openid", "profile", "email") @@ -248,6 +252,9 @@ func (a *app) handleLogin(w http.ResponseWriter, r *http.Request) { } else { authCodeURL = a.oauth2Config(scopes).AuthCodeURL(exampleAppState, oauth2.AccessTypeOffline) } + if connectorID != "" { + authCodeURL = authCodeURL + "&connector_id=" + connectorID + } http.Redirect(w, r, authCodeURL, http.StatusSeeOther) } diff --git a/cmd/example-app/templates.go b/cmd/example-app/templates.go index 3a4b5bb2..09b4150a 100644 --- a/cmd/example-app/templates.go +++ b/cmd/example-app/templates.go @@ -15,8 +15,11 @@ var indexTmpl = template.Must(template.New("index.html").Parse(`

Extra scopes:

-

- Request offline access: +

+ Connector ID: +

+

+ Request offline access: