summaryrefslogtreecommitdiff
path: root/src/oidc/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/oidc/main.go')
-rw-r--r--src/oidc/main.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/oidc/main.go b/src/oidc/main.go
index 6a93b36..c3d0574 100644
--- a/src/oidc/main.go
+++ b/src/oidc/main.go
@@ -5,6 +5,7 @@ import (
"io/ioutil"
"log"
"net/http"
+ "text/template"
"time"
"github.com/golang-jwt/jwt"
@@ -83,7 +84,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
RedirectUri: r.FormValue("redirect_uri"),
Nonce: r.FormValue("nonce"),
}
- idToken := createIdToken(r.FormValue("client_id")
+ idToken := createIdToken(r.FormValue("client_id"))
url := fmt.Sprintf("%s?access_token=example&token_type=bearer&id_token=%s&expires_in=3600&state=%s", ar.RedirectUri, idToken, ar.State)
http.Redirect(w, r, url, 302)
} else if responseType == "code id_token" || responseType == "code token" || responseType == "code id_token token" {
@@ -117,6 +118,14 @@ func handler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
fmt.Fprintf(w, "Not Found\n")
}
+ } else if r.URL.Path == "/.well-known/openid-configuration" {
+ w.Header().Set("Content-Type", "application/json")
+ data, _ := ioutil.ReadFile("openid-configuration.json")
+ tmpl, _ := template.New("test").Parse(string(data))
+ type Blah struct {
+ Host string
+ }
+ tmpl.Execute(w, Blah{Host: "http://localhost:8282"})
} else {
w.WriteHeader(http.StatusNotFound)
fmt.Fprintf(w, "Not Found\n")