mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-05-29 23:17:38 +02:00
Fix json input
Everything has to go through a json round trip to work. HTTP Request has function members within it that means it cannot go through a JSON round trip, so nil that for now
This commit is contained in:
parent
56a98c3fa9
commit
5ee52143e8
@ -7,9 +7,9 @@ import (
|
||||
"github.com/open-policy-agent/opa/rego"
|
||||
)
|
||||
|
||||
type authInput struct {
|
||||
request *http.Request
|
||||
session *sessionsapi.SessionState
|
||||
type AuthInput struct {
|
||||
Request *http.Request
|
||||
Session *sessionsapi.SessionState
|
||||
}
|
||||
|
||||
func authorize(req *http.Request, session *sessionsapi.SessionState) (bool, error) {
|
||||
@ -21,7 +21,7 @@ package oauth2proxy
|
||||
default allow = false
|
||||
|
||||
allow {
|
||||
endswith(input.session.email, "@bar.com")
|
||||
endswith(input.Session.Email, "@bar.com")
|
||||
}
|
||||
`),
|
||||
)
|
||||
@ -31,9 +31,9 @@ allow {
|
||||
return false, err
|
||||
}
|
||||
|
||||
input := rego.EvalInput(authInput{
|
||||
request: req,
|
||||
session: session,
|
||||
input := rego.EvalInput(AuthInput{
|
||||
Request: nil,
|
||||
Session: session,
|
||||
})
|
||||
|
||||
result, err := query.Eval(req.Context(), input)
|
||||
|
Loading…
x
Reference in New Issue
Block a user