update example

This commit is contained in:
Livio Amstutz 2019-12-03 15:18:03 +01:00
parent ecea7e3730
commit a793e77679

View file

@ -13,7 +13,6 @@ import (
"github.com/caos/oidc/pkg/oidc" "github.com/caos/oidc/pkg/oidc"
"github.com/caos/oidc/pkg/rp" "github.com/caos/oidc/pkg/rp"
"github.com/caos/oidc/pkg/utils"
) )
var ( var (
@ -36,8 +35,8 @@ func main() {
CallbackURL: fmt.Sprintf("http://localhost:%v%v", port, callbackPath), CallbackURL: fmt.Sprintf("http://localhost:%v%v", port, callbackPath),
Scopes: []string{"openid", "profile", "email"}, Scopes: []string{"openid", "profile", "email"},
} }
cookieHandler := utils.NewCookieHandler(hashKey, nil, utils.WithUnsecure()) // cookieHandler := utils.NewCookieHandler(hashKey, nil, utils.WithUnsecure())
provider, err := rp.NewDefaultRP(rpConfig, rp.WithCookieHandler(cookieHandler)) provider, err := rp.NewDefaultRP(rpConfig) //, rp.WithCookieHandler(cookieHandler))
if err != nil { if err != nil {
logrus.Panic("error creating provider") logrus.Panic("error creating provider")
} }
@ -64,7 +63,7 @@ func main() {
// w.Write(data) // w.Write(data)
// }) // })
var marshal = func(w http.ResponseWriter, r *http.Request, tokens *oidc.Tokens, state string) { marshal := func(w http.ResponseWriter, r *http.Request, tokens *oidc.Tokens, state string) {
_ = state _ = state
data, err := json.Marshal(tokens) data, err := json.Marshal(tokens)
if err != nil { if err != nil {