fix binding

This commit is contained in:
Daniel Ponte 2022-11-12 12:45:25 -05:00
parent a65c6bc394
commit 414654585b
4 changed files with 11 additions and 14 deletions

View file

@ -6,6 +6,7 @@ import (
"time" "time"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/rs/zerolog/log"
) )
type SessionStore struct { type SessionStore struct {
@ -90,6 +91,7 @@ func (u *User) allowedToAuth() error {
} }
func (a *Authenticator) getOrCreateUser(c *Credential) (*User, error) { func (a *Authenticator) getOrCreateUser(c *Credential) (*User, error) {
log.Debug().Str("user", c.user.ProviderUsername()).Msg("getOrCreateUser")
panic("not implemented") panic("not implemented")
return &User{}, nil return &User{}, nil
} }
@ -128,9 +130,9 @@ func (c *ClientID) IsValid() bool {
} }
type TokenRequest struct { type TokenRequest struct {
ClientID ClientID `query:"client_id"` ClientID ClientID `form:"client_id"`
Code TokenID `query:"code"` Code TokenID `form:"code"`
GrantType GrantType `query:"grant_type"` GrantType GrantType `form:"grant_type"`
} }
func (a *Authenticator) TokenHandler(c echo.Context) error { func (a *Authenticator) TokenHandler(c echo.Context) error {
@ -140,10 +142,6 @@ func (a *Authenticator) TokenHandler(c echo.Context) error {
return err return err
} }
if *rq == (TokenRequest{}) {
panic("it didn't bind")
}
switch rq.GrantType { switch rq.GrantType {
case GTAuthorizationCode: case GTAuthorizationCode:
if !rq.ClientID.IsValid() { if !rq.ClientID.IsValid() {

View file

@ -33,7 +33,6 @@ func AliasHandler(toFile string) echo.HandlerFunc {
} }
} }
func init() { func init() {
var err error var err error