forked from mystiq/dex
cmd/example-app: expose connector_id
As a piece of "living documentation" for #1481. Signed-off-by: Stephan Renatus <srenatus@chef.io>
This commit is contained in:
parent
20a858da3b
commit
c4e0587df1
2 changed files with 12 additions and 2 deletions
|
@ -237,6 +237,10 @@ func (a *app) handleLogin(w http.ResponseWriter, r *http.Request) {
|
||||||
for _, client := range clients {
|
for _, client := range clients {
|
||||||
scopes = append(scopes, "audience:server:client_id:"+client)
|
scopes = append(scopes, "audience:server:client_id:"+client)
|
||||||
}
|
}
|
||||||
|
connectorID := ""
|
||||||
|
if id := r.FormValue("connector_id"); id != "" {
|
||||||
|
connectorID = id
|
||||||
|
}
|
||||||
|
|
||||||
authCodeURL := ""
|
authCodeURL := ""
|
||||||
scopes = append(scopes, "openid", "profile", "email")
|
scopes = append(scopes, "openid", "profile", "email")
|
||||||
|
@ -248,6 +252,9 @@ func (a *app) handleLogin(w http.ResponseWriter, r *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
authCodeURL = a.oauth2Config(scopes).AuthCodeURL(exampleAppState, oauth2.AccessTypeOffline)
|
authCodeURL = a.oauth2Config(scopes).AuthCodeURL(exampleAppState, oauth2.AccessTypeOffline)
|
||||||
}
|
}
|
||||||
|
if connectorID != "" {
|
||||||
|
authCodeURL = authCodeURL + "&connector_id=" + connectorID
|
||||||
|
}
|
||||||
|
|
||||||
http.Redirect(w, r, authCodeURL, http.StatusSeeOther)
|
http.Redirect(w, r, authCodeURL, http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,9 @@ var indexTmpl = template.Must(template.New("index.html").Parse(`<html>
|
||||||
<p>
|
<p>
|
||||||
Extra scopes:<input type="text" name="extra_scopes" placeholder="list of scopes">
|
Extra scopes:<input type="text" name="extra_scopes" placeholder="list of scopes">
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
Connector ID:<input type="text" name="connector_id" placeholder="connector id">
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Request offline access:<input type="checkbox" name="offline_access" value="yes" checked>
|
Request offline access:<input type="checkbox" name="offline_access" value="yes" checked>
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in a new issue