fix examples

This commit is contained in:
Livio Amstutz 2022-04-22 15:02:24 +02:00
parent 3dd0d5fc3a
commit 5c5d716409
No known key found for this signature in database
GPG key ID: 7AB5FDFBCA448635
6 changed files with 533 additions and 14 deletions

View file

@ -7,8 +7,6 @@ import (
"net/http"
"github.com/gorilla/mux"
"github.com/caos/oidc/pkg/op"
)
const (
@ -52,19 +50,19 @@ type login struct {
callback func(context.Context, string) string
}
func NewLogin(authenticate authenticate, callback func(context.Context, string) string, issuerInterceptor *op.IssuerInterceptor) *login {
func NewLogin(authenticate authenticate, callback func(context.Context, string) string) *login {
l := &login{
authenticate: authenticate,
callback: callback,
}
l.createRouter(issuerInterceptor)
l.createRouter()
return l
}
func (l *login) createRouter(issuerInterceptor *op.IssuerInterceptor) {
func (l *login) createRouter() {
l.router = mux.NewRouter()
l.router.Path("/username").Methods("GET").HandlerFunc(l.loginHandler)
l.router.Path("/username").Methods("POST").HandlerFunc(issuerInterceptor.HandlerFunc(l.checkLoginHandler))
l.router.Path("/username").Methods("POST").HandlerFunc(l.checkLoginHandler)
}
type authenticate interface {