Skip to content

Instantly share code, notes, and snippets.

@yutakahashi114
Last active June 28, 2021 10:51
Show Gist options
  • Save yutakahashi114/5efe826eef370b141e479336da674600 to your computer and use it in GitHub Desktop.
Save yutakahashi114/5efe826eef370b141e479336da674600 to your computer and use it in GitHub Desktop.
import (
"fmt"
"log"
"net/http"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
)
func main() {
pubKeyString, err := getPublicKey()
if err != nil {
panic(err)
}
mux := chi.NewRouter()
mux.Use(middleware.Logger)
mux.Get("/{userPoolID}/.well-known/jwks.json", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(fmt.Sprintf(`{"keys":[%s]}`, pubKeyString)))
})
log.Println(http.ListenAndServe(":80", mux))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment