github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/scripts/franceconnect-dev/redirect.go (about)

     1  package main
     2  
     3  import (
     4  	"net/http"
     5  	"net/url"
     6  )
     7  
     8  func callback(w http.ResponseWriter, req *http.Request) {
     9  	u := &url.URL{
    10  		Scheme:   req.URL.Scheme,
    11  		Host:     "localhost:8080",
    12  		Path:     "/oidc/redirect",
    13  		RawQuery: req.URL.RawQuery,
    14  	}
    15  	http.Redirect(w, req, u.String(), http.StatusSeeOther)
    16  }
    17  
    18  func main() {
    19  	http.HandleFunc("/callback", callback)
    20  	http.ListenAndServe(":4242", nil)
    21  }