en/decoding abstraction

This commit is contained in:
Livio Amstutz 2020-07-13 07:30:00 +02:00
parent 2966355b0e
commit 4a10ffaaa2
13 changed files with 367 additions and 69 deletions

View file

@ -7,11 +7,10 @@ import (
"github.com/caos/oidc/pkg/oidc"
"github.com/caos/oidc/pkg/utils"
"github.com/gorilla/schema"
)
type UserinfoProvider interface {
Decoder() *schema.Decoder
Decoder() utils.Decoder
Crypto() Crypto
Storage() Storage
}
@ -35,7 +34,7 @@ func Userinfo(w http.ResponseWriter, r *http.Request, userinfoProvider UserinfoP
utils.MarshalJSON(w, info)
}
func getAccessToken(r *http.Request, decoder *schema.Decoder) (string, error) {
func getAccessToken(r *http.Request, decoder utils.Decoder) (string, error) {
authHeader := r.Header.Get("authorization")
if authHeader != "" {
parts := strings.Split(authHeader, "Bearer ")