🐛 Parse 'scope[]' key from self-client request
This commit is contained in:
parent
bf7b6df692
commit
ba25e69680
|
@ -2,6 +2,7 @@ package http
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -121,6 +122,21 @@ func (r *AuthAuthorizationRequest) bind(req *http.Request) error {
|
||||||
r.ResponseType = domain.ResponseTypeCode
|
r.ResponseType = domain.ResponseTypeCode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.URL.Query().Has("scope[]") {
|
||||||
|
for _, k := range req.URL.Query()["scope[]"] {
|
||||||
|
scope, err := domain.ParseScope(k)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot parse requested scope: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if r.Scope.Has(scope) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
r.Scope = append(r.Scope, scope)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +155,7 @@ func NewAuthVerifyRequest() *AuthVerifyRequest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:funlen,cyclop
|
//nolint:cyclop
|
||||||
func (r *AuthVerifyRequest) bind(req *http.Request) error {
|
func (r *AuthVerifyRequest) bind(req *http.Request) error {
|
||||||
indieAuthError := new(domain.Error)
|
indieAuthError := new(domain.Error)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue