mirror of
https://github.com/davidallendj/opaal.git
synced 2025-12-20 03:27:02 -07:00
Added target query param to login endpoint
This commit is contained in:
parent
3caf2b89d2
commit
0b9c1a74d0
1 changed files with 5 additions and 0 deletions
|
|
@ -49,6 +49,10 @@ func (s *Server) Login(buttons string, provider *oidc.IdentityProvider, client *
|
||||||
http.Redirect(w, r, "/login", http.StatusSeeOther)
|
http.Redirect(w, r, "/login", http.StatusSeeOther)
|
||||||
})
|
})
|
||||||
r.HandleFunc("/login", func(w http.ResponseWriter, r *http.Request) {
|
r.HandleFunc("/login", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// add target if query exists
|
||||||
|
if r != nil {
|
||||||
|
target = r.URL.Query().Get("target")
|
||||||
|
}
|
||||||
// show login page with notice to redirect
|
// show login page with notice to redirect
|
||||||
template, err := gonja.FromFile("pages/index.html")
|
template, err := gonja.FromFile("pages/index.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -129,6 +133,7 @@ func (s *Server) Login(buttons string, provider *oidc.IdentityProvider, client *
|
||||||
if err = template.Execute(w, data); err != nil { // Prints: Hello Bob!
|
if err = template.Execute(w, data); err != nil { // Prints: Hello Bob!
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
// try and send access code to target if set
|
||||||
if target != "" {
|
if target != "" {
|
||||||
httpx.MakeHttpRequest(target, http.MethodPost, []byte(accessToken), httpx.Headers{})
|
httpx.MakeHttpRequest(target, http.MethodPost, []byte(accessToken), httpx.Headers{})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue